vladyur commited on
Commit
eae046f
1 Parent(s): d2f24d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -4,7 +4,7 @@ import tokenizers
4
  import streamlit as st
5
 
6
 
7
- @st.cache(hash_funcs={tokenizers.Tokenizer: lambda _: None, tokenizers.AddedToken: lambda _: None}, suppress_st_warning=True)
8
  def get_model(model_name, model_path):
9
  tokenizer = transformers.GPT2Tokenizer.from_pretrained(model_name)
10
  model = transformers.GPT2LMHeadModel.from_pretrained(model_name)
@@ -13,7 +13,7 @@ def get_model(model_name, model_path):
13
  return model, tokenizer
14
 
15
 
16
- @st.cache(hash_funcs={tokenizers.Tokenizer: lambda _: None, tokenizers.AddedToken: lambda _: None}, suppress_st_warning=True)
17
  def predict(text, model, tokenizer, n_beams=5, temperature=2.5, top_p=0.8, max_length=300):
18
  input_ids = tokenizer.encode(text, return_tensors="pt")
19
  with torch.no_grad():
 
4
  import streamlit as st
5
 
6
 
7
+ @st.cache(hash_funcs={tokenizers.Tokenizer: lambda _: None, tokenizers.AddedToken: lambda _: None, _regex.Pattern: lambda _: None}, suppress_st_warning=True)
8
  def get_model(model_name, model_path):
9
  tokenizer = transformers.GPT2Tokenizer.from_pretrained(model_name)
10
  model = transformers.GPT2LMHeadModel.from_pretrained(model_name)
 
13
  return model, tokenizer
14
 
15
 
16
+ @st.cache(hash_funcs={tokenizers.Tokenizer: lambda _: None, tokenizers.AddedToken: lambda _: None, _regex.Pattern: lambda _: None}, suppress_st_warning=True)
17
  def predict(text, model, tokenizer, n_beams=5, temperature=2.5, top_p=0.8, max_length=300):
18
  input_ids = tokenizer.encode(text, return_tensors="pt")
19
  with torch.no_grad():