Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,13 +9,11 @@ from datasets import load_dataset
|
|
| 9 |
import gradio as gr
|
| 10 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel, Trainer, TrainingArguments
|
| 11 |
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
# Load the model with from_tf=True
|
| 18 |
-
model = GPT2LMHeadModel.from_pretrained(model_name, from_tf=True)
|
| 19 |
|
| 20 |
# Function to clear the cache
|
| 21 |
def clear_cache(model_name):
|
|
|
|
| 9 |
import gradio as gr
|
| 10 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel, Trainer, TrainingArguments
|
| 11 |
|
| 12 |
+
# Load model directly
|
| 13 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 14 |
|
| 15 |
+
tokenizer = AutoTokenizer.from_pretrained("umashankar00/Text_Generation_model")
|
| 16 |
+
model = AutoModelForCausalLM.from_pretrained("umashankar00/Text_Generation_model")
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Function to clear the cache
|
| 19 |
def clear_cache(model_name):
|