Repository navigation
Conversation
|
Primary maintainers: @wenxie-amd @Xiaoming-AMD Reach out to the primary maintainers with any questions about this PR. Outside China Standard Time (UTC+8) working hours, for urgent issues you can also reach out to: vidushi8, lorri-rao, GeneDer, amd-fuyuajin, JohnQin-llm. |
| import tempfile | ||
|
|
||
| path = _os.path.join(tempfile.mkdtemp(), "info.log") | ||
| open(path, "w").write(line + "\n") |
| # | ||
| # So: capture host-side values at the log window, hand them to a queue, and let | ||
| # a daemon thread do the network. Nothing in the training loop ever waits. | ||
| _PER_STEP_INSTALLED = "_primus_mlflow_per_step_installed" |
| def test_patch_is_registered_for_before_train(self): | ||
| """`after_train` is never dispatched by AutoModelPretrainTrainer, so a | ||
| teardown patch registered there would silently never fire.""" | ||
| import primus.backends.automodel.patches # noqa: F401 |
This branch has not been deployed
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
AutoModel's diffusion recipe has no run tracking. It logs to wandb only, while upstream's MLflow utilities (
nemo_automodel/components/loggers/mlflow_utils.py) are wired into the LLM and VLM recipes and never called by the diffusion one. This adds a Primus patch that connects them, so a diffusion run's resolved config, environment, logs, traces and performance summary are recorded against the run that produced them.Off by default, and that is the main thing to check in review.
primus_mlflow.enabledefaults tofalse;run_patchesevaluates the patch'sconditionat call time, so a disabled patch imports nothing, contacts no server and costs nothing. Existing runs, CI and MAD are unaffected by this PR landing.No new dependency —
mlflow==3.11.1andpyrsmiare already inrequirements.txt.Written as a registered
before_trainpatch rather than a trainer edit, following the backend package's own guidance that Primus-side behaviour is added as patches. Discovery is automatic, so neitherpatches/__init__.pynorautomodel_pretrain_trainer.pychanges. Teardown runs in afinally, the same shapetorch_profiler_patches.pyalready uses —after_trainis not dispatched by this backend, so a teardown patch registered there would silently never fire.Changes
primus/backends/automodel/patches/mlflow_patches.py(new, 1408 lines)tools/auto_benchmarkalready defines (image digest, commits and submodule pins, ROCm and framework versions, GPU) — reused rather than redefined.perf/*summary (median step time, samples/s/GPU, peak memory) parsed from the recipe's own[TRAIN]lines — the same sourceauto_benchmarkreads, so the two cannot disagree, and it adds no per-step cost.FINISHED/FAILED/KILLEDplus a termination reason, covering the blind spots in upstream'ssys.excepthook(exceptions caught by a caller,KeyboardInterruptas aBaseException, worker-thread exceptions viathreading.excepthook). A failed upload warns and never fails the run, and tracking errors never mask the original exception.mlflow:(AutoModel-native, deliberately not aprimus_section so it reaches the typed config) andprimus_mlflow:(Primus-only, stripped bystrip_primus_keys) added topre_trainer.yaml,flux_synth_pre_trainer.yamlandwan_synthetic_pre_trainer.yaml. Every key is declared, so a typo surfaces as a trainer warning rather than silently doing nothing. Flag semantics mirror the Megatron path'sdisable_mlflow/mlflow_upload_*.wan2_1_t2v_{1_3b,14b}.yamlmodel configs, pluswan2_1_t2v_{1_3b,14b}-mock21f.yamland a 14B FP8 variant as synthetic examples.flux_1_schnell-synthetic-fp8.yaml.tests/unit_tests/backends/automodel/test_mlflow_patches.py, 77 tests, mirroring the existing Megatron MLflow test files..pre-commit-config.yaml: thethirdparty-lockhook invokedpython, which does not exist in the dev image, so the hook failed on an unmodified tree. Changed topython3. Happy to split this into its own PR if preferred.Testing
Unit — 77 tests, run without torch or mlflow present. They cover: disabled-by-default does nothing (no import, no server contact, no overhead); inputs captured exactly once; a failed upload warns rather than raising; and the secret filter holds against a fixture environment carrying credential-shaped variables under both allowed and disallowed names.
End to end against a live tracking server — Flux-schnell and Wan 2.1 1.3B, BF16 and FP8, one node, 8× MI355X. Each run recorded its inputs, artifacts and
perf/*summary, terminatedFINISHED, and the logged parameters were read back and checked for anything credential-shaped. Profiler traces and TraceLens reports were separately exercised end to end.Overhead — Summary logging is parsed from the log after the loop returns, so it is outside the timed region by construction.
Known gaps, deliberately left:
per_stepdefaults off pending that A/B being repeated on a second model — Flux is the worst case for step time, a video model is the worst case for artifact volume.upload_tracelens_reportrequires TraceLens in the image. Unlike the Megatron path this never pip-installs at run time: a job that reaches for the network during teardown is a job that hangs during teardown.Reviewers
wenxie-amd,Xiaoming-AMD. Reach out to them with any questions about this PR.vidushi8,lorri-rao,GeneDer,amd-fuyuajin,JohnQin-llm