vilarin commited on
Commit
659ca36
1 Parent(s): 1c74333

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
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 = 128039,
 
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,