Fix AttributeError on missing use_sft in grain data processing - #5137
Open
bvandermoon wants to merge 1 commit into
Open
Fix AttributeError on missing use_sft in grain data processing#5137bvandermoon wants to merge 1 commit into
bvandermoon wants to merge 1 commit into
Conversation
Safely check for use_sft, use_dpo, and use_multimodal using getattr(config, ..., False) in grain data processing pipelines. Also add use_sft=False and use_multimodal=False to GrainMmapNpyEvalConfigTest._config so that mock configs in unit tests provide these fields.
bvandermoon
requested review from
A9isha,
NuojCheng,
RissyRan,
SurbhiJainUSC,
abhinavclemson,
aireenmei,
darisoy,
dipannita08,
gagika,
gobbleturk,
hengtaoguo,
huytransformer,
igorts-git,
jiangjy1982,
khatwanimohit,
richjames0,
shralex,
shuningjin,
vipannalla and
xibinliu
as code owners
September 4, 2026 00:20
There was a problem hiding this comment.
Code Review
This pull request updates the input pipeline data processing code to use getattr with default values when accessing configuration attributes like use_sft, use_multimodal, use_dpo, train_image_column, and eval_image_column. This prevents potential AttributeError exceptions when these configuration options are not explicitly defined. Additionally, default values for use_sft and use_multimodal were added to the test configuration helper. There are no review comments, so I have no feedback to provide.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes an
AttributeError: 'types.SimpleNamespace' object has no attribute 'use_sft'inmake_grain_eval_iteratorcaused by a collision between PR #4754 and PR #4625.src/maxtext/input_pipeline/grain_data_processing.py, safely checkuse_sft,use_dpo, anduse_multimodalwithgetattr(config, ..., False)in_get_pipeline_fn,make_grain_train_iterator, andmake_grain_eval_iterator.tests/unit/mmap_data_processing_test.py, defineuse_sft=Falseanduse_multimodal=FalseinGrainMmapNpyEvalConfigTest._config.Tests
pytest tests/unit/mmap_data_processing_test.py -k "GrainMmapNpyEvalConfigTest"passes.tests/unit/mmap_data_processing_test.pypass.Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.