Transformers
English
ctranslate2
int8
float16
code
Inference Endpoints
michaelfeil commited on
Commit
fe53256
1 Parent(s): 87f3421

Upload HuggingFaceH4/starchat-alpha ctranslate fp16 weights

Browse files
README.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: bigcode-openrail-m
3
+ datasets:
4
+ - OpenAssistant/oasst1
5
+ - databricks/databricks-dolly-15k
6
+ language:
7
+ - en
8
+ library_name: transformers
9
+ tags:
10
+ - ctranslate2
11
+ - int8
12
+ - float16
13
+ - code
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-alpha](https://huggingface.co/HuggingFaceH4/starchat-alpha)
19
+ ```bash
20
+ pip install hf-hub-ctranslate2>=2.0.8
21
+ ```
22
+ Converted on 2023-05-23 using
23
+ ```
24
+ ct2-transformers-converter --model HuggingFaceH4/starchat-alpha --output_dir /home/michael/tmp-ct2fast-starchat-alpha --force --copy_files merges.txt all_results.json training_args.bin tokenizer.json README.md dialogue_template.json tokenizer_config.json eval_results.json TRAINER_README.md train_results.json generation_config.json trainer_state.json special_tokens_map.json added_tokens.json handler.py requirements.txt .gitattributes --quantization float16
25
+ ```
26
+
27
+ Checkpoint compatible to [ctranslate2>=3.13.0](https://github.com/OpenNMT/CTranslate2) and [hf-hub-ctranslate2>=2.0.6](https://github.com/michaelfeil/hf-hub-ctranslate2)
28
+ - `compute_type=int8_float16` for `device="cuda"`
29
+ - `compute_type=int8` for `device="cpu"`
30
+
31
+ ```python
32
+ from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
33
+ from transformers import AutoTokenizer
34
+
35
+ model_name = "michaelfeil/ct2fast-starchat-alpha"
36
+ # use either TranslatorCT2fromHfHub or GeneratorCT2fromHfHub here, depending on model.
37
+ model = GeneratorCT2fromHfHub(
38
+ # load in int8 on CUDA
39
+ model_name_or_path=model_name,
40
+ device="cuda",
41
+ compute_type="int8_float16",
42
+ # tokenizer=AutoTokenizer.from_pretrained("HuggingFaceH4/starchat-alpha")
43
+ )
44
+ outputs = model.generate(
45
+ text=["How do you call a fast Flan-ingo?", "User: How are you doing? Bot:"],
46
+ max_length=64
47
+ )
48
+ print(outputs)
49
+ ```
50
+
51
+ # Licence and other remarks:
52
+ This is just a quantized version. Licence conditions are intended to be idential to original huggingface repo.
53
+
54
+ # Original description
55
+
56
+
57
+ # Model Card for StarChat Alpha
58
+
59
+ <!-- Provide a quick summary of what the model is/does. -->
60
+
61
+ StarChat is a series of language models that are fine-tuned from StarCoder to act as helpful coding assistants. StarChat Alpha is the first of these models, and as an alpha release is only intended for educational or research purpopses. In particular, the model has not been aligned to human preferences with techniques like RLHF, so may generate problematic content (especially when prompted to do so).
62
+
63
+ ## Model Details
64
+
65
+ ### Model Description
66
+
67
+ <!-- Provide a longer summary of what this model is. -->
68
+
69
+ - **Model type:** A 16B parameter GPT-like model fine-tuned on a blend of the [`oasst1`](https://huggingface.co/datasets/OpenAssistant/oasst1) and [`databricks-dolly-15k`](https://huggingface.co/datasets/databricks/databricks-dolly-15k) datasets.
70
+ - **Language(s) (NLP):** English
71
+ - **License:** BigCode Open RAIL-M v1
72
+ - **Finetuned from model:** [bigcode/starcoderbase](https://huggingface.co/bigcode/starcoderbase)
73
+
74
+ ### Model Sources [optional]
75
+
76
+ <!-- Provide the basic links for the model. -->
77
+
78
+ - **Repository:** https://github.com/bigcode-project/starcoder
79
+ - **Demo:** https://huggingface.co/spaces/HuggingFaceH4/starchat-playground
80
+
81
+ ## Uses
82
+
83
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
84
+
85
+ StarChat Alpha is intended for educational and/or research purposes and in that respect can be used to probe the programming capabilities of open-source language models.
86
+
87
+ ## Bias, Risks, and Limitations
88
+
89
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
90
+
91
+ StarChat Alpha 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).
92
+ 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.
93
+
94
+
95
+ Since the base model was pretrained on a large corpus of code, it may produce code snippets that are syntactically valid but semantically incorrect.
96
+ For example, it may produce code that does not compile or that produces incorrect results.
97
+ It may also produce code that is vulnerable to security exploits.
98
+ We have observed the model also has a tendency to produce false URLs which should be carefully inspected before clicking.
99
+
100
+ StarChat Alpha was fine-tuned from the base model [StarCoder Base](https://huggingface.co/bigcode/starcoderbase), please refer to its model card's [Limitations Section](https://huggingface.co/bigcode/starcoderbase#limitations) for relevant information.
101
+ 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).
102
+
103
+ ## How to Get Started with the Model
104
+
105
+ Use the code below to get started with the model.
106
+
107
+ ```python
108
+ from transformers import pipeline
109
+
110
+ pipe = pipeline("text-generation", model="HuggingFaceH4/starchat-alpha")
111
+ # Inputs use chat tokens
112
+ inputs = "<|system|>\n<|end|>\n<|user|>How can I sort a list in Python?<|end|>\n<|assistant|>"
113
+ outputs = pipe(inputs)
114
+ ```
115
+
116
+
117
+
118
+ ## Citation [optional]
119
+
120
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
121
+
122
+ **BibTeX:**
123
+
124
+ ```
125
+ @article{Tunstall2023starchat-alpha,
126
+ 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},
127
+ title = {Creating a Coding Assistant with StarCoder},
128
+ journal = {Hugging Face Blog},
129
+ year = {2023},
130
+ note = {https://huggingface.co/blog/starchat},
131
+ }
132
+ ```
TRAINER_README.md ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - generated_from_trainer
4
+ model-index:
5
+ - name: starcoder-ift
6
+ results: []
7
+ ---
8
+
9
+ <!-- This model card has been generated automatically according to the information the Trainer had access to. You
10
+ should probably proofread and complete it, then remove this comment. -->
11
+
12
+ # starcoder-ift
13
+
14
+ This model is a fine-tuned version of [bigcode/large-model](https://huggingface.co/bigcode/large-model) on the None dataset.
15
+ It achieves the following results on the evaluation set:
16
+ - Loss: 1.4943
17
+
18
+ ## Model description
19
+
20
+ More information needed
21
+
22
+ ## Intended uses & limitations
23
+
24
+ More information needed
25
+
26
+ ## Training and evaluation data
27
+
28
+ More information needed
29
+
30
+ ## Training procedure
31
+
32
+ ### Training hyperparameters
33
+
34
+ The following hyperparameters were used during training:
35
+ - learning_rate: 2e-05
36
+ - train_batch_size: 2
37
+ - eval_batch_size: 2
38
+ - seed: 42
39
+ - distributed_type: multi-GPU
40
+ - num_devices: 8
41
+ - gradient_accumulation_steps: 8
42
+ - total_train_batch_size: 128
43
+ - total_eval_batch_size: 16
44
+ - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
45
+ - lr_scheduler_type: cosine
46
+ - lr_scheduler_warmup_ratio: 0.03
47
+ - num_epochs: 3
48
+
49
+ ### Training results
50
+
51
+ | Training Loss | Epoch | Step | Validation Loss |
52
+ |:-------------:|:-----:|:----:|:---------------:|
53
+ | 1.6668 | 0.99 | 65 | 1.6167 |
54
+ | 1.3584 | 2.0 | 131 | 1.5126 |
55
+ | 1.0949 | 2.98 | 195 | 1.4943 |
56
+
57
+
58
+ ### Framework versions
59
+
60
+ - Transformers 4.28.1
61
+ - Pytorch 1.13.1+cu117
62
+ - Datasets 2.12.0
63
+ - Tokenizers 0.13.3
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": 2.98,
3
+ "eval_loss": 1.4942539930343628,
4
+ "eval_runtime": 22.3723,
5
+ "eval_samples": 879,
6
+ "eval_samples_per_second": 39.29,
7
+ "eval_steps_per_second": 2.458,
8
+ "perplexity": 4.456011097278015,
9
+ "train_loss": 1.4244933299529248,
10
+ "train_runtime": 3089.4842,
11
+ "train_samples": 8372,
12
+ "train_samples_per_second": 8.13,
13
+ "train_steps_per_second": 0.063
14
+ }
config.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|endoftext|>",
3
+ "eos_token": "<|endoftext|>",
4
+ "unk_token": "<|endoftext|>"
5
+ }
dialogue_template.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "system": "",
3
+ "messages": null,
4
+ "system_token": "<|system|>",
5
+ "user_token": "<|user|>",
6
+ "assistant_token": "<|assistant|>",
7
+ "end_token": "<|end|>"
8
+ }
eval_results.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "epoch": 2.98,
3
+ "eval_loss": 1.4942539930343628,
4
+ "eval_runtime": 22.3723,
5
+ "eval_samples": 879,
6
+ "eval_samples_per_second": 39.29,
7
+ "eval_steps_per_second": 2.458,
8
+ "perplexity": 4.456011097278015
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
+ }
handler.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Dict
2
+
3
+ import torch
4
+ from transformers import AutoModelForCausalLM, AutoTokenizer
5
+
6
+ from peft import PeftConfig, PeftModel
7
+
8
+
9
+ class EndpointHandler:
10
+ def __init__(self, path=""):
11
+ # load model and processor from path
12
+ self.tokenizer = AutoTokenizer.from_pretrained(path)
13
+ try:
14
+ config = PeftConfig.from_pretrained(path)
15
+ model = AutoModelForCausalLM.from_pretrained(
16
+ config.base_model_name_or_path,
17
+ return_dict=True,
18
+ load_in_8bit=True,
19
+ device_map="auto",
20
+ torch_dtype=torch.float16,
21
+ )
22
+ model.resize_token_embeddings(len(self.tokenizer))
23
+ model = PeftModel.from_pretrained(model, path)
24
+ except Exception:
25
+ model = AutoModelForCausalLM.from_pretrained(
26
+ path,
27
+ device_map="auto",
28
+ load_in_8bit=True,
29
+ torch_dtype=torch.float16,
30
+ )
31
+ self.model = model
32
+ self.device = "cuda" if torch.cuda.is_available() else "cpu"
33
+
34
+ def __call__(self, data: Dict[str, Any]) -> Dict[str, str]:
35
+ # process input
36
+ inputs = data.pop("inputs", data)
37
+ parameters = data.pop("parameters", None)
38
+
39
+ # preprocess
40
+ inputs = self.tokenizer(inputs, return_tensors="pt").to(self.device)
41
+
42
+ # pass inputs with all kwargs in data
43
+ if parameters is not None:
44
+ outputs = self.model.generate(**inputs, **parameters)
45
+ else:
46
+ outputs = self.model.generate(**inputs)
47
+
48
+ # postprocess the prediction
49
+ prediction = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
50
+
51
+ return [{"generated_text": prediction}]
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:51cb45ed493b6884702ab15c1580a6269dbb57571f9ddf473bbe063ec842c38d
3
+ size 36949920075
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": 2.98,
3
+ "train_loss": 1.4244933299529248,
4
+ "train_runtime": 3089.4842,
5
+ "train_samples": 8372,
6
+ "train_samples_per_second": 8.13,
7
+ "train_steps_per_second": 0.063
8
+ }
trainer_state.json ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 2.9770992366412212,
5
+ "global_step": 195,
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.02,
12
+ "learning_rate": 0.0,
13
+ "loss": 2.2517,
14
+ "step": 1
15
+ },
16
+ {
17
+ "epoch": 0.24,
18
+ "learning_rate": 2e-05,
19
+ "loss": 1.9184,
20
+ "step": 16
21
+ },
22
+ {
23
+ "epoch": 0.49,
24
+ "learning_rate": 2e-05,
25
+ "loss": 1.7725,
26
+ "step": 32
27
+ },
28
+ {
29
+ "epoch": 0.73,
30
+ "learning_rate": 2e-05,
31
+ "loss": 1.7075,
32
+ "step": 48
33
+ },
34
+ {
35
+ "epoch": 0.98,
36
+ "learning_rate": 2e-05,
37
+ "loss": 1.6668,
38
+ "step": 64
39
+ },
40
+ {
41
+ "epoch": 0.99,
42
+ "eval_loss": 1.6166764497756958,
43
+ "eval_runtime": 22.5473,
44
+ "eval_samples_per_second": 38.985,
45
+ "eval_steps_per_second": 2.439,
46
+ "step": 65
47
+ },
48
+ {
49
+ "epoch": 1.22,
50
+ "learning_rate": 2e-05,
51
+ "loss": 1.4567,
52
+ "step": 80
53
+ },
54
+ {
55
+ "epoch": 1.47,
56
+ "learning_rate": 2e-05,
57
+ "loss": 1.4109,
58
+ "step": 96
59
+ },
60
+ {
61
+ "epoch": 1.71,
62
+ "learning_rate": 2e-05,
63
+ "loss": 1.3875,
64
+ "step": 112
65
+ },
66
+ {
67
+ "epoch": 1.95,
68
+ "learning_rate": 2e-05,
69
+ "loss": 1.3584,
70
+ "step": 128
71
+ },
72
+ {
73
+ "epoch": 2.0,
74
+ "eval_loss": 1.512587547302246,
75
+ "eval_runtime": 22.5311,
76
+ "eval_samples_per_second": 39.013,
77
+ "eval_steps_per_second": 2.441,
78
+ "step": 131
79
+ },
80
+ {
81
+ "epoch": 2.2,
82
+ "learning_rate": 2e-05,
83
+ "loss": 1.1651,
84
+ "step": 144
85
+ },
86
+ {
87
+ "epoch": 2.44,
88
+ "learning_rate": 2e-05,
89
+ "loss": 1.1092,
90
+ "step": 160
91
+ },
92
+ {
93
+ "epoch": 2.69,
94
+ "learning_rate": 2e-05,
95
+ "loss": 1.0948,
96
+ "step": 176
97
+ },
98
+ {
99
+ "epoch": 2.93,
100
+ "learning_rate": 2e-05,
101
+ "loss": 1.0949,
102
+ "step": 192
103
+ },
104
+ {
105
+ "epoch": 2.98,
106
+ "eval_loss": 1.4942539930343628,
107
+ "eval_runtime": 22.489,
108
+ "eval_samples_per_second": 39.086,
109
+ "eval_steps_per_second": 2.446,
110
+ "step": 195
111
+ },
112
+ {
113
+ "epoch": 2.98,
114
+ "step": 195,
115
+ "total_flos": 417490551177216.0,
116
+ "train_loss": 1.4244933299529248,
117
+ "train_runtime": 3089.4842,
118
+ "train_samples_per_second": 8.13,
119
+ "train_steps_per_second": 0.063
120
+ }
121
+ ],
122
+ "max_steps": 195,
123
+ "num_train_epochs": 3,
124
+ "total_flos": 417490551177216.0,
125
+ "trial_name": null,
126
+ "trial_params": null
127
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d8f2bb4f7ded48c54feaaf417fab68eb49470cdcc11bde02d559bf5b1e45582
3
+ size 4987
vocabulary.txt ADDED
The diff for this file is too large to render. See raw diff