Skip to content

Conversation

@vasqu
Copy link
Contributor

@vasqu vasqu commented Dec 19, 2025

Followup to #42702 where defaults are now either None or a boolean value.

The logic was dependent on the values being None which ignored overriding other values, e.g. do_sample. The fails due to this can be seen in a few integration tests, e.g. gpt2.

@vasqu
Copy link
Contributor Author

vasqu commented Dec 19, 2025

run-slow: gpt2,whisper,qwen2_5_vl,glm4v,biogpt

@github-actions
Copy link
Contributor

This comment contains run-slow, running the specified jobs:

models: ["models/biogpt", "models/glm4v", "models/gpt2", "models/qwen2_5_vl", "models/whisper"]
quantizations: []

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a small fast test 🫡

@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.


# Due to some values being boolean and not `None`, we need additional logic to overwrite
# them explicitly (`defaults_only=False`)
generation_config.update(**{k: v for k, v in self.generation_config.to_dict().items() if isinstance(v, bool)})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we don't need to restrict that update? to something like

default_gc = GenerationConfig() bool_defaults = {k: v for k, v in self.generation_config.to_dict().items() if isinstance(v, bool) and hasattr(generation_config, k) and hasattr(default_gc, k) and getattr(generation_config, k) == getattr(default_gc, k) } generation_config.update(**bool_defaults)

just to be sure I understand 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, it's correct I didnt notice that we can pass a generation config directly there as well (e.g. as in assisted decoding)

@vasqu
Copy link
Contributor Author

vasqu commented Dec 19, 2025

run-slow: whisper,gemma3n,gpt2,moshi,bert

@github-actions
Copy link
Contributor

CI Results

Workflow Run ⚙️

⚠️ No test being reported (jobs are skipped or cancelled)!

@github-actions
Copy link
Contributor

💔 This comment contains run-slow, but unknown error occurred and the workflow run aborted!

@vasqu
Copy link
Contributor Author

vasqu commented Dec 19, 2025

run-slow: whisper,gemma3n,gpt2,moshi,bert

@github-actions
Copy link
Contributor

This comment contains run-slow, running the specified jobs:

models: ["models/bert", "models/gemma3n", "models/gpt2", "models/moshi", "models/whisper"]
quantizations: []

@vasqu vasqu mentioned this pull request Dec 19, 2025
2 tasks
@github-actions
Copy link
Contributor

CI Results

Workflow Run ⚙️

✅ No failing test specific to this PR 🎉 !

@github-actions
Copy link
Contributor

@vasqu vasqu enabled auto-merge (squash) December 19, 2025 17:36
@vasqu vasqu merged commit f218ed2 into huggingface:main Dec 19, 2025
25 checks passed
@vasqu vasqu deleted the fix-generation-config-overwrite branch December 19, 2025 17:37
Comment on lines +1802 to +1810
generation_config.update(
**{
k: v
for k, v in self.generation_config.to_dict().items()
if isinstance(v, bool)
and hasattr(default_generation_config, k)
and getattr(generation_config, k, None) == getattr(default_generation_config, k)
}
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for late review. I think we're back to the original issue where users pass do_sample=False in their custom config and the model has do_sample=True saved on the hub. And since False is the default value, we won't update it here and keep True

In that case we'd need to set the booleans to None by default as well, I dont' see a cleaner way than defining None as non-set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants