Conversation
_from_files rejects an empty input list, and a literal path that does not exist raises FileNotFoundError, but a pattern such as "inputs/*.jsnol" that matches nothing expanded to an empty list and was silently dropped. The run then loaded the checkpoint and generated nothing, or skipped that pattern's samples when another pattern matched. Raise a ValueError naming the pattern instead. Signed-off-by: kevin9327 <5299031+kevin9327@users.noreply.github.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
-i/--input-filesaccepts glob patterns (inputs/*.json)._from_filesalready rejects an empty input list, and a literal path that doesn't exist raisesFileNotFoundError. A pattern that matches nothing, though, expands to an empty list and is silently dropped:In
scripts/inference.py(lines 43–72) that empty list flows on. The script logsLoaded 0 samples, builds the pipeline (loading the checkpoint), callsgenerate([])and exits normally without generating anything. When several patterns are passed and only one has a typo, that pattern's samples just go missing from the run.inference/ray/submit.py,inference/ray/gradio.pyandscripts/upsample_prompts.pyload inputs through the same function.Fix
When a glob pattern matches no file, raise
ValueError("No inference parameter files match '<pattern>'"), in line with the existing empty-list and missing-path errors. Literal paths and patterns that do match are unchanged.Tests
Added to
cosmos_framework/inference/common/args_test.py:test_from_files_expands_glob_patterns: a matching pattern loads every match (sorted), and a missing literal path still raisesFileNotFoundError. Passes both before and after the change, so the check only adds the no-match case.test_from_files_raises_when_a_glob_matches_nothing: a non-matching pattern raises, including when it sits next to a matching one.Fail-before (source reverted, tests kept):
Counts for
args_test.py:main, existing testsThe 2 failures present in every row come from my environment (Windows, CPU) and fail the same way on
main:test_download_fileneeds symlink privilege, andtest_parse_checkpoint_pathbuilds a path longer thanMAX_PATH.Run on CPU:
PYTHONUTF8=1 COSMOS_TRAINING=0 pytest cosmos_framework/inference/common/args_test.py.Lint
ruff 0.12.7(repo pin):ruff checkpasses on both touched files before and after.ruff format --diffis the same size before and after for each file (3 and 4 lines, pre-existing).🤖 Generated with Claude Code