roneneldan commited on
Commit
5e7939b
·
1 Parent(s): 7aded12

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +20 -3
README.md CHANGED
@@ -1,3 +1,20 @@
1
- ---
2
- license: unknown
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Example usage:
2
+
3
+ from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
4
+
5
+ model = AutoModelForCausalLM.from_pretrained('roneneldan/TinyStories-1M')
6
+
7
+ tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neo-125M")
8
+
9
+ prompt = "Once upon a time there was"
10
+
11
+ input_ids = tokenizer.encode(prompt, return_tensors="pt")
12
+
13
+ # Generate completion
14
+ output = model.generate(input_ids, max_length = 1000, num_beams=1)
15
+
16
+ # Decode the completion
17
+ output_text = tokenizer.decode(output[0], skip_special_tokens=True)
18
+
19
+ # Print the generated text
20
+ print(output_text)