tanyuzhou commited on
Commit
f5ef79f
1 Parent(s): a5b82ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -3,7 +3,9 @@ import gradio as gr
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
 
5
  import spaces
6
-
 
 
7
  tokenizer = AutoTokenizer.from_pretrained("Rorical/0-roleplay", trust_remote_code=True)
8
  tokenizer.add_special_tokens({"bos_token": tokenizer.eos_token})
9
  tokenizer.bos_token_id = tokenizer.eos_token_id
 
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
 
5
  import spaces
6
+
7
+ # preload model and tokenizer
8
+ AutoModelForCausalLM.from_pretrained("Rorical/0-roleplay", return_dict=True, trust_remote_code=True)
9
  tokenizer = AutoTokenizer.from_pretrained("Rorical/0-roleplay", trust_remote_code=True)
10
  tokenizer.add_special_tokens({"bos_token": tokenizer.eos_token})
11
  tokenizer.bos_token_id = tokenizer.eos_token_id