Skip to content
New issue

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

[Warning] the current text generation call will exceed the model's predefined maximum length (4096). #423

Open
yileitu opened this issue Jan 21, 2024 · 2 comments
Labels
feat/model Feature: models usage How to use `spacy-llm`

Comments

@yileitu
Copy link

yileitu commented Jan 21, 2024

When using LLM to do NER task, there is a warning saying "This is a friendly reminder - the current text generation call will exceed the model's predefined maximum length (4096). Depending on the model, you may observe exceptions, performance degradation, or nothing at all."

How to change the maximum length of the LLM output?

[components.llm.task]
@llm_tasks = "spacy.NER.v3"

[components.llm.model]
@llm_models = "spacy.Llama2.v1"
name = "Llama-2-7b-hf"
@rmitsch rmitsch added feat/model Feature: models usage How to use `spacy-llm` labels Jan 23, 2024
@rmitsch
Copy link
Collaborator

rmitsch commented Jan 23, 2024

Hi @yileitu, all model parameter are forwarded to transformers that handles the model. In most cases there is a max_length or max_new_tokens parameter you can set:

[components.llm.model]
@llm_models = "spacy.Llama2.v1"
name = "Llama-2-7b-hf"
max_length = 8192  # or any other value you want to set

@yileitu yileitu closed this as completed Jan 24, 2024
@yileitu yileitu reopened this Jan 27, 2024
@yileitu
Copy link
Author

yileitu commented Jan 27, 2024

Hi @rmitsch. Thanks for your replies. However this does not work.

Config validation error
llm.model -> max_new_tokens	extra fields not permitted
{'@llm_models': 'spacy.Llama2.v1', 'name': 'Llama-2-7b-hf', 'max_new_tokens': 10000}

Neither does max_length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat/model Feature: models usage How to use `spacy-llm`
Projects
None yet
Development

No branches or pull requests

2 participants