Views
No views yet
StableLM-Tuned-Alpha is a suite of 3B and 7B parameter decoder-only language models built on top of the StableLM-Base-Alpha models and further fine-tuned on various chat and instruction-following datasets.StableLM-Tuned-Alpha by using the following code snippet:1from transformers import AutoModelForCausalLM, AutoTokenizer, StoppingCriteria, StoppingCriteriaList
2
3tokenizer = AutoTokenizer.from_pretrained("StabilityAI/stablelm-tuned-alpha-7b")
4model = AutoModelForCausalLM.from_pretrained("StabilityAI/stablelm-tuned-alpha-7b")
5model.half().cuda()
6
7class StopOnTokens(StoppingCriteria):
8 def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
9 stop_ids = [50278, 50279, 50277, 1, 0]
10 for stop_id in stop_ids:
11 if input_ids[0][-1] == stop_id:
12 return True
13 return False
14
15system_prompt = """<|SYSTEM|># StableLM Tuned (Alpha version)
16- StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
17- StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
18- StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
19- StableLM will refuse to participate in anything that could harm a human.
20"""
21
22prompt = f"{system_prompt}<|USER|>What's your mood today?<|ASSISTANT|>"
23
24inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
25tokens = model.generate(
26 **inputs,
27 max_new_tokens=64,
28 temperature=0.7,
29 do_sample=True,
30 stopping_criteria=StoppingCriteriaList([StopOnTokens()])
31)
32print(tokenizer.decode(tokens[0], skip_special_tokens=True))<|SYSTEM|>...<|USER|>...<|ASSISTANT|>...
The system prompt is<|SYSTEM|># StableLM Tuned (Alpha version)
- StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
- StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
- StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
- StableLM will refuse to participate in anything that could harm a human.StableLM-Tuned-Alpha) are licensed under the Non-Commercial Creative Commons license (CC BY-NC-SA-4.0), in-line with the original non-commercial license specified by Stanford Alpaca.lm@stability.ai| Parameters | Hidden Size | Layers | Heads | Sequence Length |
|---|---|---|---|---|
| 3B | 4096 | 16 | 32 | 4096 |
| 7B | 6144 | 16 | 48 | 4096 |
StableLM-Tuned-Alpha models are fine-tuned on a combination of five datasets:
Alpaca, a dataset of 52,000 instructions and demonstrations generated by OpenAI's text-davinci-003 engine.
GPT4All Prompt Generations, which consists of 400k prompts and responses generated by GPT-4;
Anthropic HH, made up of preferences about AI assistant helpfulness and harmlessness;
DataBricks Dolly, comprising 15k instruction/responses generated by Databricks employees in capability domains from the InstructGPT paper, including brainstorming, classification, closed QA, generation, information extraction, open QA and summarization;
and ShareGPT Vicuna (English subset), a dataset of conversations retrieved from ShareGPT.| Parameters | Batch Size | Learning Rate | Warm-up | Weight Decay | Betas |
|---|---|---|---|---|---|
| 3B | 256 | 2e-5 | 50 | 0.01 | (0.9, 0.99) |
| 7B | 128 | 2e-5 | 100 | 0.01 | (0.9, 0.99) |
1@misc{alpaca,
2 author = {Rohan Taori and Ishaan Gulrajani and Tianyi Zhang and Yann Dubois and Xuechen Li and Carlos Guestrin and Percy Liang and Tatsunori B. Hashimoto },
3 title = {Stanford Alpaca: An Instruction-following LLaMA model},
4 year = {2023},
5 publisher = {GitHub},
6 journal = {GitHub repository},
7 howpublished = {\url{https://github.com/tatsu-lab/stanford_alpaca}},
8}1@misc{vicuna2023,
2 title = {Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality},
3 url = {https://vicuna.lmsys.org},
4 author = {Chiang, Wei-Lin and Li, Zhuohan and Lin, Zi and Sheng, Ying and Wu, Zhanghao and Zhang, Hao and Zheng, Lianmin and Zhuang, Siyuan and Zhuang, Yonghao and Gonzalez, Joseph E. and Stoica, Ion and Xing, Eric P.},
5 month = {March},
6 year = {2023}
7}1@misc{gpt4all,
2 author = {Yuvanesh Anand and Zach Nussbaum and Brandon Duderstadt and Benjamin Schmidt and Andriy Mulyar},
3 title = {GPT4All: Training an Assistant-style Chatbot with Large Scale Data Distillation from GPT-3.5-Turbo},
4 year = {2023},
5 publisher = {GitHub},
6 journal = {GitHub repository},
7 howpublished = {\url{https://github.com/nomic-ai/gpt4all}},
8}