Spaces:
Runtime error
Runtime error
Momin Aziz
commited on
Commit
•
e2bc1d4
1
Parent(s):
271f6d5
changed view
Browse files- app.py +3 -4
- requirements.txt +1 -1
app.py
CHANGED
@@ -5,13 +5,12 @@ model_name = "gpt2-large"
|
|
5 |
|
6 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
7 |
|
8 |
-
@st.cache
|
9 |
-
def
|
10 |
-
|
11 |
model = AutoModelForCausalLM.from_pretrained(model_name,pad_token_id=tokenizer.eos_token_id)
|
12 |
return model
|
13 |
|
14 |
-
model =
|
15 |
pipeline = pipeline('text-generation', model=model, tokenizer=tokenizer)
|
16 |
print("loaded the model/pipeline")
|
17 |
|
|
|
5 |
|
6 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
7 |
|
8 |
+
@st.cache(allow_output_mutation=True)
|
9 |
+
def load_model(model_name):
|
|
|
10 |
model = AutoModelForCausalLM.from_pretrained(model_name,pad_token_id=tokenizer.eos_token_id)
|
11 |
return model
|
12 |
|
13 |
+
model = load_model(model_name)
|
14 |
pipeline = pipeline('text-generation', model=model, tokenizer=tokenizer)
|
15 |
print("loaded the model/pipeline")
|
16 |
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
transformers>=4.18.0
|
2 |
-
streamlit
|
3 |
torch
|
4 |
sentencepiece
|
|
|
1 |
transformers>=4.18.0
|
2 |
+
streamlit==1.9.0
|
3 |
torch
|
4 |
sentencepiece
|