Jamie@TitanML commited on
Commit
e83ad48
1 Parent(s): ef0d099

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -25,7 +25,6 @@
25
  *.safetensors filter=lfs diff=lfs merge=lfs -text
26
  saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
  *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
  *.tflite filter=lfs diff=lfs merge=lfs -text
30
  *.tgz filter=lfs diff=lfs merge=lfs -text
31
  *.wasm filter=lfs diff=lfs merge=lfs -text
 
25
  *.safetensors filter=lfs diff=lfs merge=lfs -text
26
  saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
  *.tar.* filter=lfs diff=lfs merge=lfs -text
 
28
  *.tflite filter=lfs diff=lfs merge=lfs -text
29
  *.tgz filter=lfs diff=lfs merge=lfs -text
30
  *.wasm filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - causal-lm
6
+ license: cc-by-nc-sa-4.0
7
+ datasets:
8
+ - dmayhem93/ChatCombined
9
+ - tatsu-lab/alpaca
10
+ - nomic-ai/gpt4all_prompt_generations
11
+ - Dahoas/full-hh-rlhf
12
+ - jeffwan/sharegpt_vicuna
13
+ - HuggingFaceH4/databricks_dolly_15k
14
+ ---
15
+
16
+ # StableLM-Tuned-Alpha
17
+
18
+ ## Model Description
19
+
20
+ `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.
21
+
22
+ ## Usage
23
+
24
+ Get started chatting with `StableLM-Tuned-Alpha` by using the following code snippet:
25
+
26
+ ```python
27
+ from transformers import AutoModelForCausalLM, AutoTokenizer, StoppingCriteria, StoppingCriteriaList
28
+
29
+ tokenizer = AutoTokenizer.from_pretrained("StabilityAI/stablelm-tuned-alpha-7b")
30
+ model = AutoModelForCausalLM.from_pretrained("StabilityAI/stablelm-tuned-alpha-7b")
31
+ model.half().cuda()
32
+
33
+ class StopOnTokens(StoppingCriteria):
34
+ def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
35
+ stop_ids = [50278, 50279, 50277, 1, 0]
36
+ for stop_id in stop_ids:
37
+ if input_ids[0][-1] == stop_id:
38
+ return True
39
+ return False
40
+
41
+ system_prompt = """<|SYSTEM|># StableLM Tuned (Alpha version)
42
+ - StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
43
+ - StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
44
+ - StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
45
+ - StableLM will refuse to participate in anything that could harm a human.
46
+ """
47
+
48
+ prompt = f"{system_prompt}<|USER|>What's your mood today?<|ASSISTANT|>"
49
+
50
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
51
+ tokens = model.generate(
52
+ **inputs,
53
+ max_new_tokens=64,
54
+ temperature=0.7,
55
+ do_sample=True,
56
+ stopping_criteria=StoppingCriteriaList([StopOnTokens()])
57
+ )
58
+ print(tokenizer.decode(tokens[0], skip_special_tokens=True))
59
+ ```
60
+
61
+ StableLM Tuned should be used with prompts formatted to `<|SYSTEM|>...<|USER|>...<|ASSISTANT|>...`
62
+ The system prompt is
63
+ ```
64
+ <|SYSTEM|># StableLM Tuned (Alpha version)
65
+ - StableLM is a helpful and harmless open-source AI language model developed by StabilityAI.
66
+ - StableLM is excited to be able to help the user, but will refuse to do anything that could be considered harmful to the user.
67
+ - StableLM is more than just an information source, StableLM is also able to write poetry, short stories, and make jokes.
68
+ - StableLM will refuse to participate in anything that could harm a human.
69
+ ```
70
+
71
+ ## Model Details
72
+
73
+ * **Developed by**: [Stability AI](https://stability.ai/)
74
+ * **Model type**: StableLM-Tuned-Alpha models are auto-regressive language models based on the NeoX transformer architecture.
75
+ * **Language(s)**: English
76
+ * **Library**: [HuggingFace Transformers](https://github.com/huggingface/transformers)
77
+ * **License**: Fine-tuned checkpoints (`StableLM-Tuned-Alpha`) are licensed under the Non-Commercial Creative Commons license ([CC BY-NC-SA-4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)), in-line with the original non-commercial license specified by [Stanford Alpaca](https://github.com/tatsu-lab/stanford_alpaca).
78
+ * **Contact**: For questions and comments about the model, please email `lm@stability.ai`
79
+
80
+ ## Training
81
+
82
+ | Parameters | Hidden Size | Layers | Heads | Sequence Length |
83
+ |------------|-------------|--------|-------|-----------------|
84
+ | 3B | 4096 | 16 | 32 | 4096 |
85
+ | 7B | 6144 | 16 | 48 | 4096 |
86
+
87
+ ### Training Dataset
88
+
89
+ `StableLM-Tuned-Alpha` models are fine-tuned on a combination of five datasets:
90
+ [Alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca), a dataset of 52,000 instructions and demonstrations generated by OpenAI's `text-davinci-003` engine.
91
+ [GPT4All Prompt Generations](https://huggingface.co/datasets/nomic-ai/gpt4all_prompt_generations), which consists of 400k prompts and responses generated by GPT-4;
92
+ [Anthropic HH](https://huggingface.co/datasets/Dahoas/full-hh-rlhf), made up of preferences about AI assistant helpfulness and harmlessness;
93
+ [DataBricks Dolly](https://github.com/databrickslabs/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;
94
+ and [ShareGPT Vicuna (English subset)](https://huggingface.co/datasets/jeffwan/sharegpt_vicuna), a dataset of conversations retrieved from [ShareGPT](https://sharegpt.com/).
95
+
96
+ ### Training Procedure
97
+
98
+ Models are learned via supervised fine-tuning on the aforementioned datasets, trained in mixed-precision (FP16), and optimized with AdamW. We outline the following hyperparameters:
99
+
100
+ | Parameters | Batch Size | Learning Rate | Warm-up | Weight Decay | Betas |
101
+ |------------|------------|---------------|---------|--------------|-------------|
102
+ | 3B | 256 | 2e-5 | 50 | 0.01 | (0.9, 0.99) |
103
+ | 7B | 128 | 2e-5 | 100 | 0.01 | (0.9, 0.99) |
104
+
105
+ ## Use and Limitations
106
+
107
+ ### Intended Use
108
+
109
+ These models are intended to be used by the open-source community chat-like applications in adherence with the [CC BY-NC-SA-4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/) license.
110
+
111
+ ### Limitations and bias
112
+
113
+ Although the aforementioned datasets help to steer the base language models into "safer" distributions of text, not all biases and toxicity can be mitigated through fine-tuning. We ask that users be mindful of such potential issues that can arise in generated responses. Do not treat model outputs as substitutes for human judgment or as sources of truth. Please use responsibly.
114
+
115
+ ## Acknowledgements
116
+
117
+ This work would not have been possible without the helpful hand of Dakota Mahan ([@dmayhem93](https://huggingface.co/dmayhem93)).
118
+
119
+ ## Citations
120
+
121
+ ```bibtex
122
+ @misc{alpaca,
123
+ 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 },
124
+ title = {Stanford Alpaca: An Instruction-following LLaMA model},
125
+ year = {2023},
126
+ publisher = {GitHub},
127
+ journal = {GitHub repository},
128
+ howpublished = {\url{https://github.com/tatsu-lab/stanford_alpaca}},
129
+ }
130
+ ```
131
+
132
+ ```bibtext
133
+ @misc{vicuna2023,
134
+ title = {Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality},
135
+ url = {https://vicuna.lmsys.org},
136
+ 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.},
137
+ month = {March},
138
+ year = {2023}
139
+ }
140
+ ```
141
+
142
+ ```bibtex
143
+ @misc{gpt4all,
144
+ author = {Yuvanesh Anand and Zach Nussbaum and Brandon Duderstadt and Benjamin Schmidt and Andriy Mulyar},
145
+ title = {GPT4All: Training an Assistant-style Chatbot with Large Scale Data Distillation from GPT-3.5-Turbo},
146
+ year = {2023},
147
+ publisher = {GitHub},
148
+ journal = {GitHub repository},
149
+ howpublished = {\url{https://github.com/nomic-ai/gpt4all}},
150
+ }
151
+ ```
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "7b-tuned-69k",
3
+ "architectures": [
4
+ "GPTNeoXForCausalLM"
5
+ ],
6
+ "bos_token_id": 0,
7
+ "eos_token_id": 0,
8
+ "hidden_act": "gelu",
9
+ "hidden_size": 6144,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 24576,
12
+ "layer_norm_eps": 1e-05,
13
+ "max_position_embeddings": 4096,
14
+ "model_type": "gpt_neox",
15
+ "num_attention_heads": 48,
16
+ "num_hidden_layers": 16,
17
+ "rotary_emb_base": 10000,
18
+ "rotary_pct": 0.25,
19
+ "tie_word_embeddings": false,
20
+ "torch_dtype": "float32",
21
+ "transformers_version": "4.28.1",
22
+ "use_cache": true,
23
+ "use_parallel_residual": true,
24
+ "vocab_size": 50432
25
+ }
ct_output_models/config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|endoftext|>",
3
+ "eos_token": "<|endoftext|>",
4
+ "layer_norm_epsilon": null,
5
+ "unk_token": "<|endoftext|>"
6
+ }
ct_output_models/model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f14d154f73426b1959162a0eb600afc043b326502e67612211de296b0d0904c4
3
+ size 7876585874
ct_output_models/vocabulary.json ADDED
The diff for this file is too large to render. See raw diff
 
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 0,
5
+ "transformers_version": "4.28.1"
6
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|endoftext|>",
3
+ "eos_token": "<|endoftext|>",
4
+ "unk_token": "<|endoftext|>"
5
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "bos_token": "<|endoftext|>",
4
+ "clean_up_tokenization_spaces": true,
5
+ "eos_token": "<|endoftext|>",
6
+ "model_max_length": 1000000000000000019884624838656,
7
+ "tokenizer_class": "GPTNeoXTokenizer",
8
+ "unk_token": "<|endoftext|>"
9
+ }