THUDM / LongWriter

LongWriter: Unleashing 10,000+ Word Generation from Long Context LLMs
Apache License 2.0
1.46k stars 125 forks source link

Error while generating #4

Closed AlNahean closed 2 months ago

AlNahean commented 2 months ago

getting this error after submit Exception in thread Thread-6 (generate): Traceback (most recent call last): File "C:\ProgramData\anaconda3\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "C:\ProgramData\anaconda3\Lib\threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\transformers\generation\utils.py", line 1989, in generate result = self._sample( ^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\transformers\generation\utils.py", line 2932, in _sample outputs = self(**model_inputs, return_dict=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\nahea\.cache\huggingface\modules\transformers_modules\LongWriter-glm4-9b\modeling_chatglm.py", line 801, in forward transformer_outputs = self.transformer( ^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\nahea\.cache\huggingface\modules\transformers_modules\LongWriter-glm4-9b\modeling_chatglm.py", line 707, in forward hidden_states, presents, all_hidden_states, all_self_attentions = self.encoder( ^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\nahea\.cache\huggingface\modules\transformers_modules\LongWriter-glm4-9b\modeling_chatglm.py", line 551, in forward layer_ret = layer( ^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\nahea\.cache\huggingface\modules\transformers_modules\LongWriter-glm4-9b\modeling_chatglm.py", line 454, in forward attention_output, kv_cache = self.self_attention( ^^^^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\nahea\.cache\huggingface\modules\transformers_modules\LongWriter-glm4-9b\modeling_chatglm.py", line 351, in forward context_layer = self.core_attention(query_layer, key_layer, value_layer, attention_mask) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1553, in _wrapped_call_impl return self._call_impl(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\My Files\code Learning\Github Desktop\LongWriter\venv\Lib\site-packages\torch\nn\modules\module.py", line 1562, in _call_impl return forward_call(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\nahea\.cache\huggingface\modules\transformers_modules\LongWriter-glm4-9b\modeling_chatglm.py", line 211, in forward context_layer = flash_attn_unpadded_func( ^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not callable

bys0318 commented 2 months ago

You need to install FlashAttention-2

seetimee commented 2 months ago

same bug.please update the requirments.txt

bys0318 commented 2 months ago

Thanks for pointing out! Updated.