Skip to content

fix: tolerate null metadata values and messages - #2171

Merged
tdene merged 1 commit into
NVIDIA-NeMo:mainfrom
tdene:tde/fix_null_metadata
Jul 30, 2026
Merged

tdene merged 1 commit into
NVIDIA-NeMo:mainfrom
tdene:tde/fix_null_metadata

Conversation

@tdene

@tdene tdene commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #2139 and #1180


# Merge global config chat_template_kwargs with per-request overrides in metadata (e.g. per-sample reasoning on/off)
metadata_chat_template_kwargs_str = metadata.get("chat_template_kwargs", "{}")
metadata_chat_template_kwargs_str = metadata.get("chat_template_kwargs") or "{}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This prevents a crash if the metadata is literally None.

In Python, dict.get("a", "b") will return None for the dict {"a": None}.

extra_body = deepcopy(self.config.extra_body)

metadata_extra_body_str = metadata.get("extra_body", "{}")
metadata_extra_body_str = metadata.get("extra_body") or "{}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This prevents a crash if the metadata is literally None.

In Python, dict.get("a", "b") will return None for the dict {"a": None}.

@tdene

tdene commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 2d45d8b

ananthsub
ananthsub previously approved these changes Jul 28, 2026
@tdene
tdene enabled auto-merge (squash) July 28, 2026 20:27
@tdene
tdene removed the request for review from bxyu-nvidia July 28, 2026 20:28
@tdene
tdene force-pushed the tde/fix_null_metadata branch 3 times, most recently from 2d45d8b to 1c2c522 Compare July 29, 2026 19:16
@tdene
tdene requested a review from ananthsub July 29, 2026 19:19
@ananthsub
ananthsub force-pushed the tde/fix_null_metadata branch from 1c2c522 to 085d59f Compare July 30, 2026 14:08
@copy-pr-bot

copy-pr-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@tdene

tdene commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 085d59f

@tdene
tdene merged commit edc9a6e into NVIDIA-NeMo:main Jul 30, 2026
14 checks passed
OlegSudakov pushed a commit to OlegSudakov/Gym that referenced this pull request Aug 7, 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.

2 participants