Teja-Gollapudi
commited on
Commit
·
63a01be
1
Parent(s):
c107535
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc
|
3 |
+
datasets:
|
4 |
+
- VMware/open-instruct-v1.1-oasst-dolly-hhrlhf
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
library_name: transformers
|
8 |
+
pipeline_tag: conversational
|
9 |
+
---
|
10 |
+
|
11 |
+
# VMware/open-llama-0.7T-7B-open-instruct-v1.1
|
12 |
+
|
13 |
+
## License
|
14 |
+
- <b>Commercially Viable </b>
|
15 |
+
- Instruction dataset, [VMware/open-instruct-v1.1-oasst-dolly-hhrlhf](https://huggingface.co/datasets/VMware/open-instruct-v1.1-oasst-dolly-hhrlhf) is under cc-by-sa-3.0
|
16 |
+
- Language Model ([openlm-research/open_llama_7b_700bt_preview](https://huggingface.co/openlm-research/open_llama_7b_700bt_preview)) is under apache-2.0
|
17 |
+
|
18 |
+
|
19 |
+
## Nomenclature
|
20 |
+
|
21 |
+
- Model : Open-llama
|
22 |
+
- Model trained on : 700B or 0.7 T tokens
|
23 |
+
- Model Size: 7B parameters
|
24 |
+
- Dataset: Open-instruct-v1.1 (oasst,dolly, hhrlhf)
|
25 |
+
|
26 |
+
|
27 |
+
## Use in Transformers
|
28 |
+
|
29 |
+
|
30 |
+
```
|
31 |
+
import os
|
32 |
+
import torch
|
33 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
34 |
+
|
35 |
+
model_name = 'VMware/open-llama-0.7T-7B-open-instruct-v1.1'
|
36 |
+
|
37 |
+
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
39 |
+
|
40 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype= torch.float16, device_map = 'sequential')
|
41 |
+
|
42 |
+
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:"
|
43 |
+
|
44 |
+
prompt= 'Explain in simple terms how the attention mechanism of a transformer model works'
|
45 |
+
|
46 |
+
|
47 |
+
inputt = prompt_template.format(instruction= prompt)
|
48 |
+
input_ids = tokenizer(inputt, return_tensors="pt").input_ids.to("cuda")
|
49 |
+
|
50 |
+
output1 = model.generate(input_ids, max_length=512)
|
51 |
+
input_length = input_ids.shape[1]
|
52 |
+
output1 = output1[:, input_length:]
|
53 |
+
output= tokenizer.decode(output1[0])
|
54 |
+
|
55 |
+
print(output)
|
56 |
+
|
57 |
+
'''
|
58 |
+
The attention mechanism of a transformer model is designed to help the model understand the relationship between different parts of a sentence.
|
59 |
+
The model uses a weighted attention score to determine how much each input token contributes to the output.
|
60 |
+
The attention score is calculated by looking at the similarity between each input token and the output token,and assigning a weight to each input token based on this similarity.
|
61 |
+
This way, the model can better understand the relationship between different parts of a sentence and generate more accurate predictions.
|
62 |
+
|
63 |
+
'''
|
64 |
+
```
|
65 |
+
|
66 |
+
|
67 |
+
## Evaluation
|
68 |
+
|
69 |
+
<B>TODO</B>
|