Spaces:
No application file
No application file
Update ot.py
Browse files
ot.py
CHANGED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
!pip install transformers accelerate
|
2 |
+
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
3 |
+
|
4 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("LoneStriker/CodeLlama-70b-Instruct-hf-5.0bpw-h6-exl2")
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained("LoneStriker/CodeLlama-70b-Instruct-hf-5.0bpw-h6-exl2")
|
6 |
+
input_text = "Write me a short poem about the beauty of the night sky."
|
7 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
8 |
+
outputs = model.generate(**inputs, max_length=50)
|
9 |
+
generated_text = tokenizer.decode(outputs[0][:50])
|
10 |
+
print(generated_text)
|