Skip to content

Fix pyconfig strict validation for multimodal keys in text-only runs#4581

Merged
SurbhiJainUSC merged 1 commit into
mainfrom
rl_e2e_test
Jul 24, 2026
Merged

Fix pyconfig strict validation for multimodal keys in text-only runs#4581
SurbhiJainUSC merged 1 commit into
mainfrom
rl_e2e_test

Conversation

@SurbhiJainUSC

Copy link
Copy Markdown
Collaborator

Description

Fix pyconfig strict validation for multimodal keys in text-only runs

The Pydantic configuration validation in pyconfig.py was overly strict for text-only workflows (such as RL training). When processing model YAMLs that included multimodal parameters (like vision_encoder_block or image_size_for_vit), it would crash with a ValueError because those keys are not always in the active schema.

This commit updates _prepare_for_pydantic to check the use_multimodal flag. If use_multimodal is False, the parser now gracefully ignores these specific vision keys and drops them instead of crashing.

FIXES: b/538001451

Tests

Local run

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed, including adding new documentation pages to the relevant Table of Contents (toctree directive) as explained in our documentation.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread src/maxtext/configs/types.py
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@SurbhiJainUSC
SurbhiJainUSC merged commit 1a7305f into main Jul 24, 2026
92 checks passed
@SurbhiJainUSC
SurbhiJainUSC deleted the rl_e2e_test branch July 24, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants