parkho87 commited on
Commit
23e4a88
·
verified ·
1 Parent(s): 69f38dc

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +13 -0
main.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a pipeline as a high-level helper
2
+ from transformers import pipeline
3
+
4
+ messages = [
5
+ {"role": "user", "content": "Who are you?"},
6
+ ]
7
+ pipe = pipeline("text-generation", model="microsoft/phi-4", trust_remote_code=True)
8
+ pipe(messages)
9
+ # Load model directly
10
+ from transformers import AutoTokenizer, AutoModelForCausalLM
11
+
12
+ tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-4", trust_remote_code=True)
13
+ model = AutoModelForCausalLM.from_pretrained("microsoft/phi-4", trust_remote_code=True)