SAMBOOM commited on
Commit
921e88c
1 Parent(s): 34c9838

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,10 +1,11 @@
 
1
  import streamlit as st
2
- from transformers import AutoTokenizer, AutoModelForCausalLM
3
 
4
  tokenizer = AutoTokenizer.from_pretrained("gpt2-large")
5
  @st.cache_data
6
  def load_model(model_name):
7
- model = AutoModelForCausalLM.from_pretrained(model_name)
8
  return model
9
 
10
  model = load_model("gpt2-large")
@@ -20,6 +21,7 @@ top_p=top_p,
20
  do_sample=True,
21
  num_return_sequences=1
22
  )
 
23
  return output_sequences
24
 
25
  default_value = "You: Ask me anything!"
 
1
+ import transformers
2
  import streamlit as st
3
+ from transformers import AutoTokenizer, AutoModelWithLMHead
4
 
5
  tokenizer = AutoTokenizer.from_pretrained("gpt2-large")
6
  @st.cache_data
7
  def load_model(model_name):
8
+ model = AutoModelWithLMHead.from_pretrained(model_name)
9
  return model
10
 
11
  model = load_model("gpt2-large")
 
21
  do_sample=True,
22
  num_return_sequences=1
23
  )
24
+
25
  return output_sequences
26
 
27
  default_value = "You: Ask me anything!"