Create Openai.ai
Browse files
Openai.ai
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
# Load model directly
|
6 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
7 |
+
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2")
|
9 |
+
model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
|