SaborDay commited on
Commit
b24bef1
1 Parent(s): 1bae770

Creating inference script

Browse files
Files changed (1) hide show
  1. inference.py +13 -0
inference.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoTokenizer
2
+ import transformers
3
+ import torch
4
+ from peft import PeftModel, PeftConfig
5
+
6
+ #Load the model weights from hub
7
+ model_id = "SaborDay/Phi2_RCT1M-ft-heading"
8
+ trained_model = PeftModel.from_pretrained(model, model_id)
9
+
10
+ #Run inference
11
+ outputs = trained_model.generate(**inputs, max_length=1000)
12
+ text = tokenizer.batch_decode(outputs,skip_special_tokens=True)[0]
13
+ print(text)