sharpenb commited on
Commit
d32c2e5
·
verified ·
1 Parent(s): 4a7b968

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +222 -0
README.md ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ thumbnail: "https://assets-global.website-files.com/646b351987a8d8ce158d1940/64ec9e96b4334c0e1ac41504_Logo%20with%20white%20text.svg"
3
+ base_model: deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B
4
+ metrics:
5
+ - memory_disk
6
+ - memory_inference
7
+ - inference_latency
8
+ - inference_throughput
9
+ - inference_CO2_emissions
10
+ - inference_energy_consumption
11
+ tags:
12
+ - pruna-ai
13
+ ---
14
+ <!-- header start -->
15
+ <!-- 200823 -->
16
+ <div style="width: auto; margin-left: auto; margin-right: auto">
17
+ <a href="https://www.pruna.ai/" target="_blank" rel="noopener noreferrer">
18
+ <img src="https://i.imgur.com/eDAlcgk.png" alt="PrunaAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
19
+ </a>
20
+ </div>
21
+ <!-- header end -->
22
+
23
+ [![Twitter](https://img.shields.io/twitter/follow/PrunaAI?style=social)](https://twitter.com/PrunaAI)
24
+ [![GitHub](https://img.shields.io/github/followers/PrunaAI?label=Follow%20%40PrunaAI&style=social)](https://github.com/PrunaAI)
25
+ [![LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue)](https://www.linkedin.com/company/93832878/admin/feed/posts/?feedType=following)
26
+ [![Discord](https://img.shields.io/badge/Discord-Join%20Us-blue?style=social&logo=discord)](https://discord.com/invite/vb6SmA3hxu)
27
+
28
+ ## This repo contains GGUF versions of the deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B model.
29
+
30
+ # Simply make AI models cheaper, smaller, faster, and greener!
31
+
32
+ - Give a thumbs up if you like this model!
33
+ - Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
34
+ - Request access to easily compress your *own* AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
35
+ - Read the documentations to know more [here](https://pruna-ai-pruna.readthedocs-hosted.com/en/latest/)
36
+ - Join Pruna AI community on Discord [here](https://discord.gg/rskEr4BZJx) to share feedback/suggestions or get help.
37
+
38
+ **Frequently Asked Questions**
39
+ - ***How does the compression work?*** The model is compressed with GGUF.
40
+ - ***How does the model quality change?*** The quality of the model output might vary compared to the base model.
41
+ - ***What is the model format?*** We use GGUF format.
42
+ - ***What calibration data has been used?*** If needed by the compression method, we used WikiText as the calibration data.
43
+ - ***How to compress my own models?*** You can request premium access to more compression methods and tech support for your specific use-cases [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).
44
+
45
+ # Downloading and running the models
46
+
47
+ You can download the individual files from the Files & versions section. Here is a list of the different versions we provide. For more info checkout [this chart](https://gist.github.com/Artefact2/b5f810600771265fc1e39442288e8ec9) and [this guide](https://www.reddit.com/r/LocalLLaMA/comments/1ba55rj/overview_of_gguf_quantization_methods/):
48
+
49
+ | Quant type | Description |
50
+ |------------|--------------------------------------------------------------------------------------------|
51
+ | Q5_K_M | High quality, recommended. |
52
+ | Q5_K_S | High quality, recommended. |
53
+ | Q4_K_M | Good quality, uses about 4.83 bits per weight, recommended. |
54
+ | Q4_K_S | Slightly lower quality with more space savings, recommended. |
55
+ | IQ4_NL | Decent quality, slightly smaller than Q4_K_S with similar performance, recommended. |
56
+ | IQ4_XS | Decent quality, smaller than Q4_K_S with similar performance, recommended. |
57
+ | Q3_K_L | Lower quality but usable, good for low RAM availability. |
58
+ | Q3_K_M | Even lower quality. |
59
+ | IQ3_M | Medium-low quality, new method with decent performance comparable to Q3_K_M. |
60
+ | IQ3_S | Lower quality, new method with decent performance, recommended over Q3_K_S quant, same size with better performance. |
61
+ | Q3_K_S | Low quality, not recommended. |
62
+ | IQ3_XS | Lower quality, new method with decent performance, slightly better than Q3_K_S. |
63
+ | Q2_K | Very low quality but surprisingly usable. |
64
+
65
+
66
+ ## How to download GGUF files ?
67
+
68
+ **Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single file.
69
+
70
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
71
+
72
+ * LM Studio
73
+ * LoLLMS Web UI
74
+ * Faraday.dev
75
+
76
+ - **Option A** - Downloading in `text-generation-webui`:
77
+ - **Step 1**: Under Download Model, you can enter the model repo: deepseek-ai-DeepSeek-R1-Distill-Qwen-1.5B-GGUF-smashed and below it, a specific filename to download, such as: phi-2.IQ3_M.gguf.
78
+ - **Step 2**: Then click Download.
79
+
80
+ - **Option B** - Downloading on the command line (including multiple files at once):
81
+ - **Step 1**: We recommend using the `huggingface-hub` Python library:
82
+ ```shell
83
+ pip3 install huggingface-hub
84
+ ```
85
+ - **Step 2**: Then you can download any individual model file to the current directory, at high speed, with a command like this:
86
+ ```shell
87
+ huggingface-cli download deepseek-ai-DeepSeek-R1-Distill-Qwen-1.5B-GGUF-smashed DeepSeek-R1-Distill-Qwen-1.5B.IQ3_M.gguf --local-dir . --local-dir-use-symlinks False
88
+ ```
89
+ <details>
90
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
91
+ Alternatively, you can also download multiple files at once with a pattern:
92
+
93
+ ```shell
94
+ huggingface-cli download deepseek-ai-DeepSeek-R1-Distill-Qwen-1.5B-GGUF-smashed --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
95
+ ```
96
+
97
+ 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).
98
+
99
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
100
+
101
+ ```shell
102
+ pip3 install hf_transfer
103
+ ```
104
+
105
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
106
+
107
+ ```shell
108
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download deepseek-ai-DeepSeek-R1-Distill-Qwen-1.5B-GGUF-smashed DeepSeek-R1-Distill-Qwen-1.5B.IQ3_M.gguf --local-dir . --local-dir-use-symlinks False
109
+ ```
110
+
111
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
112
+ </details>
113
+ <!-- README_GGUF.md-how-to-download end -->
114
+
115
+ <!-- README_GGUF.md-how-to-run start -->
116
+
117
+ ## How to run model in GGUF format?
118
+ - **Option A** - Introductory example with `llama.cpp` command
119
+
120
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
121
+
122
+ ```shell
123
+ ./main -ngl 35 -m DeepSeek-R1-Distill-Qwen-1.5B.IQ3_M.gguf --color -c 32768 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "<s>[INST] {{prompt\}} [/INST]"
124
+ ```
125
+
126
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
127
+
128
+ Change `-c 32768` to the desired sequence length. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically. Note that longer sequence lengths require much more resources, so you may need to reduce this value.
129
+
130
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
131
+
132
+ For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
133
+
134
+ - **Option B** - Running in `text-generation-webui`
135
+
136
+ Further instructions can be found in the text-generation-webui documentation, here: [text-generation-webui/docs/04 ‐ Model Tab.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/04%20-%20Model%20Tab.md#llamacpp).
137
+
138
+ - **Option C** - Running from Python code
139
+
140
+ You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries. Note that at the time of writing (Nov 27th 2023), ctransformers has not been updated for some time and is not compatible with some recent models. Therefore I recommend you use llama-cpp-python.
141
+
142
+ ### How to load this model in Python code, using llama-cpp-python
143
+
144
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
145
+
146
+ #### First install the package
147
+
148
+ Run one of the following commands, according to your system:
149
+
150
+ ```shell
151
+ # Base ctransformers with no GPU acceleration
152
+ pip install llama-cpp-python
153
+ # With NVidia CUDA acceleration
154
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
155
+ # Or with OpenBLAS acceleration
156
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
157
+ # Or with CLBLast acceleration
158
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
159
+ # Or with AMD ROCm GPU acceleration (Linux only)
160
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
161
+ # Or with Metal GPU acceleration for macOS systems only
162
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
163
+
164
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
165
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
166
+ pip install llama-cpp-python
167
+ ```
168
+
169
+ #### Simple llama-cpp-python example code
170
+
171
+ ```python
172
+ from llama_cpp import Llama
173
+
174
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
175
+ llm = Llama(
176
+ model_path="./DeepSeek-R1-Distill-Qwen-1.5B.IQ3_M.gguf", # Download the model file first
177
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
178
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
179
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
180
+ )
181
+
182
+ # Simple inference example
183
+ output = llm(
184
+ "<s>[INST] {{prompt}} [/INST]", # Prompt
185
+ max_tokens=512, # Generate up to 512 tokens
186
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
187
+ echo=True # Whether to echo the prompt
188
+ )
189
+
190
+ # Chat Completion API
191
+
192
+ llm = Llama(model_path="./DeepSeek-R1-Distill-Qwen-1.5B.IQ3_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
193
+ llm.create_chat_completion(
194
+ messages = [
195
+ {{"role": "system", "content": "You are a story writing assistant."}},
196
+ {{
197
+ "role": "user",
198
+ "content": "Write a story about llamas."
199
+ }}
200
+ ]
201
+ )
202
+ ```
203
+
204
+ - **Option D** - Running with LangChain
205
+
206
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
207
+
208
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
209
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
210
+
211
+ ## Configurations
212
+
213
+ The configuration info are in `smash_config.json`.
214
+
215
+ ## Credits & License
216
+
217
+ The license of the smashed model follows the license of the original model. Please check the license of the original model before using this model which provided the base model. The license of the `pruna-engine` is [here](https://pypi.org/project/pruna-engine/) on Pypi.
218
+
219
+ ## Want to compress other models?
220
+
221
+ - Contact us and tell us which model to compress next [here](https://www.pruna.ai/contact).
222
+ - Request access to easily compress your own AI models [here](https://z0halsaff74.typeform.com/pruna-access?typeform-source=www.pruna.ai).