tanzuhuggingface commited on
Commit
c45182b
1 Parent(s): d9b7ac6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +201 -27
README.md CHANGED
@@ -1,37 +1,211 @@
1
  ---
2
- language:
3
- - en
4
- thumbnail: "https://blogs.vmware.com/cloudprovider/files/2021/09/logo-vmware-tanzu-square-Header.png"
5
- tags:
6
- - onprem
7
- - llm
8
- - ai
9
- - ml
10
- - llmops
11
- - postgresml
12
- - pgvector
13
- - vmware
14
- - tanzu
15
- datasets:
16
- - dataset1
17
- - dataset2
18
- metrics:
19
- - metric1
20
- - metric2
21
  ---
22
 
23
- # Model Card for dev
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- This is a sample Tanzu model which was generated for demonstration purposes.
26
 
27
- ## Model Details
28
 
29
- **Model Description:**
 
 
 
 
 
30
 
31
- - **Developed by:** : tanzuhuggingface
32
 
33
- - **Model type** : Open Generative QA
 
 
34
 
35
- - **Language(s) (NLP)** : English
36
 
37
- - **Finetuned from model** : distilbert-base-cased-distilled-squad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ inference: false
3
+ license: other
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
+ <!-- header start -->
7
+ <div style="width: 100%;">
8
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
9
+ </div>
10
+ <div style="display: flex; justify-content: space-between; width: 100%;">
11
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
12
+ <p><a href="https://discord.gg/Jq4vkcDakD">Chat & support: my new Discord server</a></p>
13
+ </div>
14
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
15
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
16
+ </div>
17
+ </div>
18
+ <!-- header end -->
19
 
20
+ # VMWare's open-llama-7B-open-instruct GGML
21
 
22
+ These files are GGML format model files for [VMWare's open-llama-7B-open-instruct](https://huggingface.co/VMware/open-llama-7b-open-instruct).
23
 
24
+ GGML files are for CPU + GPU inference using [llama.cpp](https://github.com/ggerganov/llama.cpp) and libraries and UIs which support this format, such as:
25
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
26
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp)
27
+ * [ParisNeo/GPT4All-UI](https://github.com/ParisNeo/gpt4all-ui)
28
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python)
29
+ * [ctransformers](https://github.com/marella/ctransformers)
30
 
31
+ ## Repositories available
32
 
33
+ * [4-bit GPTQ models for GPU inference](https://huggingface.co/TheBloke/open-llama-7b-open-instruct-GPTQ)
34
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/open-llama-7b-open-instruct-GGML)
35
+ * [Unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/VMware/open-llama-7b-open-instruct)
36
 
37
+ ## Prompt template
38
 
39
+ Standard Alpaca:
40
+
41
+ ```
42
+ Below is an instruction that describes a task. Write a response that appropriately completes the request
43
+
44
+ ### Instruction: prompt
45
+ ### Response:
46
+ ```
47
+
48
+ <!-- compatibility_ggml start -->
49
+ ## Compatibility
50
+
51
+ ### Original llama.cpp quant methods: `q4_0, q4_1, q5_0, q5_1, q8_0`
52
+
53
+ I have quantized these 'original' quantisation methods using an older version of llama.cpp so that they remain compatible with llama.cpp as of May 19th, commit `2d5db48`.
54
+
55
+ They should be compatible with all current UIs and libraries that use llama.cpp, such as those listed at the top of this README.
56
+
57
+ ### New k-quant methods: `q2_K, q3_K_S, q3_K_M, q3_K_L, q4_K_S, q4_K_M, q5_K_S, q6_K`
58
+
59
+ These new quantisation methods are only compatible with llama.cpp as of June 6th, commit `2d43387`.
60
+
61
+ They will NOT be compatible with koboldcpp, text-generation-ui, and other UIs and libraries yet. Support is expected to come over the next few days.
62
+
63
+ ## Explanation of the new k-quant methods
64
+
65
+ The new methods available are:
66
+ * GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
67
+ * GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
68
+ * 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.
69
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
70
+ * GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw
71
+ * GGML_TYPE_Q8_K - "type-0" 8-bit quantization. Only used for quantizing intermediate results. The difference to the existing Q8_0 is that the block size is 256. All 2-6 bit dot products are implemented for this quantization type.
72
+
73
+ Refer to the Provided Files table below to see what files use which methods, and how.
74
+ <!-- compatibility_ggml end -->
75
+
76
+ ## Provided files
77
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
78
+ | ---- | ---- | ---- | ---- | ---- | ----- |
79
+ | open-llama-7B-open-instruct.ggmlv3.q2_K.bin | q2_K | 2 | 2.80 GB | 5.30 GB | New k-quant method. Uses GGML_TYPE_Q4_K for the attention.vw and feed_forward.w2 tensors, GGML_TYPE_Q2_K for the other tensors. |
80
+ | open-llama-7B-open-instruct.ggmlv3.q3_K_L.bin | q3_K_L | 3 | 3.55 GB | 6.05 GB | New k-quant method. Uses GGML_TYPE_Q5_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else GGML_TYPE_Q3_K |
81
+ | open-llama-7B-open-instruct.ggmlv3.q3_K_M.bin | q3_K_M | 3 | 3.23 GB | 5.73 GB | New k-quant method. Uses GGML_TYPE_Q4_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else GGML_TYPE_Q3_K |
82
+ | open-llama-7B-open-instruct.ggmlv3.q3_K_S.bin | q3_K_S | 3 | 2.90 GB | 5.40 GB | New k-quant method. Uses GGML_TYPE_Q3_K for all tensors |
83
+ | open-llama-7B-open-instruct.ggmlv3.q4_0.bin | q4_0 | 4 | 3.79 GB | 6.29 GB | Original llama.cpp quant method, 4-bit. |
84
+ | open-llama-7B-open-instruct.ggmlv3.q4_1.bin | q4_1 | 4 | 4.21 GB | 6.71 GB | Original llama.cpp quant method, 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. |
85
+ | open-llama-7B-open-instruct.ggmlv3.q4_K_M.bin | q4_K_M | 4 | 4.05 GB | 6.55 GB | New k-quant method. Uses GGML_TYPE_Q6_K for half of the attention.wv and feed_forward.w2 tensors, else GGML_TYPE_Q4_K |
86
+ | open-llama-7B-open-instruct.ggmlv3.q4_K_S.bin | q4_K_S | 4 | 3.79 GB | 6.29 GB | New k-quant method. Uses GGML_TYPE_Q4_K for all tensors |
87
+ | open-llama-7B-open-instruct.ggmlv3.q5_0.bin | q5_0 | 5 | 4.63 GB | 7.13 GB | Original llama.cpp quant method, 5-bit. Higher accuracy, higher resource usage and slower inference. |
88
+ | open-llama-7B-open-instruct.ggmlv3.q5_1.bin | q5_1 | 5 | 5.06 GB | 7.56 GB | Original llama.cpp quant method, 5-bit. Even higher accuracy, resource usage and slower inference. |
89
+ | open-llama-7B-open-instruct.ggmlv3.q5_K_M.bin | q5_K_M | 5 | 4.77 GB | 7.27 GB | New k-quant method. Uses GGML_TYPE_Q6_K for half of the attention.wv and feed_forward.w2 tensors, else GGML_TYPE_Q5_K |
90
+ | open-llama-7B-open-instruct.ggmlv3.q5_K_S.bin | q5_K_S | 5 | 4.63 GB | 7.13 GB | New k-quant method. Uses GGML_TYPE_Q5_K for all tensors |
91
+ | open-llama-7B-open-instruct.ggmlv3.q6_K.bin | q6_K | 6 | 5.53 GB | 8.03 GB | New k-quant method. Uses GGML_TYPE_Q8_K - 6-bit quantization - for all tensors |
92
+ | open-llama-7B-open-instruct.ggmlv3.q8_0.bin | q8_0 | 8 | 7.16 GB | 9.66 GB | Original llama.cpp quant method, 8-bit. Almost indistinguishable from float16. High resource use and slow. Not recommended for most users. |
93
+
94
+
95
+ **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.
96
+
97
+ ## How to run in `llama.cpp`
98
+
99
+ I use the following command line; adjust for your tastes and needs:
100
+
101
+ ```
102
+ ./main -t 10 -ngl 32 -m open-llama-7B-open-instruct.ggmlv3.q5_0.bin --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "### Instruction: Write a story about llamas\n### Response:"
103
+ ```
104
+ Change `-t 10` to the number of physical CPU cores you have. For example if your system has 8 cores/16 threads, use `-t 8`.
105
+
106
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
107
+
108
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
109
+
110
+ ## How to run in `text-generation-webui`
111
+
112
+ Further instructions here: [text-generation-webui/docs/llama.cpp-models.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp-models.md).
113
+
114
+ <!-- footer start -->
115
+ ## Discord
116
+
117
+ For further support, and discussions on these models and AI in general, join us at:
118
+
119
+ [TheBloke AI's Discord server](https://discord.gg/Jq4vkcDakD)
120
+
121
+ ## Thanks, and how to contribute.
122
+
123
+ Thanks to the [chirper.ai](https://chirper.ai) team!
124
+
125
+ 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.
126
+
127
+ 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.
128
+
129
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
130
+
131
+ * Patreon: https://patreon.com/TheBlokeAI
132
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
133
+
134
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz, Dmitriy Samsonov.
135
+
136
+ **Patreon special mentions**: Oscar Rangel, Eugene Pentland, Talal Aujan, Cory Kujawski, Luke, Asp the Wyvern, Ai Maven, Pyrater, Alps Aficionado, senxiiz, Willem Michiel, Junyu Yang, trip7s trip, Sebastain Graf, Joseph William Delisle, Lone Striker, Jonathan Leane, Johann-Peter Hartmann, David Flickinger, Spiking Neurons AB, Kevin Schuppel, Mano Prime, Dmitriy Samsonov, Sean Connelly, Nathan LeClaire, Alain Rossmann, Fen Risland, Derek Yates, Luke Pendergrass, Nikolai Manek, Khalefa Al-Ahmad, Artur Olbinski, John Detwiler, Ajan Kanaga, Imad Khwaja, Trenton Dambrowitz, Kalila, vamX, webtim, Illia Dulskyi.
137
+
138
+ Thank you to all my generous patrons and donaters!
139
+
140
+ <!-- footer end -->
141
+
142
+ # Original model card: VMWare's open-llama-7B-open-instruct
143
+
144
+
145
+ # VMware/open-llama-7B-open-instruct
146
+ Instruction-tuned version of the fully trained Open LLama 7B model. The model is open for <b>COMMERCIAL USE</b>. <br>
147
+
148
+ <b> NOTE </b> : The model was trained using the Alpaca prompt template
149
+
150
+ ## License
151
+ - <b>Commercially Viable </b>
152
+ - Instruction dataset, [VMware/open-instruct-v1-oasst-dolly-hhrlhf](https://huggingface.co/datasets/VMware/open-instruct-v1-oasst-dolly-hhrlhf) is under cc-by-sa-3.0
153
+ - Language Model, ([openlm-research/open_llama_7b](https://huggingface.co/openlm-research/open_llama_7b)) is under apache-2.0
154
+
155
+
156
+ ## Nomenclature
157
+
158
+ - Model : Open-llama
159
+ - Model Size: 7B parameters
160
+ - Dataset: Open-instruct-v1 (oasst,dolly, hhrlhf)
161
+
162
+ ## Use in Transformers
163
+
164
+ ```
165
+ import os
166
+ import torch
167
+ from transformers import AutoModelForCausalLM, AutoTokenizer
168
+
169
+ model_name = 'VMware/open-llama-7B-open-instruct'
170
+
171
+
172
+ tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False)
173
+
174
+ model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype= torch.float16, device_map = 'sequential')
175
+
176
+ prompt_template = "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Response:"
177
+
178
+ prompt= 'Explain in simple terms how the attention mechanism of a transformer model works'
179
+
180
+
181
+ inputt = prompt_template.format(instruction= prompt)
182
+ input_ids = tokenizer(inputt, return_tensors="pt").input_ids.to("cuda")
183
+
184
+ output1 = model.generate(input_ids, max_length=512)
185
+ input_length = input_ids.shape[1]
186
+ output1 = output1[:, input_length:]
187
+ output= tokenizer.decode(output1[0])
188
+
189
+ print(output)
190
+
191
+ '''
192
+ Attention is a mechanism used in deep learning models, such as transformer models, to capture global dependencies between different parts of the input. In a transformer model, the attention mechanism works by computing a weighted sum of the input vectors and then applying a non-linear activation function to the result.
193
+
194
+ The attention mechanism in a transformer model works in two steps:
195
+
196
+ 1. Query-Key Mapping: First, the input sequence is divided into two parts: the query vector and the key vector. The query vector represents the input at the current position, and the key vector represents the input at a previous position.
197
+
198
+ 2. Attention Weight Calculation: Second, the attention weights are calculated using the dot product between the query vector and each key vector. The attention weights represent the importance of the input at the previous position to the current position.
199
+
200
+ The attention weights are then used to compute the attention score for each input element. The attention score represents the relevance of the input element to the current position.
201
+
202
+ The attention mechanism in a transformer model is designed to capture global dependencies between different parts of the input. By attending to input elements from different positions, the model can learn to understand the relationships between different parts of the input. This allows the model to perform more complex tasks, such as understanding the relationships between words in a sentence or pixels in an image.</s>
203
+
204
+ '''
205
+ ```
206
+
207
+ ## Finetuning details
208
+ The finetuning scripts will be available in our [RAIL Github Repository](https://github.com/vmware-labs/research-and-development-artificial-intelligence-lab/tree/main/instruction-tuning)
209
+ ## Evaluation
210
+
211
+ <B>TODO</B>