Elkhayyat17 commited on
Commit
9b1c466
·
verified ·
1 Parent(s): 481dbf8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +298 -1
README.md CHANGED
@@ -6,4 +6,301 @@ datasets:
6
  pipeline_tag: text-generation
7
  tags:
8
  - medical
9
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  pipeline_tag: text-generation
7
  tags:
8
  - medical
9
+ ---
10
+
11
+
12
+
13
+ ---
14
+ language:
15
+ - code
16
+ license: llama2
17
+ tags:
18
+ - llama-2
19
+ model_name: CodeLlama 7B
20
+ base_model: codellama/CodeLlama-7b-hf
21
+ inference: false
22
+ model_creator: Meta
23
+ model_type: llama
24
+ pipeline_tag: text-generation
25
+ prompt_template: '{prompt}
26
+
27
+ '
28
+ quantized_by: Elkhayyat
29
+ ---
30
+
31
+ <!-- header start -->
32
+ <!-- 200823 -->
33
+ <div style="width: auto; margin-left: auto; margin-right: auto">
34
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
35
+ </div>
36
+ <div style="display: flex; justify-content: space-between; width: 100%;">
37
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
38
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
39
+ </div>
40
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
41
+ <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>
42
+ </div>
43
+ </div>
44
+ <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>
45
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
46
+ <!-- header end -->
47
+
48
+ # CodeLlama 7B - GGUF
49
+ - Model creator: [Meta](https://huggingface.co/meta-llama)
50
+ - Original model: [meta](meta-llama/Llama-2-7b-chat-hf)
51
+
52
+ <!-- description start -->
53
+ ## Description
54
+
55
+ This repo contains GGUF format model files for [Elkhayyat17/lora-llama2-Med].
56
+
57
+ <!-- description end -->
58
+ <!-- README_GGUF.md-about-gguf start -->
59
+ ### About GGUF
60
+
61
+ GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp. GGUF offers numerous advantages over GGML, such as better tokenisation, and support for special tokens. It is also supports metadata, and is designed to be extensible.
62
+
63
+ Here is an incomplate list of clients and libraries that are known to support GGUF:
64
+
65
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
66
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
67
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
68
+ * [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration.
69
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with many interesting and unique features, including a full model library for easy model selection.
70
+ * [Faraday.dev](https://faraday.dev/), an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
71
+ * [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
72
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
73
+ * [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
74
+
75
+ <!-- README_GGUF.md-about-gguf end -->
76
+ <!-- repositories-available start -->
77
+ ## Repositories available
78
+
79
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/CodeLlama-7B-AWQ)
80
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/CodeLlama-7B-GPTQ)
81
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/CodeLlama-7B-GGUF)
82
+ * [Meta's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/codellama/CodeLlama-7b-hf)
83
+ <!-- repositories-available end -->
84
+
85
+ <!-- prompt-template start -->
86
+ ## Prompt template: None
87
+
88
+ ```
89
+ {prompt}
90
+
91
+ ```
92
+
93
+ <!-- prompt-template end -->
94
+
95
+
96
+ <!-- compatibility_gguf start -->
97
+ ## Compatibility
98
+
99
+ These quantised GGUFv2 files are compatible with llama.cpp from August 27th onwards, as of commit [d0cee0d36d5be95a0d9088b674dbb27354107221](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221)
100
+
101
+ They are also compatible with many third party UIs and libraries - please see the list at the top of this README.
102
+
103
+ ## Explanation of quantisation methods
104
+ <details>
105
+ <summary>Click to see details</summary>
106
+
107
+ The new methods available are:
108
+ * GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
109
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
110
+
111
+ Refer to the Provided Files table below to see what files use which methods, and how.
112
+ </details>
113
+ <!-- compatibility_gguf end -->
114
+
115
+ <!-- README_GGUF.md-provided-files start -->
116
+ ## Provided files
117
+
118
+
119
+ **Note**: the above RAM figures assume no GPU offloading. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.
120
+
121
+
122
+
123
+ <!-- README_GGUF.md-provided-files end -->
124
+
125
+ <!-- README_GGUF.md-how-to-download start -->
126
+ ## How to download GGUF files
127
+
128
+ **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.
129
+
130
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
131
+ - LM Studio
132
+ - LoLLMS Web UI
133
+ - Faraday.dev
134
+
135
+ ### In `text-generation-webui`
136
+
137
+ Under Download Model, you can enter the model repo: TheBloke/CodeLlama-7B-GGUF and below it, a specific filename to download, such as: codellama-7b.q4_K_M.gguf.
138
+
139
+ Then click Download.
140
+
141
+ ### On the command line, including multiple files at once
142
+
143
+ I recommend using the `huggingface-hub` Python library:
144
+
145
+ ```shell
146
+ pip3 install huggingface-hub>=0.17.1
147
+ ```
148
+
149
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
150
+
151
+ ```shell
152
+ huggingface-cli download TheBloke/CodeLlama-7B-GGUF codellama-7b.q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
153
+ ```
154
+
155
+ <details>
156
+ <summary>More advanced huggingface-cli download usage</summary>
157
+
158
+ You can also download multiple files at once with a pattern:
159
+
160
+ ```shell
161
+ huggingface-cli download TheBloke/CodeLlama-7B-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
162
+ ```
163
+
164
+ 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).
165
+
166
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
167
+
168
+ ```shell
169
+ pip3 install hf_transfer
170
+ ```
171
+
172
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
173
+
174
+ ```shell
175
+ HUGGINGFACE_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/CodeLlama-7B-GGUF codellama-7b.q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
176
+ ```
177
+
178
+ Windows CLI users: Use `set HUGGINGFACE_HUB_ENABLE_HF_TRANSFER=1` before running the download command.
179
+ </details>
180
+ <!-- README_GGUF.md-how-to-download end -->
181
+
182
+ <!-- README_GGUF.md-how-to-run start -->
183
+ ## Example `llama.cpp` command
184
+
185
+ Make sure you are using `llama.cpp` from commit [d0cee0d36d5be95a0d9088b674dbb27354107221](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
186
+
187
+ ```shell
188
+ ./main -ngl 32 -m codellama-7b.q4_K_M.gguf --color -c 4096 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "{prompt}"
189
+ ```
190
+
191
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
192
+
193
+ Change `-c 4096` 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.
194
+
195
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
196
+
197
+ 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)
198
+
199
+ ## How to run in `text-generation-webui`
200
+
201
+ Further instructions here: [text-generation-webui/docs/llama.cpp.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp.md).
202
+
203
+ ## How to run from Python code
204
+
205
+ 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.
206
+
207
+ ### How to load this model from Python using ctransformers
208
+
209
+ #### First install the package
210
+
211
+ ```bash
212
+ # Base ctransformers with no GPU acceleration
213
+ pip install ctransformers>=0.2.24
214
+ # Or with CUDA GPU acceleration
215
+ pip install ctransformers[cuda]>=0.2.24
216
+ # Or with ROCm GPU acceleration
217
+ CT_HIPBLAS=1 pip install ctransformers>=0.2.24 --no-binary ctransformers
218
+ # Or with Metal GPU acceleration for macOS systems
219
+ CT_METAL=1 pip install ctransformers>=0.2.24 --no-binary ctransformers
220
+ ```
221
+
222
+ #### Simple example code to load one of these GGUF models
223
+
224
+ ```python
225
+ from ctransformers import AutoModelForCausalLM
226
+
227
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
228
+ llm = AutoModelForCausalLM.from_pretrained("TheBloke/CodeLlama-7B-GGUF", model_file="codellama-7b.q4_K_M.gguf", model_type="llama", gpu_layers=50)
229
+
230
+ print(llm("AI is going to"))
231
+ ```
232
+
233
+ ## How to use with LangChain
234
+
235
+ Here's guides on using llama-cpp-python or ctransformers with LangChain:
236
+
237
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
238
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
239
+
240
+ <!-- README_GGUF.md-how-to-run end -->
241
+
242
+ <!-- footer start -->
243
+ <!-- 200823 -->
244
+
245
+ ## Model Use
246
+
247
+ To use this model, please make sure to install transformers from `main` until the next version is released:
248
+
249
+ ```bash
250
+ pip install git+https://github.com/huggingface/transformers.git@main accelerate
251
+ ```
252
+
253
+ Model capabilities:
254
+
255
+
256
+ ```python
257
+ from transformers import AutoTokenizer
258
+ import transformers
259
+ import torch
260
+
261
+ model = "codellama/CodeLlama-7b-hf"
262
+
263
+ tokenizer = AutoTokenizer.from_pretrained(model)
264
+ pipeline = transformers.pipeline(
265
+ "text-generation",
266
+ model=model,
267
+ torch_dtype=torch.float16,
268
+ device_map="auto",
269
+ )
270
+
271
+ sequences = pipeline(
272
+ 'import socket\n\ndef ping_exponential_backoff(host: str):',
273
+ do_sample=True,
274
+ top_k=10,
275
+ temperature=0.1,
276
+ top_p=0.95,
277
+ num_return_sequences=1,
278
+ eos_token_id=tokenizer.eos_token_id,
279
+ max_length=200,
280
+ )
281
+ for seq in sequences:
282
+ print(f"Result: {seq['generated_text']}")
283
+ ```
284
+
285
+ ## Model Details
286
+ *Note: Use of this model is governed by the Meta license. Meta developed and publicly released the Code Llama family of large language models (LLMs).
287
+
288
+ **Model Developers** Meta
289
+
290
+ **Variations**
291
+ ## Training Data
292
+
293
+ All experiments reported here and the released models have been trained and fine-tuned using the same data as Llama 2 with different weights (see Section 2 and Table 1 in the [research paper](https://ai.meta.com/research/publications/code-llama-open-foundation-models-for-code/) for details).
294
+
295
+ ## Evaluation Results
296
+
297
+ See evaluations for the main models and detailed ablations in Section 3 and safety evaluations in Section 4 of the research paper.
298
+
299
+
300
+ ## Ethical Considerations and Limitations
301
+
302
+ Code Llama and its variants are a new technology that carries risks with use. Testing conducted to date has been in English, and has not covered, nor could it cover all scenarios. For these reasons, as with all LLMs, Code Llama’s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate or objectionable responses to user prompts. Therefore, before deploying any applications of Code Llama, developers should perform safety testing and tuning tailored to their specific applications of the model.
303
+
304
+ Please see the Responsible Use Guide available available at [https://ai.meta.com/llama/responsible-user-guide](https://ai.meta.com/llama/responsible-user-guide).
305
+
306
+ <!-- original-model-card end -->