fix(v1): respect batch_size in train_gen when permute=False#364
Open
staticpayload wants to merge 1 commit intogoogle-research:masterfrom
Open
fix(v1): respect batch_size in train_gen when permute=False#364staticpayload wants to merge 1 commit intogoogle-research:masterfrom
staticpayload wants to merge 1 commit intogoogle-research:masterfrom
Conversation
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.
Summary
TimeSeriesdata.train_gen()inv1/src/timesfm/data_loader.pysopermute=Falseyields deterministic batch windows instead of all series every steppermute=Truesampling behavior unchangedBug
Issue #359 reports that
train_genignoresbatch_sizewhenpermute=Falseby settingtsidx = np.arange(num_ts)every iteration.This makes non-permuted training load all series in each generated sample, which breaks expected batching semantics and inflates memory/compute.
Fix
For
permute=False, iterate explicit batch starts (range(0, num_ts, self.batch_size)) and slicetsidxas:np.arange(batch_idx, min(batch_idx + self.batch_size, num_ts)).Tests
Added
v1/tests/test_data_loader.pywith two regression tests:test_train_gen_non_permute_respects_batch_windowstest_train_gen_non_permute_no_extra_batches_on_even_splitLocal run:
python3 -m pytest -q v1/tests/test_data_loader.py # 2 passedFixes #359