tanyuzhou commited on
Commit
ec687da
1 Parent(s): 46d43fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -5,7 +5,9 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
5
  import spaces
6
 
7
  tokenizer = AutoTokenizer.from_pretrained("Rorical/0-roleplay", trust_remote_code=True)
8
- tokenizer.chat_template = "{% for message in messages %}{{'<|im_start|>' + ((message['role'] + ':\n') if message['role'] != '' else '') + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>星野:\n' }}{% endif %}" # Be careful that this model used custom chat template.
 
 
9
 
10
  # Define the response function
11
  @spaces.GPU
 
5
  import spaces
6
 
7
  tokenizer = AutoTokenizer.from_pretrained("Rorical/0-roleplay", trust_remote_code=True)
8
+ tokenizer.chat_template = "{% for message in messages %}{{'<|im_start|>' + ((message['role'] + '\n') if message['role'] != '' else '') + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}"
9
+ tokenizer.add_special_tokens({"bos_token": tokenizer.eos_token})
10
+ tokenizer.bos_token_id = tokenizer.eos_token_id
11
 
12
  # Define the response function
13
  @spaces.GPU