mwitiderrick commited on
Commit
63bcbad
1 Parent(s): 967ad23

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +32 -0
README.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```python
2
+
3
+ import torch
4
+ from transformers import AutoTokenizer, AutoModelForCausalLM
5
+ prompt = "How to make banana bread?"
6
+ formatted_prompt = f"<s> [|User|]\n{prompt}</s>[|Assistant|]\n"
7
+ model_id = "/home/mwiti/mwitiderrick/output_oneshot"
8
+ model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.float16)
9
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
10
+ inputs = tokenizer(formatted_prompt, return_tensors="pt")
11
+ outputs = model.generate(**inputs, max_new_tokens=200)
12
+ print(tokenizer.batch_decode(outputs)[0])
13
+
14
+ """
15
+ <s><s> [|User|]
16
+ How to make banana bread?</s>[|Assistant|]
17
+ To make banana bread, follow these steps:
18
+
19
+ 1. Start by preparing the ingredients. You will need banana bread mix, flour, water, and salt.
20
+ 2. Mix the ingredients together and mix the mixture thoroughly.
21
+ 3. Pour the mixture into a pan to cook.
22
+ 4. Cook the mixture until it is cooked.
23
+ 5. Once the bread is cooked, you can use it as a base for making banana bread.
24
+ 6. Add the banana bread mix to the pan and mix it thoroughly.
25
+ 7. Pour the mixture into a pan to cook.
26
+ 8. Cook the mixture until it is cooked.
27
+ 9. Once the bread is cooked, you can use it as a base for making banana bread.
28
+ 10. Add the banana bread mix to the pan and mix it thoroughly.
29
+ 11. Pour the mixture into a pan to cook.
30
+ 12.
31
+ """
32
+ ```