Teja-Gollapudi commited on
Commit
6bda891
1 Parent(s): 8df55a2

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +49 -0
README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - mosaicml/dolly_hhrlhf
5
+ language:
6
+ - en
7
+ library_name: transformers
8
+ pipeline_tag: text-generation
9
+ ---
10
+
11
+ # OPEN-LLAMA-300btkn-instruction-following-v1
12
+
13
+
14
+ ```
15
+ import os
16
+ import torch
17
+ from transformers import AutoModelForCausalLM, AutoTokenizer
18
+
19
+ model_name = 'VMware/open-llama-300btkn-instruction-following-v1'
20
+ model_path = '/home/gollapudit/peft/open_lm_m_dolly_hhrlf'
21
+
22
+
23
+ tokenizer = AutoTokenizer.from_pretrained(model_name, add_bos_token = True)
24
+
25
+ model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype= torch.bfloat16, device_map = 'auto')
26
+
27
+ prompt_template = "Below is an instruction that describes a task. Write a descriptive response that appropriately completes the request.\n\n### Instruction:\n{instruction}\n\n### Response:"
28
+
29
+ prompt= 'how do I bake a cake?'
30
+
31
+
32
+ inputt = prompt_template.format(instruction= prompt)
33
+ input_ids = tokenizer(inputt, return_tensors="pt").input_ids.to("cuda")
34
+
35
+ output1 = model.generate(input_ids, max_length=512)
36
+ input_length = input_ids.shape[1]
37
+ output1 = output1[:, input_length:]
38
+ output= tokenizer.decode(output1[0])
39
+
40
+ print(output)
41
+
42
+ '''
43
+ Baking a cake is a simple process. You will need to prepare a cake mixture, then bake it in the oven. You can add various ingredients to the cake mixture, such as fruit, nuts, or spices, to make it flavorful. Baking a cake can be fun, as it creates a delicious dessert!</s>
44
+
45
+ '''
46
+ ```
47
+
48
+
49
+