Teja-Gollapudi
commited on
Commit
•
38621ba
1
Parent(s):
778d9ed
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc
|
3 |
+
datasets:
|
4 |
+
- VMware/open-instruct-v1-oasst-dolly-hhrlhf
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
library_name: transformers
|
8 |
+
pipeline_tag: text-generation
|
9 |
+
---
|
10 |
+
|
11 |
+
# VMware/open-llama-7B-open-instruct
|
12 |
+
Instruction-tuned version of SalesForce/Xgen-7b-8k-base. The model is open for <b>COMMERCIAL USE</b>. <br>
|
13 |
+
|
14 |
+
We expanded Open-instruct with additional commercially viable zero-shot COT datasets from Flan v2 (~70k). (TODO: List out the datasets) <br>
|
15 |
+
|
16 |
+
The model supports up to <b>8192 tokens </b>
|
17 |
+
|
18 |
+
<b> NOTE </b> : The model was trained using the Alpaca prompt template
|
19 |
+
|
20 |
+
|
21 |
+
## License
|
22 |
+
- <b>Commercially Viable </b>
|
23 |
+
- The instruction datasets used for instruction tuning are open for commercial usage. (TODO LIST OUT THE DATASETS)
|
24 |
+
- Language Model, ([Salesforce/xgen-7b-8k-base](https://huggingface.co/Salesforce/xgen-7b-8k-base)) is under apache-2.0
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
## Use in Transformers
|
29 |
+
|
30 |
+
```
|
31 |
+
import os
|
32 |
+
import torch
|
33 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
34 |
+
|
35 |
+
model_name = 'VMware/xgen-7b-8k-open-instruct'
|
36 |
+
|
37 |
+
|
38 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=False, trust_remote_code = True)
|
39 |
+
|
40 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16, 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=8192)
|
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 |
+
|
59 |
+
## Finetuning details
|
60 |
+
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)
|
61 |
+
## Evaluation
|
62 |
+
|
63 |
+
<B>TODO</B>
|