Skip to content

Support JSON string parsing of teacher_model_init_kwargs in MiniLLMConfig#5259

Merged
albertvillanova merged 1 commit into
huggingface:mainfrom
albertvillanova:fu-5258
Mar 10, 2026
Merged

Support JSON string parsing of teacher_model_init_kwargs in MiniLLMConfig#5259
albertvillanova merged 1 commit into
huggingface:mainfrom
albertvillanova:fu-5258

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Mar 10, 2026

Copy link
Copy Markdown
Member

Support JSON string parsing of teacher_model_init_kwargs in MiniLLMConfig

  • Add missing _VALID_DICT_FIELDS to MiniLLMConfig

This PR is required for:

This PR makes change the MiniLLMConfig class, extending the set of valid dictionary fields to include teacher_model_init_kwargs for improved configuration handling. Otherwise, TrainingArguments.__post_init__ won't parse the JSON string into a dict

  • Added teacher_model_init_kwargs to the _VALID_DICT_FIELDS list in MiniLLMConfig, enabling its use in dictionary-based configuration workflows.

Note

Low Risk
Single-line config metadata change limited to argument parsing/validation; low chance of behavioral impact beyond enabling the previously-ignored field.

Overview
MiniLLMConfig now extends TrainingArguments._VALID_DICT_FIELDS to include teacher_model_init_kwargs, enabling dictionary/JSON-string configuration of teacher model init kwargs to be accepted and parsed during TrainingArguments.__post_init__.

Written by Cursor Bugbot for commit 77013dc. This will update automatically on new commits. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Whether to apply length normalization to the rewards.
"""

_VALID_DICT_FIELDS = TrainingArguments._VALID_DICT_FIELDS + ["teacher_model_init_kwargs"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Override drops inherited model_init_kwargs from valid dict fields

High Severity

_VALID_DICT_FIELDS is based on TrainingArguments._VALID_DICT_FIELDS instead of GRPOConfig._VALID_DICT_FIELDS. Since GRPOConfig adds "model_init_kwargs" to its _VALID_DICT_FIELDS, this override silently drops it. Before this PR, MiniLLMConfig inherited GRPOConfig._VALID_DICT_FIELDS (which included "model_init_kwargs"); after this PR, JSON string parsing of model_init_kwargs will no longer work, which is a regression.

Fix in Cursor Fix in Web

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

@albertvillanova albertvillanova merged commit 3fd447a into huggingface:main Mar 10, 2026
4 checks passed
songhappy pushed a commit to songhappy/trl that referenced this pull request Apr 20, 2026
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.

3 participants