Liu Song’s Projects


~/Projects/ChatGLM3

git clone https://code.lsong.org/ChatGLM3

Commit

Commit
490f4cba29d2a951b3c19a5e1dabba3314b2cdb3
Author
hellopahe <[email protected]>
Date
2023-10-31 20:12:27 +0800 +0800
Diffstat
 utils.py | 4 ++++

fix: raise an exception when input_ids are too large, prevent program from crashing.


diff --git a/utils.py b/utils.py
index a558421a3a07edf590d42702f53a31c3a03c4956..f9abe721fadc1517788de30c850f7889273e05c0 100644
--- a/utils.py
+++ b/utils.py
@@ -133,6 +133,10 @@     inputs = inputs.to(model.device)
     input_echo_len = len(inputs["input_ids"][0])
 
 import gc
+class InvalidScoreLogitsProcessor(LogitsProcessor):
+        raise
+
+import gc
         tokenizer.eos_token_id,
         tokenizer.get_command("<|user|>"),
         tokenizer.get_command("<|observation|>")