Skip to content

fix(inference): reject a missing negative_prompt_file and flag ignored negative-metadata settings - #354

Open
rwagwani wants to merge 2 commits into
NVIDIA:mainfrom
rwagwani:fix/transfer-negative-file-and-metadata
Open

rwagwani wants to merge 2 commits into
NVIDIA:mainfrom
rwagwani:fix/transfer-negative-file-and-metadata

Conversation

@rwagwani

@rwagwani rwagwani commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #338, covering the two items it listed as not covered.

Summary

  • A missing negative_prompt_file is now rejected when the sample is parsed, before the model loads. Before, the file was read only when no negative_prompt was set; in almost every setup a default negative_prompt wins first, so a typo in the path was accepted with no message. Lookup order:

    1. the folder the run was launched from (where the file was read from before, so existing setups keep working);
    2. the spec file's folder (specs are validated inside a chdir to it; this is the cookbook's ../assets/negative_prompt.json layout);
    3. for a bare filename only, defaults/ (for example neg_prompts.json).

    A negative_prompt_file inside a --defaults-file is also tried next to that defaults file. A path that is not found fails with:

    negative_prompt_file not found: missing_negative.json (tried <launch>/missing_negative.json, <spec dir>/missing_negative.json, <package>/inference/defaults/missing_negative.json)
    
  • negative_metadata_mode and negative_prompt_keep_metadata warn on distilled causal Transfer. They are added to _DISTILLED_TRANSFER_IGNORED_FIELDS, with neutral values none and false, so a request that sets them gets the same [transfer] '<field>' is ignored by distilled causal Transfer: ... warning as the other fix(inference): warn when a transfer setting cannot take effect #338 fields. The distilled schedule has no negative-caption branch, so neither setting is read.

Not changed

Behaviour change, stated plainly

  • The only new error is a missing negative_prompt_file, and it lists every path it tried. Every shipped cookbook spec and Sim-Transfer skill request still builds; transfer_shipped_specs_test.py covers this.
  • The check runs whether or not the file would be read, including a path in a --defaults-file. A setup that carried an unused, broken path now fails, by design.
  • In a batch or jsonl run, a bad path now fails when the samples are loaded, like a bad vision_path, so --skip-invalid-samples does not skip it.
  • URLs were never read for this field, and they are now rejected with the same message instead of being accepted unused.
  • The stored sample args record the resolved absolute path.
  • negative_metadata_mode is checked against the value the request set, so none does not warn when negative_prompt_keep_metadata from the defaults promotes it to same.

Verification

  • New L0 CPU tests in sim_transfer_args_test.py:
    • a missing file is rejected on both the causal and the bidirectional path
    • a relative path still resolves from the launch folder first, then from the spec's folder (the cookbook layout)
    • a bare defaults/ filename is still accepted, but a path such as typo_dir/neg_prompts.json is not
    • the keep_metadata promotion does not produce a spurious negative_metadata_mode warning
    • negative_metadata_mode none / same / inverse and negative_prompt_keep_metadata false / true warn only for non-neutral values
  • test_unused_negative_prompt_file_is_not_opened now uses a file that exists, because a missing path is rejected earlier. It still checks that the file is not read when a default caption wins. A stale comment in transfer_shipped_specs_test.py is updated.
  • pytest cosmos_framework/inference/sim_transfer_args_test.py cosmos_framework/inference/transfer_shipped_specs_test.py cosmos_framework/inference/args_test.py: 159 passed.
  • pytest cosmos_framework/inference/ -m "not GPU": the same 7 failures as main (auto_rig_frontend_test x1, model_test x6), no new ones.
  • A spec launched from a folder holding neg.json, with the spec elsewhere, still resolves to the launch folder's file.
  • ruff check and ruff format --check: clean.
  • End to end on Cosmos3-Nano-Sim-Transfer (single GPU), with the same spec and the same command:
    • A spec with negative_prompt_file: "missing_negative.json" was accepted silently before. Now it stops before model load with the message above.
    • A spec with a valid negative_prompt_file still runs, with an unchanged result, and logs [transfer] 'negative_prompt_file' is ignored by distilled causal Transfer: the distilled schedule has no negative-caption branch.
    • A spec with negative_metadata_mode: "same" runs, with an unchanged result, and now logs [transfer] 'negative_metadata_mode' is ignored by distilled causal Transfer: the distilled schedule has no negative-caption branch to add metadata to.

🤖 Generated with Claude Code

rwagwani and others added 2 commits November 3, 2026 05:16
…d negative-metadata settings

Follow-up to NVIDIA#338.

- negative_prompt_file is validated when the sample is parsed. A relative path
  resolves against the spec file's folder (as vision_path and prompt_path do), and a
  bare filename under defaults/ is still accepted. A path that does not exist now
  fails before model load, instead of passing silently whenever a default
  negative_prompt wins.
- negative_metadata_mode and negative_prompt_keep_metadata join the distilled
  causal Transfer ignored-fields table (neutral values: none / false).

No change to which negative caption is used, so cookbook and Sim-Transfer skill
outputs are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ddress review

- Resolve a relative negative_prompt_file from the launch folder first (where it was
  read from before), then the spec's folder; a defaults-file entry is also tried next
  to that defaults file.
- Apply the defaults/ fallback to a bare filename only.
- Check negative_metadata_mode against the requested value, so a keep_metadata
  promotion of 'none' to 'same' does not warn.
- Update a stale comment in transfer_shipped_specs_test.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant