Starchik commited on
Commit
7fb3378
·
verified ·
1 Parent(s): 3987a32

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -0
main.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoModelForCausalLM, AutoTokenizer
2
+
3
+ model_id = "mistralai/Codestral-22B-v0.1"
4
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
5
+
6
+ model = AutoModelForCausalLM.from_pretrained(model_id)
7
+
8
+ text = "Hello my name is"
9
+ inputs = tokenizer(text, return_tensors="pt")
10
+
11
+ outputs = model.generate(**inputs, max_new_tokens=20)
12
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))