sandz7 commited on
Commit
b0831b2
Β·
1 Parent(s): 3385018
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -31,9 +31,16 @@ terminators = [
31
  llama_tokenizer.eos_token_id,
32
  llama_tokenizer.convert_tokens_to_ids("")
33
  ]
34
- # Check if eos_token_id is valid
35
- if llama_tokenizer.eos_token_id is None or llama_tokenizer.eos_token_id == llama_tokenizer.pad_token_id:
36
- raise ValueError("Invalid eos_token_id. Please check your tokenizer configuration.")
 
 
 
 
 
 
 
37
 
38
 
39
  # Place just input pass and return generation output
 
31
  llama_tokenizer.eos_token_id,
32
  llama_tokenizer.convert_tokens_to_ids("")
33
  ]
34
+
35
+ # Get special tokens list from the tokenizer
36
+ special_tokens = llama_tokenizer.special_tokens_map
37
+ eos_token = special_tokens.get("eos_token")
38
+
39
+ # if the tokenizer doesn't find a specific EOS token, use the default one
40
+ if eos_token is None:
41
+ eos_token = llama_tokenizer.eos_token
42
+
43
+ print("EOS Token", eos_token)
44
 
45
 
46
  # Place just input pass and return generation output