File size: 455 Bytes
4862099
 
da2de4f
549f49f
da2de4f
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import os
os.system("pip install transformers")
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "ehartford/dolphin-2.2.1-mistral-7b"
tokenizer = AutoTokenizer.from_pretrained(model_id)

model = AutoModelForCausalLM.from_pretrained(model_id)

text = "Hello my name is"
inputs = tokenizer(text, return_tensors="pt")

outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))