Fix missing sampler argument in xaeronet volume dataloader demo - #1964
Open
Anai-Guo wants to merge 1 commit into
Open
Fix missing sampler argument in xaeronet volume dataloader demo#1964Anai-Guo wants to merge 1 commit into
sampler argument in xaeronet volume dataloader demo#1964Anai-Guo wants to merge 1 commit into
Conversation
`create_dataloader` takes `sampler` as a required positional argument, but the `__main__` demo block in the same file omits it, so running the module directly raises TypeError before any data is loaded. Pass `sampler=None`, matching `volume/train.py`, and document the two parameters (`sampler`, `nan_to_0`) that were missing from the docstring. Signed-off-by: Anai-Guo <antai12232931@outlook.com>
Contributor
CODEOWNERS review mapCurrent for commit ⏳ @mnabian — 1 file(s)
Comment |
Contributor
Greptile SummaryThe PR fixes the XAeroNet volume dataloader demo by explicitly passing Important Files Changed
Reviews (1): Last reviewed commit: "Fix missing `sampler` argument in xaeron..." | Re-trigger Greptile |
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.
Problem
examples/cfd/external_aerodynamics/xaeronet/volume/dataloader.pycannot be run as ascript.
create_dataloadertakessampleras a required positional argument:but the
__main__demo block at the bottom of the same file omits it:so
python dataloader.pyfails withTypeError: create_dataloader() missing 1 required positional argument: 'sampler'before any data is touched.
Two things show
samplerwas added to the signature after this demo was written andthe demo was never updated:
file_list,mean,std,batch_size,num_workers,pin_memoryandprefetch_factor— but neithersamplernornan_to_0.surface/dataloader.pyhas the same__main__demo and runs fine,because its
create_dataloaderhas no requiredsampler.Fix
Pass
sampler=None, exactly as the real training code in the same example alreadydoes at
volume/train.py:DataLoader(sampler=None)is the documented default (sequential order), so the demobehaves as originally intended. Also documented
samplerandnan_to_0in thedocstring.
Verification
No GPU or DriveAer dataset here, so I verified the argument binding rather than
executing the loader — which is exactly where the failure is. Signatures were
extracted from the file's AST and each call shape replayed with
Signature.bind:Formatting, with the version pinned in
.pre-commit-config.yaml(ruff v0.12.5), runfrom the repo root:
(
ruff checkexcludes^examples/in the pre-commit config; I confirmed the file'sruff checkoutput is byte-identical before and after this patch either way.)🤖 Generated with Claude Code