Skip to content

Conversation

@gante
Copy link
Contributor

@gante gante commented Feb 15, 2025

What does this PR do?

The default length for generate, as of H2 2024, has been implicitly max_new_tokens=20. This PR makes it explicit.

Since we're touching default lengths, it also removes the default min_length=0 -- it is impossible to hit, the minimum length of all sequences is 1, the bos token.

A few tests were updated in the process -- they were relying on default values. (Failing TF/Jax tests were removed)

Fixes #35765

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@gante gante force-pushed the default_max_new_tokens branch from dd05ec1 to fc6bed8 Compare February 17, 2025 17:00
@gante
Copy link
Contributor Author

gante commented Nov 5, 2025

closing since I'm leaving and this is massively outdated, but this [using max_new_tokens=20 as default] should be added :) cc @ArthurZucker @Cyrilvallez

@gante gante closed this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent output lengths when max_length=20 is set implicitly vs explicitly in generate()

2 participants