dnnsdunca commited on
Commit
729777e
1 Parent(s): 4c6ae21

Create model.py

Browse files
Files changed (1) hide show
  1. model.py +10 -0
model.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a pipeline as a high-level helper
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("text-generation", model="openai-community/gpt2")
5
+
6
+ # Load model directly
7
+ from transformers import AutoTokenizer, AutoModelForCausalLM
8
+
9
+ tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2")
10
+ model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")