Create model.py
Browse files
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")
|