You should consider increasing max_length
or, better yet, setting max_new_tokens
.
#27095
Replies: 1 comment 1 reply
-
Hey there, @reemas-irasna! I'm here to help you with any bugs, questions, or contributions you have. Let's work together to solve your issue. I found a similar closed issue that might be relevant to your problem: Chat with pandas df string length BadRequestError, which was last updated on September 03, 2024 [1]. To address the error you're encountering, ensure that the from langchain_community.llms import Exllamav2
llm = Exllamav2(model_path="/path/to/llama/model", max_new_tokens=200) In your case, you have already set |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I am using one of langchain agent i.e. create_pandas_dataframe_agent, loading llama3.1 8b instruct model with 4 bit and bytes configuration. While using the agent im getting error to increase max_length or max_new_tokens. Even though i am providing it in pipeline, agent defination, and as we know llama 3 have 8k limit but still it is not going correctly, please check the code of mine correct me i am lagging somewhere
complete error-
Setting
pad_token_id
toeos_token_id
:None for open-end generation./opt/conda/lib/python3.10/site-packages/transformers/generation/utils.py:1220: UserWarning: Using the model-agnostic default
max_length
(=20) to control the generation length. We recommend settingmax_new_tokens
to control the maximum length of the generation.warnings.warn(
Exception in thread Thread-7 (generate):
Traceback (most recent call last):
File "/opt/conda/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/opt/conda/lib/python3.10/site-packages/ipykernel/ipkernel.py", line 766, in run_closure
_threading_Thread_run(self)
File "/opt/conda/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/opt/conda/lib/python3.10/site-packages/transformers/generation/utils.py", line 1906, in generate
self._validate_generated_length(generation_config, input_ids_length, has_default_max_length)
File "/opt/conda/lib/python3.10/site-packages/transformers/generation/utils.py", line 1228, in _validate_generated_length
raise ValueError(
ValueError: Input length of input_ids is 4117, but
max_length
is set to 4096. This can lead to unexpected behavior. You should consider increasingmax_length
or, better yet, settingmax_new_tokens
.System Info
Python 3.10.14
langchain Version: 0.3.1
langchain-experimental Version: 0.3.2
torch - 2.4.1+cu121
Beta Was this translation helpful? Give feedback.
All reactions