Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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'] + '
|
|
|
|
|
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
|