kamushekp TheBloke commited on
Commit
065e1ae
0 Parent(s):

Duplicate from TheBloke/deepseek-coder-1.3b-instruct-GPTQ

Browse files

Co-authored-by: Tom Jobbins <[email protected]>

.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar 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
+ *.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
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
File without changes
README.md ADDED
@@ -0,0 +1,430 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: deepseek-ai/deepseek-coder-1.3b-instruct
3
+ inference: false
4
+ license: other
5
+ license_link: LICENSE
6
+ license_name: deepseek
7
+ model_creator: DeepSeek
8
+ model_name: Deepseek Coder 1.3B Instruct
9
+ model_type: deepseek
10
+ prompt_template: 'You are an AI programming assistant, utilizing the Deepseek Coder
11
+ model, developed by Deepseek Company, and you only answer questions related to computer
12
+ science. For politically sensitive questions, security and privacy issues, and other
13
+ non-computer science questions, you will refuse to answer.
14
+
15
+ ### Instruction:
16
+
17
+ {prompt}
18
+
19
+ ### Response:
20
+
21
+ '
22
+ quantized_by: TheBloke
23
+ ---
24
+ <!-- markdownlint-disable MD041 -->
25
+
26
+ <!-- header start -->
27
+ <!-- 200823 -->
28
+ <div style="width: auto; margin-left: auto; margin-right: auto">
29
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
30
+ </div>
31
+ <div style="display: flex; justify-content: space-between; width: 100%;">
32
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
33
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
34
+ </div>
35
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
36
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
37
+ </div>
38
+ </div>
39
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
40
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
41
+ <!-- header end -->
42
+
43
+ # Deepseek Coder 1.3B Instruct - GPTQ
44
+ - Model creator: [DeepSeek](https://huggingface.co/deepseek-ai)
45
+ - Original model: [Deepseek Coder 1.3B Instruct](https://huggingface.co/deepseek-ai/deepseek-coder-1.3b-instruct)
46
+
47
+ <!-- description start -->
48
+ ## Description
49
+
50
+ This repo contains GPTQ model files for [DeepSeek's Deepseek Coder 1.3B Instruct](https://huggingface.co/deepseek-ai/deepseek-coder-1.3b-instruct).
51
+
52
+ Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
53
+
54
+ These files were quantised using hardware kindly provided by [Massed Compute](https://massedcompute.com/).
55
+
56
+ <!-- description end -->
57
+ <!-- repositories-available start -->
58
+ ## Repositories available
59
+
60
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-AWQ)
61
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GPTQ)
62
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GGUF)
63
+ * [DeepSeek's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/deepseek-ai/deepseek-coder-1.3b-instruct)
64
+ <!-- repositories-available end -->
65
+
66
+ <!-- prompt-template start -->
67
+ ## Prompt template: DeepSeek
68
+
69
+ ```
70
+ You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.
71
+ ### Instruction:
72
+ {prompt}
73
+ ### Response:
74
+
75
+ ```
76
+
77
+ <!-- prompt-template end -->
78
+
79
+
80
+
81
+ <!-- README_GPTQ.md-compatible clients start -->
82
+ ## Known compatible clients / servers
83
+
84
+ These GPTQ models are known to work in the following inference servers/webuis.
85
+
86
+ - [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
87
+ - [KoboldAI United](https://github.com/henk717/koboldai)
88
+ - [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui)
89
+ - [Hugging Face Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference)
90
+
91
+ This may not be a complete list; if you know of others, please let me know!
92
+ <!-- README_GPTQ.md-compatible clients end -->
93
+
94
+ <!-- README_GPTQ.md-provided-files start -->
95
+ ## Provided files, and GPTQ parameters
96
+
97
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
98
+
99
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
100
+
101
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
102
+
103
+ <details>
104
+ <summary>Explanation of GPTQ parameters</summary>
105
+
106
+ - Bits: The bit size of the quantised model.
107
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
108
+ - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
109
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
110
+ - GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
111
+ - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
112
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama and Mistral models in 4-bit.
113
+
114
+ </details>
115
+
116
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
117
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
118
+ | [main](https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 8192 | 0.90 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
119
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 8192 | 0.97 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
120
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 8192 | 1.48 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
121
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 8192 | 1.51 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
122
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 8192 | 1.60 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
123
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 8192 | 0.92 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
124
+
125
+ <!-- README_GPTQ.md-provided-files end -->
126
+
127
+ <!-- README_GPTQ.md-download-from-branches start -->
128
+ ## How to download, including from branches
129
+
130
+ ### In text-generation-webui
131
+
132
+ To download from the `main` branch, enter `TheBloke/deepseek-coder-1.3b-instruct-GPTQ` in the "Download model" box.
133
+
134
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/deepseek-coder-1.3b-instruct-GPTQ:gptq-4bit-32g-actorder_True`
135
+
136
+ ### From the command line
137
+
138
+ I recommend using the `huggingface-hub` Python library:
139
+
140
+ ```shell
141
+ pip3 install huggingface-hub
142
+ ```
143
+
144
+ To download the `main` branch to a folder called `deepseek-coder-1.3b-instruct-GPTQ`:
145
+
146
+ ```shell
147
+ mkdir deepseek-coder-1.3b-instruct-GPTQ
148
+ huggingface-cli download TheBloke/deepseek-coder-1.3b-instruct-GPTQ --local-dir deepseek-coder-1.3b-instruct-GPTQ --local-dir-use-symlinks False
149
+ ```
150
+
151
+ To download from a different branch, add the `--revision` parameter:
152
+
153
+ ```shell
154
+ mkdir deepseek-coder-1.3b-instruct-GPTQ
155
+ huggingface-cli download TheBloke/deepseek-coder-1.3b-instruct-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir deepseek-coder-1.3b-instruct-GPTQ --local-dir-use-symlinks False
156
+ ```
157
+
158
+ <details>
159
+ <summary>More advanced huggingface-cli download usage</summary>
160
+
161
+ If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Hugging Face cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
162
+
163
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
164
+
165
+ For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
166
+
167
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
168
+
169
+ ```shell
170
+ pip3 install hf_transfer
171
+ ```
172
+
173
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
174
+
175
+ ```shell
176
+ mkdir deepseek-coder-1.3b-instruct-GPTQ
177
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/deepseek-coder-1.3b-instruct-GPTQ --local-dir deepseek-coder-1.3b-instruct-GPTQ --local-dir-use-symlinks False
178
+ ```
179
+
180
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
181
+ </details>
182
+
183
+ ### With `git` (**not** recommended)
184
+
185
+ To clone a specific branch with `git`, use a command like this:
186
+
187
+ ```shell
188
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/deepseek-coder-1.3b-instruct-GPTQ
189
+ ```
190
+
191
+ Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
192
+
193
+ <!-- README_GPTQ.md-download-from-branches end -->
194
+ <!-- README_GPTQ.md-text-generation-webui start -->
195
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
196
+
197
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
198
+
199
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
200
+
201
+ 1. Click the **Model tab**.
202
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/deepseek-coder-1.3b-instruct-GPTQ`.
203
+
204
+ - To download from a specific branch, enter for example `TheBloke/deepseek-coder-1.3b-instruct-GPTQ:gptq-4bit-32g-actorder_True`
205
+ - see Provided Files above for the list of branches for each option.
206
+
207
+ 3. Click **Download**.
208
+ 4. The model will start downloading. Once it's finished it will say "Done".
209
+ 5. In the top left, click the refresh icon next to **Model**.
210
+ 6. In the **Model** dropdown, choose the model you just downloaded: `deepseek-coder-1.3b-instruct-GPTQ`
211
+ 7. The model will automatically load, and is now ready for use!
212
+ 8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
213
+
214
+ - Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
215
+
216
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
217
+
218
+ <!-- README_GPTQ.md-text-generation-webui end -->
219
+
220
+ <!-- README_GPTQ.md-use-from-tgi start -->
221
+ ## Serving this model from Text Generation Inference (TGI)
222
+
223
+ It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
224
+
225
+ Example Docker parameters:
226
+
227
+ ```shell
228
+ --model-id TheBloke/deepseek-coder-1.3b-instruct-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
229
+ ```
230
+
231
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
232
+
233
+ ```shell
234
+ pip3 install huggingface-hub
235
+ ```
236
+
237
+ ```python
238
+ from huggingface_hub import InferenceClient
239
+
240
+ endpoint_url = "https://your-endpoint-url-here"
241
+
242
+ prompt = "Tell me about AI"
243
+ prompt_template=f'''You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.
244
+ ### Instruction:
245
+ {prompt}
246
+ ### Response:
247
+ '''
248
+
249
+ client = InferenceClient(endpoint_url)
250
+ response = client.text_generation(prompt,
251
+ max_new_tokens=128,
252
+ do_sample=True,
253
+ temperature=0.7,
254
+ top_p=0.95,
255
+ top_k=40,
256
+ repetition_penalty=1.1)
257
+
258
+ print(f"Model output: {response}")
259
+ ```
260
+ <!-- README_GPTQ.md-use-from-tgi end -->
261
+ <!-- README_GPTQ.md-use-from-python start -->
262
+ ## How to use this GPTQ model from Python code
263
+
264
+ ### Install the necessary packages
265
+
266
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
267
+
268
+ ```shell
269
+ pip3 install transformers optimum
270
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
271
+ ```
272
+
273
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
274
+
275
+ ```shell
276
+ pip3 uninstall -y auto-gptq
277
+ git clone https://github.com/PanQiWei/AutoGPTQ
278
+ cd AutoGPTQ
279
+ git checkout v0.4.2
280
+ pip3 install .
281
+ ```
282
+
283
+ ### You can then use the following code
284
+
285
+ ```python
286
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
287
+
288
+ model_name_or_path = "TheBloke/deepseek-coder-1.3b-instruct-GPTQ"
289
+ # To use a different branch, change revision
290
+ # For example: revision="gptq-4bit-32g-actorder_True"
291
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
292
+ device_map="auto",
293
+ trust_remote_code=False,
294
+ revision="main")
295
+
296
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
297
+
298
+ prompt = "Tell me about AI"
299
+ prompt_template=f'''You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.
300
+ ### Instruction:
301
+ {prompt}
302
+ ### Response:
303
+ '''
304
+
305
+ print("\n\n*** Generate:")
306
+
307
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
308
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
309
+ print(tokenizer.decode(output[0]))
310
+
311
+ # Inference can also be done using transformers' pipeline
312
+
313
+ print("*** Pipeline:")
314
+ pipe = pipeline(
315
+ "text-generation",
316
+ model=model,
317
+ tokenizer=tokenizer,
318
+ max_new_tokens=512,
319
+ do_sample=True,
320
+ temperature=0.7,
321
+ top_p=0.95,
322
+ top_k=40,
323
+ repetition_penalty=1.1
324
+ )
325
+
326
+ print(pipe(prompt_template)[0]['generated_text'])
327
+ ```
328
+ <!-- README_GPTQ.md-use-from-python end -->
329
+
330
+ <!-- README_GPTQ.md-compatibility start -->
331
+ ## Compatibility
332
+
333
+ The files provided are tested to work with Transformers. For non-Mistral models, AutoGPTQ can also be used directly.
334
+
335
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
336
+
337
+ For a list of clients/servers, please see "Known compatible clients / servers", above.
338
+ <!-- README_GPTQ.md-compatibility end -->
339
+
340
+ <!-- footer start -->
341
+ <!-- 200823 -->
342
+ ## Discord
343
+
344
+ For further support, and discussions on these models and AI in general, join us at:
345
+
346
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
347
+
348
+ ## Thanks, and how to contribute
349
+
350
+ Thanks to the [chirper.ai](https://chirper.ai) team!
351
+
352
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
353
+
354
+ I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
355
+
356
+ If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
357
+
358
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
359
+
360
+ * Patreon: https://patreon.com/TheBlokeAI
361
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
362
+
363
+ **Special thanks to**: Aemon Algiz.
364
+
365
+ **Patreon special mentions**: Brandon Frisco, LangChain4j, Spiking Neurons AB, transmissions 11, Joseph William Delisle, Nitin Borwankar, Willem Michiel, Michael Dempsey, vamX, Jeffrey Morgan, zynix, jjj, Omer Bin Jawed, Sean Connelly, jinyuan sun, Jeromy Smith, Shadi, Pawan Osman, Chadd, Elijah Stavena, Illia Dulskyi, Sebastain Graf, Stephen Murray, terasurfer, Edmond Seymore, Celu Ramasamy, Mandus, Alex, biorpg, Ajan Kanaga, Clay Pascal, Raven Klaugh, 阿明, K, ya boyyy, usrbinkat, Alicia Loh, John Villwock, ReadyPlayerEmma, Chris Smitley, Cap'n Zoog, fincy, GodLy, S_X, sidney chen, Cory Kujawski, OG, Mano Prime, AzureBlack, Pieter, Kalila, Spencer Kim, Tom X Nguyen, Stanislav Ovsiannikov, Michael Levine, Andrey, Trailburnt, Vadim, Enrico Ros, Talal Aujan, Brandon Phillips, Jack West, Eugene Pentland, Michael Davis, Will Dee, webtim, Jonathan Leane, Alps Aficionado, Rooh Singh, Tiffany J. Kim, theTransient, Luke @flexchar, Elle, Caitlyn Gatomon, Ari Malik, subjectnull, Johann-Peter Hartmann, Trenton Dambrowitz, Imad Khwaja, Asp the Wyvern, Emad Mostaque, Rainer Wilmers, Alexandros Triantafyllidis, Nicholas, Pedro Madruga, SuperWojo, Harry Royden McLaughlin, James Bentley, Olakabola, David Ziegler, Ai Maven, Jeff Scroggin, Nikolai Manek, Deo Leter, Matthew Berman, Fen Risland, Ken Nordquist, Manuel Alberto Morcote, Luke Pendergrass, TL, Fred von Graf, Randy H, Dan Guido, NimbleBox.ai, Vitor Caleffi, Gabriel Tamborski, knownsqashed, Lone Striker, Erik Bjäreholt, John Detwiler, Leonard Tan, Iucharbius
366
+
367
+
368
+ Thank you to all my generous patrons and donaters!
369
+
370
+ And thank you again to a16z for their generous grant.
371
+
372
+ <!-- footer end -->
373
+
374
+ # Original model card: DeepSeek's Deepseek Coder 1.3B Instruct
375
+
376
+
377
+ <p align="center">
378
+ <img width="1000px" alt="DeepSeek Coder" src="https://github.com/deepseek-ai/DeepSeek-Coder/blob/main/pictures/logo.png?raw=true">
379
+ </p>
380
+ <p align="center"><a href="https://www.deepseek.com/">[🏠Homepage]</a> | <a href="https://coder.deepseek.com/">[🤖 Chat with DeepSeek Coder]</a> | <a href="https://discord.gg/Tc7c45Zzu5">[Discord]</a> | <a href="https://github.com/guoday/assert/blob/main/QR.png?raw=true">[Wechat(微信)]</a> </p>
381
+ <hr>
382
+
383
+
384
+
385
+ ### 1. Introduction of Deepseek Coder
386
+
387
+ Deepseek Coder is composed of a series of code language models, each trained from scratch on 2T tokens, with a composition of 87% code and 13% natural language in both English and Chinese. We provide various sizes of the code model, ranging from 1B to 33B versions. Each model is pre-trained on project-level code corpus by employing a window size of 16K and a extra fill-in-the-blank task, to support project-level code completion and infilling. For coding capabilities, Deepseek Coder achieves state-of-the-art performance among open-source code models on multiple programming languages and various benchmarks.
388
+
389
+ - **Massive Training Data**: Trained from scratch on 2T tokens, including 87% code and 13% linguistic data in both English and Chinese languages.
390
+
391
+ - **Highly Flexible & Scalable**: Offered in model sizes of 1.3B, 5.7B, 6.7B, and 33B, enabling users to choose the setup most suitable for their requirements.
392
+
393
+ - **Superior Model Performance**: State-of-the-art performance among publicly available code models on HumanEval, MultiPL-E, MBPP, DS-1000, and APPS benchmarks.
394
+
395
+ - **Advanced Code Completion Capabilities**: A window size of 16K and a fill-in-the-blank task, supporting project-level code completion and infilling tasks.
396
+
397
+
398
+
399
+ ### 2. Model Summary
400
+ deepseek-coder-1.3b-instruct is a 1.3B parameter model initialized from deepseek-coder-1.3b-base and fine-tuned on 2B tokens of instruction data.
401
+ - **Home Page:** [DeepSeek](https://deepseek.com/)
402
+ - **Repository:** [deepseek-ai/deepseek-coder](https://github.com/deepseek-ai/deepseek-coder)
403
+ - **Chat With DeepSeek Coder:** [DeepSeek-Coder](https://coder.deepseek.com/)
404
+
405
+
406
+ ### 3. How to Use
407
+ Here give some examples of how to use our model.
408
+ #### Chat Model Inference
409
+ ```python
410
+ from transformers import AutoTokenizer, AutoModelForCausalLM
411
+ tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/deepseek-coder-1.3b-instruct", trust_remote_code=True)
412
+ model = AutoModelForCausalLM.from_pretrained("deepseek-ai/deepseek-coder-1.3b-instruct", trust_remote_code=True).cuda()
413
+ messages=[
414
+ { 'role': 'user', 'content': "write a quick sort algorithm in python."}
415
+ ]
416
+ inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
417
+ # 32021 is the id of <|EOT|> token
418
+ outputs = model.generate(inputs, max_new_tokens=512, do_sample=False, top_k=50, top_p=0.95, num_return_sequences=1, eos_token_id=32021)
419
+ print(tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True))
420
+ ```
421
+
422
+ ### 4. License
423
+ This code repository is licensed under the MIT License. The use of DeepSeek Coder models is subject to the Model License. DeepSeek Coder supports commercial use.
424
+
425
+ See the [LICENSE-MODEL](https://github.com/deepseek-ai/deepseek-coder/blob/main/LICENSE-MODEL) for more details.
426
+
427
+ ### 5. Contact
428
+
429
+ If you have any questions, please raise an issue or contact us at [[email protected]](mailto:[email protected]).
430
+
config.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "/workspace/process/deepseek-ai_deepseek-coder-1.3b-instruct/source",
3
+ "architectures": [
4
+ "LlamaForCausalLM"
5
+ ],
6
+ "attention_bias": false,
7
+ "bos_token_id": 32013,
8
+ "eos_token_id": 32021,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 2048,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 5504,
13
+ "max_position_embeddings": 16384,
14
+ "model_type": "llama",
15
+ "num_attention_heads": 16,
16
+ "num_hidden_layers": 24,
17
+ "num_key_value_heads": 16,
18
+ "pad_token_id": 0,
19
+ "pretraining_tp": 1,
20
+ "rms_norm_eps": 1e-06,
21
+ "rope_scaling": {
22
+ "factor": 4.0,
23
+ "type": "linear"
24
+ },
25
+ "rope_theta": 100000,
26
+ "tie_word_embeddings": false,
27
+ "torch_dtype": "bfloat16",
28
+ "transformers_version": "4.35.0",
29
+ "use_cache": true,
30
+ "vocab_size": 32256,
31
+ "quantization_config": {
32
+ "bits": 4,
33
+ "group_size": 128,
34
+ "damp_percent": 0.1,
35
+ "desc_act": true,
36
+ "sym": true,
37
+ "true_sequential": true,
38
+ "model_name_or_path": null,
39
+ "model_file_base_name": "model",
40
+ "quant_method": "gptq"
41
+ }
42
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 32013,
4
+ "eos_token_id": 32014,
5
+ "transformers_version": "4.34.1"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45f59e7b8075306628e4c834692cf0ffd864a6a71023eeb2bb299b28cf21773f
3
+ size 898108792
quantize_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bits": 4,
3
+ "group_size": 128,
4
+ "damp_percent": 0.1,
5
+ "desc_act": true,
6
+ "sym": true,
7
+ "true_sequential": true,
8
+ "model_name_or_path": null,
9
+ "model_file_base_name": "model"
10
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": true,
3
+ "add_eos_token": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<|begin▁of▁sentence|>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "clean_up_tokenization_spaces": false,
13
+ "eos_token": {
14
+ "__type": "AddedToken",
15
+ "content": "<|EOT|>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "legacy": true,
22
+ "model_max_length": 16384,
23
+ "pad_token": {
24
+ "__type": "AddedToken",
25
+ "content": "<|end▁of▁sentence|>",
26
+ "lstrip": false,
27
+ "normalized": true,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ },
31
+ "sp_model_kwargs": {},
32
+ "unk_token": null,
33
+ "tokenizer_class": "LlamaTokenizerFast",
34
+ "chat_template": "{%- set found_item = false -%}\n{%- for message in messages -%}\n {%- if message['role'] == 'system' -%}\n {%- set found_item = true -%}\n {%- endif -%}\n{%- endfor -%}\n{%- if not found_item -%}\n{{'You are an AI programming assistant, utilizing the Deepseek Coder model, developed by Deepseek Company, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer.\\n'}}\n{%- endif %}\n{%- for message in messages %}\n {%- if message['role'] == 'system' %}\n{{ message['content'] }}\n {%- else %}\n {%- if message['role'] == 'user' %}\n{{'### Instruction:\\n' + message['content'] + '\\n'}}\n {%- else %}\n{{'### Response:\\n' + message['content'] + '\\n<|EOT|>\\n'}}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{{'### Response:\\n'}}\n"
35
+ }