Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import GPTNeoForCausalLM, GPT2Tokenizer
|
| 2 |
+
model = GPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-1.3B")
|
| 3 |
+
tokenizer = GPT2Tokenizer.from_pretrained("EleutherAI/gpt-neo-1.3B")
|
| 4 |
+
|
| 5 |
+
prompt = "In a shocking finding, scientists discovered a herd of unicorns living in a remote, " \
|
| 6 |
+
... "previously unexplored valley, in the Andes Mountains. Even more surprising to the " \
|
| 7 |
+
... "researchers was the fact that the unicorns spoke perfect English."
|
| 8 |
+
|
| 9 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
|
| 10 |
+
|
| 11 |
+
gen_tokens = model.generate(input_ids, do_sample=True, temperature=0.9, max_length=100,)
|
| 12 |
+
gen_text = tokenizer.batch_decode(gen_tokens)[0]
|