Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -48,6 +48,10 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
48 |
load_in_4bit=True,
|
49 |
use_flash_attention_2=True)
|
50 |
|
|
|
|
|
|
|
|
|
51 |
@spaces.GPU()
|
52 |
def stream_chat(
|
53 |
message: str,
|
@@ -83,7 +87,8 @@ def stream_chat(
|
|
83 |
do_sample = False if temperature == 0 else True,
|
84 |
top_p = top_p,
|
85 |
top_k = top_k,
|
86 |
-
eos_token_id =
|
|
|
87 |
temperature = temperature,
|
88 |
repetition_penalty=penalty,
|
89 |
streamer=streamer,
|
|
|
48 |
load_in_4bit=True,
|
49 |
use_flash_attention_2=True)
|
50 |
|
51 |
+
# Ensure `pad_token_id` is set
|
52 |
+
if tokenizer.pad_token_id is None:
|
53 |
+
tokenizer.pad_token_id = tokenizer.eos_token_id
|
54 |
+
|
55 |
@spaces.GPU()
|
56 |
def stream_chat(
|
57 |
message: str,
|
|
|
87 |
do_sample = False if temperature == 0 else True,
|
88 |
top_p = top_p,
|
89 |
top_k = top_k,
|
90 |
+
eos_token_id = tokenizer.eos_token_id,
|
91 |
+
pad_token_id = tokenizer.pad_token_id,
|
92 |
temperature = temperature,
|
93 |
repetition_penalty=penalty,
|
94 |
streamer=streamer,
|