We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the last notebook cell, when attempting to run inference on the trained model, when we enter the following loop:
for prompt in prompts: print(f" prompt:\n{prompt}") print(f" response:\n{test_inference(prompt)}") print("-" * 50)
the very first prompt fed into 'test_inference(prompt)' generates the following error:
'Input length of input_ids is 31, but max_length is set to 20. This can lead to unexpected behavior. ...'
max_length
The text was updated successfully, but these errors were encountered:
The fix is to add a value to max_length in the pipe statement:
Change ...
def test_inference(prompt): prompt = pipe.tokenizer.apply_chat_template( [{"role": "user", "content": prompt}], tokenize=False, add_generation_prompt=True, ) outputs = pipe( prompt, ) return outputs[0]["generated_text"][len(prompt) :].strip()
To ...
def test_inference(prompt): prompt = pipe.tokenizer.apply_chat_template( [{"role": "user", "content": prompt}], tokenize=False, add_generation_prompt=True, ) outputs = pipe( prompt, max_length=512 ) return outputs[0]["generated_text"][len(prompt) :].strip()
Sorry, something went wrong.
No branches or pull requests
In the last notebook cell, when attempting to run inference on the trained model, when we enter the following loop:
for prompt in prompts:
print(f" prompt:\n{prompt}")
print(f" response:\n{test_inference(prompt)}")
print("-" * 50)
the very first prompt fed into 'test_inference(prompt)' generates the following error:
'Input length of input_ids is 31, but
max_length
is set to 20. This can lead to unexpected behavior. ...'The text was updated successfully, but these errors were encountered: