mwitiderrick commited on
Commit
c7e0e6f
1 Parent(s): b3c3a84

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -5
README.md CHANGED
@@ -1,15 +1,22 @@
1
  ```python
 
2
  import torch
3
  from transformers import AutoTokenizer, AutoModelForCausalLM
4
-
5
- model_id = "nm-testing/TinyLlama-1.1B-Chat-v1.0-pruned50-24"
 
6
  model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", torch_dtype=torch.float16)
7
  tokenizer = AutoTokenizer.from_pretrained(model_id)
8
- inputs = tokenizer("Hello my name is", return_tensors="pt")
9
- outputs = model.generate(**inputs, max_new_tokens=20)
10
  print(tokenizer.batch_decode(outputs)[0])
 
11
  """
12
- <s> Hello my name is John. I am a student at the University of the University of the University of the University of the
 
 
 
13
 
 
14
  """
15
  ```
 
1
  ```python
2
+
3
  import torch
4
  from transformers import AutoTokenizer, AutoModelForCausalLM
5
+ prompt = "How to make banana bread?"
6
+ formatted_prompt = f"<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>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> <|im_start|>user
16
+ How to make banana bread?<|im_end|>
17
+ <|im_start|>assistant
18
+ Banana bread is a delicious dessert that is made with bananas. Here is how to make banana bread:
19
 
20
+ 1. Firstly, you need to cut bananas into small pieces.
21
  """
22
  ```