llamacoder / ot.py
ndwdgda's picture
Update ot.py
8cff70f verified
raw
history blame contribute delete
No virus
546 Bytes
!pip install transformers accelerate
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
model = AutoModelForSeq2SeqLM.from_pretrained("LoneStriker/CodeLlama-70b-Instruct-hf-5.0bpw-h6-exl2")
tokenizer = AutoTokenizer.from_pretrained("LoneStriker/CodeLlama-70b-Instruct-hf-5.0bpw-h6-exl2")
input_text = "Write me a short poem about the beauty of the night sky."
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=50)
generated_text = tokenizer.decode(outputs[0][:50])
print(generated_text)