from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
from transformers import AutoTokenizer
model_name = "michaelfeil/ct2fast-starchat-beta"# use either TranslatorCT2fromHfHub or GeneratorCT2fromHfHub here, depending on model.
model = GeneratorCT2fromHfHub(
# load in int8 on CUDA
model_name_or_path=model_name,
device="cuda",
compute_type="int8_float16",
# tokenizer=AutoTokenizer.from_pretrained("HuggingFaceH4/starchat-beta")
)
outputs = model.generate(
text=["def fibonnaci(", "User: How are you doing? Bot:"],
max_length=64,
include_prompt_in_result=False
)
print(outputs)
Licence and other remarks:
This is just a quantized version. Licence conditions are intended to be idential to original huggingface repo.
Original description
Model Card for StarChat-β
StarChat is a series of language models that are trained to act as helpful coding assistants. StarChat-β is the second model in the series, and is a fine-tuned version of
StarCoderPlus
that was trained on an
"uncensored"
variant of the
openassistant-guanaco
dataset
. We found that removing the in-built alignment of the OpenAssistant dataset boosted performance on the
Open LLM Leaderboard
and made the model more helpful at coding tasks. However, this means that model is likely to generate problematic text when prompted to do so and should only be used for educational and research purposes.
The model was fine-tuned on a variant of the
OpenAssistant/oasst1
dataset, which contains a diverse range of dialogues in over 35 languages. As a result, the model can be used for chat and you can check out our
demo
to test its coding capabilities.
Here's how you can run the model using the
pipeline()
function from 🤗 Transformers:
import torch
from transformers import pipeline
pipe = pipeline("text-generation", model="HuggingFaceH4/starchat-beta", torch_dtype=torch.bfloat16, device_map="auto")
# We use a variant of ChatML to format each message
prompt_template = "<|system|>\n<|end|>\n<|user|>\n{query}<|end|>\n<|assistant|>"
prompt = prompt_template.format(query="How do I sort a list in Python?")
# We use a special <|end|> token with ID 49155 to denote ends of a turn
outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.2, top_k=50, top_p=0.95, eos_token_id=49155)
# You can sort a list in Python by using the sort() method. Here's an example:\n\n```\nnumbers = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]\nnumbers.sort()\nprint(numbers)\n```\n\nThis will sort the list in place and print the sorted list.
Bias, Risks, and Limitations
StarChat-β has not been aligned to human preferences with techniques like RLHF or deployed with in-the-loop filtering of responses like ChatGPT, so the model can produce problematic outputs (especially when prompted to do so).
Models trained primarily on code data will also have a more skewed demographic bias commensurate with the demographics of the GitHub community, for more on this see the
StarCoder dataset
which is derived from The Stack.
Since the base model was pretrained on a large corpus of code, it may produce code snippets that are syntactically valid but semantically incorrect.
For example, it may produce code that does not compile or that produces incorrect results.
It may also produce code that is vulnerable to security exploits.
We have observed the model also has a tendency to produce false URLs which should be carefully inspected before clicking.
StarChat-β was fine-tuned from the base model
StarCoderPlus
, please refer to its model card's
Limitations Section
for relevant information.
In particular, the model was evaluated on some categories of gender biases, propensity for toxicity, and risk of suggesting code completions with known security flaws; these evaluations are reported in its
technical report
.
The following hyperparameters were used during training:
learning_rate: 2e-05
train_batch_size: 4
eval_batch_size: 4
seed: 42
distributed_type: multi-GPU
num_devices: 8
gradient_accumulation_steps: 8
total_train_batch_size: 256
total_eval_batch_size: 32
optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
lr_scheduler_type: cosine
lr_scheduler_warmup_ratio: 0.03
num_epochs: 6
Training results
Training Loss
Epoch
Step
Validation Loss
1.5321
0.98
15
1.2856
1.2071
1.97
30
1.2620
1.0162
2.95
45
1.2853
0.8484
4.0
61
1.3274
0.6981
4.98
76
1.3994
0.5668
5.9
90
1.4720
Framework versions
Transformers 4.28.1
Pytorch 2.0.1+cu118
Datasets 2.12.0
Tokenizers 0.13.3
Citation
Although there isn't a blog post or paper associated with StarChat-β, you can find details on the earlier version in the blog post below:
BibTeX:
@article{Tunstall2023starchat-alpha,
author = {Tunstall, Lewis and Lambert, Nathan and Rajani, Nazneen and Beeching, Edward and Le Scao, Teven and von Werra, Leandro and Han, Sheon and Schmid, Philipp and Rush, Alexander},
title = {Creating a Coding Assistant with StarCoder},
journal = {Hugging Face Blog},
year = {2023},
note = {https://huggingface.co/blog/starchat},
}
Runs of michaelfeil ct2fast-starchat-beta on huggingface.co
10
Total runs
1
24-hour runs
1
3-day runs
1
7-day runs
5
30-day runs
More Information About ct2fast-starchat-beta huggingface.co Model
ct2fast-starchat-beta huggingface.co is an AI model on huggingface.co that provides ct2fast-starchat-beta's model effect (), which can be used instantly with this michaelfeil ct2fast-starchat-beta model. huggingface.co supports a free trial of the ct2fast-starchat-beta model, and also provides paid use of the ct2fast-starchat-beta. Support call ct2fast-starchat-beta model through api, including Node.js, Python, http.
ct2fast-starchat-beta huggingface.co is an online trial and call api platform, which integrates ct2fast-starchat-beta's modeling effects, including api services, and provides a free online trial of ct2fast-starchat-beta, you can try ct2fast-starchat-beta online for free by clicking the link below.
michaelfeil ct2fast-starchat-beta online free url in huggingface.co:
ct2fast-starchat-beta is an open source model from GitHub that offers a free installation service, and any user can find ct2fast-starchat-beta on GitHub to install. At the same time, huggingface.co provides the effect of ct2fast-starchat-beta install, users can directly use ct2fast-starchat-beta installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
ct2fast-starchat-beta install url in huggingface.co: