johnrachwanpruna commited on
Commit
0ac735a
1 Parent(s): e7bce2a

Upload folder using huggingface_hub (#3)

Browse files

- ec14bc53690f3291d3f26e54e7f6a986cd2ea2558e6fcaea8c096ea73e8111ae (39fac958b2c9ca92c8be8fb206d2647d31bc5f5b)
- 3bdd7d6d96e1ca6b0eb7942309c13be28e3fdd94d62d9a606912857cdc9f8699 (e5f1816434a8f477ae10469ea62b8a4664acb1ad)
- 4ce169ef1e8816bc28a654dbae6bbf06ff85a5ba96167d7aae7d02760ea78654 (60a7ab0a7650d615485f4e2d998e1685116fca7b)
- 847daaf4a07d1e65d04fcd2cf83167c5e107383b2d5aab815eb068984a711fc6 (2a144bc315e45d60c86f839856ad277eed54bf68)
- 5913a50abeac41303ed55cf9337ddbea8759d5d8c1d370c6a5e52b0b7a622660 (5a98ed957f28cafdba143427c84cef46d465441d)
- 02e328382a1ecc8bc729207e9170213656255864a2e7857f6a7b29987df6ee9e (4c2e957cfbf732bd5faeb22b821b5abd6341912c)
- 59c7fd06bc49d2924c650672cad7f8b775f817e7b41fd73887209ace09adc749 (cadbf1588867ed50eb45a34933a80716b4cfe525)
- 3fb336fb15aa3f774b3ce91bfd633d6b347cb8c25cdd20d71cb890f604a2462d (b27a72c1e01ccb0120088ec33a3eb6a8db88015f)
- deb9980e6f2b6032aa0b35d578acd2011ff69ad32393aa72036f3ee0b1d893c7 (d5b51fa564c01fe78d28e98ee403763fa3028a46)
- 6750b882e8865222d55a89645a93c5a4d2133c020337a05354219d58b8a060d4 (32626ee09d4dcee8f1b7e66b21cc7a8d390c9951)
- 1d5486e8767ed88798a962684e233965587aa798b24b88c83e88b287dddf09fb (442e7c9abd84b49a0810696b823e3c09744fc41f)
- 214ded5aad34698b51129e92aa16a86fc54a70ec64a5f8710ea4ab6730e65cd7 (174ebd3a02a1db98c4957fd7389efc86d81aa220)
- 95882c33a01d650bf7b92f976ae738b259db6fd77a49ca1bc245c045b83f0cb8 (736fc60c358881a0b952952902dd048df693e510)
- 7f326441df8364363eb10e8b53eb961c1a958998fff86e41bd97550925d0f6d7 (a36bbd12e024493e637abe06ebff45010a6a775f)
- e6e59c350402bf5edb612db9801c7149ab2c1f867870538cb7f17681c94c8da1 (3630105e8e9b4ade6739b3117c1bdafe8e8ac341)
- 06ef4bdea480639a5dba5b6d54a29dc0f617ec206ddf17e3bfbe413364cda8b6 (260af959b0f5bf0fd1442bc48d3139b6e7f547f3)
- 7eeeda83547c0cd613429cd1fb317639ecaa9188e031e4989213d04b8c955ef6 (cf8f0b4277023dcf43020f47af7808de26dea585)
- 66cb1eb54163317131f9878693c15089fe6a11f63e174c85bf34a67fc5cdf2a9 (cd547ace751e953707c38c7b12ce31534a9cb024)
- 79b38ae7abf824999151f862cb1b725fcb2384fac8dadca236b52acae543937e (dc3a005e09947f6e2667b29e8630c54cd131ef84)
- 80492429c386502271fb584481a488f5bd54b6bcc5b5cc6f9c0d622387da66f7 (a1af3170ccc1ec8c6a8f708d7238780cf780fbb8)

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