michaelfeil commited on
Commit
a0322cd
1 Parent(s): 1c606cd

Upload HuggingFaceH4/starchat-beta ctranslate fp16 weights

Browse files
.gitattributes CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ model_logo.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - ctranslate2
4
+ - int8
5
+ - float16
6
+ - generated_from_trainer
7
+ widget:
8
+ - text: "How can I write a Python function to generate the nth Fibonacci number?"
9
+ - text: "How do I get the current date using shell commands? Explain how it works."
10
+ model-index:
11
+ - name: starchat-beta
12
+ results: []
13
+ license: bigcode-openrail-m
14
+ ---
15
+ # # Fast-Inference with Ctranslate2
16
+ Speedup inference while reducing memory by 2x-4x using int8 inference in C++ on CPU or GPU.
17
+
18
+ quantized version of [HuggingFaceH4/starchat-beta](https://huggingface.co/HuggingFaceH4/starchat-beta)
19
+ ```bash
20
+ pip install hf-hub-ctranslate2>=2.0.8 ctranslate2>=3.14.0
21
+ ```
22
+ Converted on 2023-06-12 using
23
+ ```
24
+ ct2-transformers-converter --model HuggingFaceH4/starchat-beta --output_dir /home/michael/tmp-ct2fast-starchat-beta --force --copy_files merges.txt all_results.json training_args.bin tokenizer.json README.md dialogue_template.json tokenizer_config.json eval_results.json vocab.json train_results.json generation_config.json trainer_state.json special_tokens_map.json added_tokens.json requirements.txt .gitattributes --quantization int8_float16 --trust_remote_code
25
+ ```
26
+
27
+ Checkpoint compatible to [ctranslate2>=3.15.0](https://github.com/OpenNMT/CTranslate2)
28
+ and [hf-hub-ctranslate2>=2.0.8](https://github.com/michaelfeil/hf-hub-ctranslate2)
29
+ - `compute_type=int8_float16` for `device="cuda"`
30
+ - `compute_type=int8` for `device="cpu"`
31
+
32
+ ```python
33
+ from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
34
+ from transformers import AutoTokenizer
35
+
36
+ model_name = "michaelfeil/ct2fast-starchat-beta"
37
+ # use either TranslatorCT2fromHfHub or GeneratorCT2fromHfHub here, depending on model.
38
+ model = GeneratorCT2fromHfHub(
39
+ # load in int8 on CUDA
40
+ model_name_or_path=model_name,
41
+ device="cuda",
42
+ compute_type="int8_float16",
43
+ # tokenizer=AutoTokenizer.from_pretrained("HuggingFaceH4/starchat-beta")
44
+ )
45
+ outputs = model.generate(
46
+ text=["def fibonnaci(", "User: How are you doing? Bot:"],
47
+ max_length=64,
48
+ include_prompt_in_result=False
49
+ )
50
+ print(outputs)
51
+ ```
52
+
53
+ # Licence and other remarks:
54
+ This is just a quantized version. Licence conditions are intended to be idential to original huggingface repo.
55
+
56
+ # Original description
57
+
58
+
59
+
60
+ <img src="https://huggingface.co/HuggingFaceH4/starchat-beta/resolve/main/model_logo.png" alt="StarChat Beta Logo" width="800" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
61
+
62
+ # Model Card for StarChat-β
63
+
64
+ 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](https://huggingface.co/bigcode/starcoderplus) that was trained on an ["uncensored"](https://erichartford.com/uncensored-models) variant of the [`openassistant-guanaco` dataset](https://huggingface.co/datasets/timdettmers/openassistant-guanaco). We found that removing the in-built alignment of the OpenAssistant dataset boosted performance on the [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/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.
65
+
66
+ ## Model Details
67
+
68
+ ### Model Description
69
+
70
+ <!-- Provide a longer summary of what this model is. -->
71
+
72
+ - **Model type:** A 16B parameter GPT-like model fine-tuned on an ["uncensored"](https://erichartford.com/uncensored-models) variant of the [`openassistant-guanaco` dataset](https://huggingface.co/datasets/timdettmers/openassistant-guanaco).
73
+ - **Language(s) (NLP):** Primarily English and 80+ programming languages.
74
+ - **License:** BigCode Open RAIL-M v1
75
+ - **Finetuned from model:** [bigcode/starcoderplus](https://huggingface.co/bigcode/starcoderplus)
76
+
77
+ ### Model Sources
78
+
79
+ <!-- Provide the basic links for the model. -->
80
+
81
+ - **Repository:** https://github.com/bigcode-project/starcoder
82
+ - **Demo:** https://huggingface.co/spaces/HuggingFaceH4/starchat-playground
83
+
84
+
85
+ ## Intended uses & limitations
86
+
87
+ The model was fine-tuned on a variant of the [`OpenAssistant/oasst1`](https://huggingface.co/datasets/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](https://huggingface.co/spaces/HuggingFaceH4/starchat-playground) to test its coding capabilities.
88
+
89
+ Here's how you can run the model using the `pipeline()` function from 🤗 Transformers:
90
+
91
+ ```python
92
+ import torch
93
+ from transformers import pipeline
94
+
95
+ pipe = pipeline("text-generation", model="HuggingFaceH4/starchat-beta", torch_dtype=torch.bfloat16, device_map="auto")
96
+
97
+ # We use a variant of ChatML to format each message
98
+ prompt_template = "<|system|>\n<|end|>\n<|user|>\n{query}<|end|>\n<|assistant|>"
99
+ prompt = prompt_template.format(query="How do I sort a list in Python?")
100
+ # We use a special <|end|> token with ID 49155 to denote ends of a turn
101
+ outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.2, top_k=50, top_p=0.95, eos_token_id=49155)
102
+ # 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.
103
+ ```
104
+
105
+ ## Bias, Risks, and Limitations
106
+
107
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
108
+
109
+ 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).
110
+ 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](https://huggingface.co/datasets/bigcode/starcoderdata) which is derived from The Stack.
111
+
112
+ Since the base model was pretrained on a large corpus of code, it may produce code snippets that are syntactically valid but semantically incorrect.
113
+ For example, it may produce code that does not compile or that produces incorrect results.
114
+ It may also produce code that is vulnerable to security exploits.
115
+ We have observed the model also has a tendency to produce false URLs which should be carefully inspected before clicking.
116
+
117
+ StarChat-β was fine-tuned from the base model [StarCoderPlus](https://huggingface.co/bigcode/starcoderplus), please refer to its model card's [Limitations Section](https://huggingface.co/bigcode/starcoderplus#limitations) for relevant information.
118
+ 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](https://drive.google.com/file/d/1cN-b9GnWtHzQRoE7M7gAEyivY0kl4BYs/view).
119
+
120
+ ## Training and evaluation data
121
+
122
+ StarChat-β is trained on an ["uncensored"](https://erichartford.com/uncensored-models) variant of the [`openassistant-guanaco` dataset](https://huggingface.co/datasets/timdettmers/openassistant-guanaco). We applied the same [recipe](https://huggingface.co/datasets/ehartford/WizardLM_alpaca_evol_instruct_70k_unfiltered/blob/main/wizardlm_clean.py) used to filter the ShareGPT datasets behind the [WizardLM](https://huggingface.co/datasets/ehartford/WizardLM_alpaca_evol_instruct_70k_unfiltered).
123
+
124
+ ## Training procedure
125
+
126
+ ### Training hyperparameters
127
+
128
+ The following hyperparameters were used during training:
129
+ - learning_rate: 2e-05
130
+ - train_batch_size: 4
131
+ - eval_batch_size: 4
132
+ - seed: 42
133
+ - distributed_type: multi-GPU
134
+ - num_devices: 8
135
+ - gradient_accumulation_steps: 8
136
+ - total_train_batch_size: 256
137
+ - total_eval_batch_size: 32
138
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
139
+ - lr_scheduler_type: cosine
140
+ - lr_scheduler_warmup_ratio: 0.03
141
+ - num_epochs: 6
142
+
143
+ ### Training results
144
+
145
+ | Training Loss | Epoch | Step | Validation Loss |
146
+ |:-------------:|:-----:|:----:|:---------------:|
147
+ | 1.5321 | 0.98 | 15 | 1.2856 |
148
+ | 1.2071 | 1.97 | 30 | 1.2620 |
149
+ | 1.0162 | 2.95 | 45 | 1.2853 |
150
+ | 0.8484 | 4.0 | 61 | 1.3274 |
151
+ | 0.6981 | 4.98 | 76 | 1.3994 |
152
+ | 0.5668 | 5.9 | 90 | 1.4720 |
153
+
154
+
155
+ ### Framework versions
156
+
157
+ - Transformers 4.28.1
158
+ - Pytorch 2.0.1+cu118
159
+ - Datasets 2.12.0
160
+ - Tokenizers 0.13.3
161
+
162
+ ## Citation
163
+
164
+ 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:
165
+
166
+ **BibTeX:**
167
+
168
+ ```
169
+ @article{Tunstall2023starchat-alpha,
170
+ 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},
171
+ title = {Creating a Coding Assistant with StarCoder},
172
+ journal = {Hugging Face Blog},
173
+ year = {2023},
174
+ note = {https://huggingface.co/blog/starchat},
175
+ }
176
+ ```
added_tokens.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "<|assistant|>": 49154,
3
+ "<|end|>": 49155,
4
+ "<|system|>": 49152,
5
+ "<|user|>": 49153
6
+ }
all_results.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 5.9,
3
+ "eval_loss": 1.4719988107681274,
4
+ "eval_runtime": 5.2039,
5
+ "eval_samples": 202,
6
+ "eval_samples_per_second": 38.817,
7
+ "eval_steps_per_second": 1.345,
8
+ "perplexity": 4.35793713301621,
9
+ "train_loss": 0.9728257921006944,
10
+ "train_runtime": 2307.7787,
11
+ "train_samples": 3888,
12
+ "train_samples_per_second": 10.108,
13
+ "train_steps_per_second": 0.039
14
+ }
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
+ }
dialogue_template.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "system": "",
3
+ "messages": null,
4
+ "system_token": "<|system|>",
5
+ "system_format": "standard",
6
+ "user_token": "<|user|>",
7
+ "assistant_token": "<|assistant|>",
8
+ "end_token": "<|end|>",
9
+ "mid_str": "\n",
10
+ "end_str": "\n",
11
+ "extra_end_text": ""
12
+ }
eval_results.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 5.9,
3
+ "eval_loss": 1.4719988107681274,
4
+ "eval_runtime": 5.2039,
5
+ "eval_samples": 202,
6
+ "eval_samples_per_second": 38.817,
7
+ "eval_steps_per_second": 1.345,
8
+ "perplexity": 4.35793713301621
9
+ }
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
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e4566397ac87311d6b0b103f11688e579720f618cd4d9903482a384ed8d6ff9
3
+ size 15577696155
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ transformers==4.28.1
2
+ accelerate>=0.16.0
3
+ bitsandbytes
4
+ sentencepiece
5
+ git+https://github.com/huggingface/peft.git@632997d1fb776c3cf05d8c2537ac9a98a7ce9435
special_tokens_map.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|system|>",
4
+ "<|user|>",
5
+ "<|assistant|>",
6
+ "<|end|>"
7
+ ],
8
+ "bos_token": "<|endoftext|>",
9
+ "eos_token": "<|endoftext|>",
10
+ "unk_token": "<|endoftext|>"
11
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "additional_special_tokens": [
4
+ "<|endoftext|>",
5
+ "<fim_prefix>",
6
+ "<fim_middle>",
7
+ "<fim_suffix>",
8
+ "<fim_pad>",
9
+ "<filename>",
10
+ "<gh_stars>",
11
+ "<issue_start>",
12
+ "<issue_comment>",
13
+ "<issue_closed>",
14
+ "<jupyter_start>",
15
+ "<jupyter_text>",
16
+ "<jupyter_code>",
17
+ "<jupyter_output>",
18
+ "<empty_output>",
19
+ "<commit_before>",
20
+ "<commit_msg>",
21
+ "<commit_after>",
22
+ "<reponame>"
23
+ ],
24
+ "bos_token": "<|endoftext|>",
25
+ "clean_up_tokenization_spaces": true,
26
+ "eos_token": "<|endoftext|>",
27
+ "model_max_length": 1000000000000000019884624838656,
28
+ "tokenizer_class": "GPT2Tokenizer",
29
+ "unk_token": "<|endoftext|>",
30
+ "vocab_size": 49152
31
+ }
train_results.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 5.9,
3
+ "train_loss": 0.9728257921006944,
4
+ "train_runtime": 2307.7787,
5
+ "train_samples": 3888,
6
+ "train_samples_per_second": 10.108,
7
+ "train_steps_per_second": 0.039
8
+ }
trainer_state.json ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 5.901639344262295,
5
+ "global_step": 90,
6
+ "is_hyper_param_search": false,
7
+ "is_local_process_zero": true,
8
+ "is_world_process_zero": true,
9
+ "log_history": [
10
+ {
11
+ "epoch": 0.07,
12
+ "learning_rate": 0.0,
13
+ "loss": 1.8309,
14
+ "step": 1
15
+ },
16
+ {
17
+ "epoch": 0.52,
18
+ "learning_rate": 2e-05,
19
+ "loss": 1.5321,
20
+ "step": 8
21
+ },
22
+ {
23
+ "epoch": 0.98,
24
+ "eval_loss": 1.2855817079544067,
25
+ "eval_runtime": 6.6367,
26
+ "eval_samples_per_second": 30.437,
27
+ "eval_steps_per_second": 1.055,
28
+ "step": 15
29
+ },
30
+ {
31
+ "epoch": 1.05,
32
+ "learning_rate": 2e-05,
33
+ "loss": 1.35,
34
+ "step": 16
35
+ },
36
+ {
37
+ "epoch": 1.57,
38
+ "learning_rate": 2e-05,
39
+ "loss": 1.2071,
40
+ "step": 24
41
+ },
42
+ {
43
+ "epoch": 1.97,
44
+ "eval_loss": 1.2619894742965698,
45
+ "eval_runtime": 5.1554,
46
+ "eval_samples_per_second": 39.183,
47
+ "eval_steps_per_second": 1.358,
48
+ "step": 30
49
+ },
50
+ {
51
+ "epoch": 2.1,
52
+ "learning_rate": 2e-05,
53
+ "loss": 1.1502,
54
+ "step": 32
55
+ },
56
+ {
57
+ "epoch": 2.62,
58
+ "learning_rate": 2e-05,
59
+ "loss": 1.0162,
60
+ "step": 40
61
+ },
62
+ {
63
+ "epoch": 2.95,
64
+ "eval_loss": 1.285272240638733,
65
+ "eval_runtime": 5.1992,
66
+ "eval_samples_per_second": 38.852,
67
+ "eval_steps_per_second": 1.346,
68
+ "step": 45
69
+ },
70
+ {
71
+ "epoch": 3.15,
72
+ "learning_rate": 2e-05,
73
+ "loss": 0.9511,
74
+ "step": 48
75
+ },
76
+ {
77
+ "epoch": 3.67,
78
+ "learning_rate": 2e-05,
79
+ "loss": 0.8484,
80
+ "step": 56
81
+ },
82
+ {
83
+ "epoch": 4.0,
84
+ "eval_loss": 1.3274288177490234,
85
+ "eval_runtime": 5.1899,
86
+ "eval_samples_per_second": 38.922,
87
+ "eval_steps_per_second": 1.349,
88
+ "step": 61
89
+ },
90
+ {
91
+ "epoch": 4.2,
92
+ "learning_rate": 2e-05,
93
+ "loss": 0.7971,
94
+ "step": 64
95
+ },
96
+ {
97
+ "epoch": 4.72,
98
+ "learning_rate": 2e-05,
99
+ "loss": 0.6981,
100
+ "step": 72
101
+ },
102
+ {
103
+ "epoch": 4.98,
104
+ "eval_loss": 1.3993656635284424,
105
+ "eval_runtime": 5.213,
106
+ "eval_samples_per_second": 38.749,
107
+ "eval_steps_per_second": 1.343,
108
+ "step": 76
109
+ },
110
+ {
111
+ "epoch": 5.25,
112
+ "learning_rate": 2e-05,
113
+ "loss": 0.6462,
114
+ "step": 80
115
+ },
116
+ {
117
+ "epoch": 5.77,
118
+ "learning_rate": 2e-05,
119
+ "loss": 0.5668,
120
+ "step": 88
121
+ },
122
+ {
123
+ "epoch": 5.9,
124
+ "eval_loss": 1.4719988107681274,
125
+ "eval_runtime": 5.1996,
126
+ "eval_samples_per_second": 38.849,
127
+ "eval_steps_per_second": 1.346,
128
+ "step": 90
129
+ },
130
+ {
131
+ "epoch": 5.9,
132
+ "step": 90,
133
+ "total_flos": 383994839433216.0,
134
+ "train_loss": 0.9728257921006944,
135
+ "train_runtime": 2307.7787,
136
+ "train_samples_per_second": 10.108,
137
+ "train_steps_per_second": 0.039
138
+ }
139
+ ],
140
+ "max_steps": 90,
141
+ "num_train_epochs": 6,
142
+ "total_flos": 383994839433216.0,
143
+ "trial_name": null,
144
+ "trial_params": null
145
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d758c20cdca5c51a4915cd92b74a547ca1b5077aaf48d7b685529d240356f725
3
+ size 4987
vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
vocabulary.txt ADDED
The diff for this file is too large to render. See raw diff