Skip to content

refactor(data): reuse Primus config merge and isolate Megatron CLI - #1065

Merged
Xiaoming-AMD merged 4 commits into
mainfrom
refactor/data-config-pipeline
Sep 1, 2026
Merged

Xiaoming-AMD merged 4 commits into
mainfrom
refactor/data-config-pipeline

Conversation

@WangLingxun

@WangLingxun WangLingxun commented Sep 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • reuse the Primus YAML loader and deep-merge semantics for diffusion preprocessing config resolution
  • preserve the precedence contract from fix(cli): honour explicit CLI flags whose value equals the parser default #1002: defaults -> YAML -> explicitly supplied CLI flags
  • move Megatron diffusion raw/encoded/ingest implementation under the Megatron backend
  • keep primus data diffusion-raw, diffusion-encoded, and diffusion-ingest compatible through a thin CLI facade
  • avoid introducing a generic data-backend registry before a second backend needs this capability

Relationship to #1002

#1002 has been merged into main as da87fdf5 and fixes #1001.

This branch merged the latest main in eeb4e00e to resolve the overlap without rebasing or rewriting any existing commit. The historical f44a5bde commit carries the same #1002 patch and contributes no unique diff relative to the current base.

The effective review scope of this PR is the following two refactor commits:

  1. bf720f15 refactor(data): centralize preprocessing config resolution
  2. 13766887 refactor(cli): move data commands into megatron backend

Validation

  • pre-commit: passed
  • relevant CLI, Megatron diffusion config, core config, and YAML tests: 147 passed, 3 subtests passed
  • diff against the latest main contains only the expected data and CLI refactor files
  • real quickstart_pokemon.yaml resolution was validated
  • command registration does not eagerly import raw or encoded pipeline implementations

Sumon Singh and others added 3 commits September 1, 2026 06:32
`primus data diffusion-encoded` inferred which CLI flags were explicitly
provided by comparing each parsed value against a default table, so a flag
typed with a value equal to its default was indistinguishable from an omitted
flag and silently lost to the YAML config. The same comparison dropped keys
supplied by neither the YAML nor the CLI from the merged namespace, so
_prepare_encoded raised AttributeError on args.variable_size whenever the
optional image: section was absent.

Register the encoded parser's options with argparse.SUPPRESS so the namespace
holds only what the user typed, and merge defaults -> YAML -> CLI in priority
order. The defaults layer always supplies every configurable key, which makes
the missing-attribute failure impossible by construction.

diffusion-raw and diffusion-ingest keep their argparse defaults and are
unaffected.

Fixes #1001
@WangLingxun
WangLingxun force-pushed the refactor/data-config-pipeline branch from 5b3654b to 1376688 Compare September 1, 2026 06:42
@WangLingxun
WangLingxun marked this pull request as ready for review September 1, 2026 06:42
…pipeline

# Conflicts:
#	primus/cli/subcommands/data.py
#	tests/unit_tests/cli/test_data_config.py
@Xiaoming-AMD
Xiaoming-AMD merged commit fbb2e47 into main Sep 1, 2026
8 checks passed
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.

primus data diffusion-encoded: CLI flags are silently ignored, and config keys silently vanish, whenever a value equals its parser default

2 participants