Skip to content

[misc]: Refactor separate training pipeline runner - #1696

Open
techverve wants to merge 12 commits into
hao-ai-lab:mainfrom
techverve:refactor/separate-training-pipeline-runner
Open

[misc]: Refactor separate training pipeline runner#1696
techverve wants to merge 12 commits into
hao-ai-lab:mainfrom
techverve:refactor/separate-training-pipeline-runner

Conversation

@techverve

@techverve techverve commented Aug 7, 2026

Copy link
Copy Markdown

What

Decoupled the CLI execution logic from the legacy training pipelines by introducing a centralized runner script (fastvideo/training/runner.py).

Why

To enforce separation of concerns and improve code maintainability. Previously, the legacy training pipelines coupled the class definitions directly with the script execution entry points. This architectural pattern resulted in redundant boilerplate across the codebase and made the pipeline modules harder to test and import in isolation.

How

  • Abstracted the main() execution blocks and CLI argument parsing out of the individual pipeline modules.
  • Implemented a generic runner.py entry point that uses importlib to dynamically load the target pipeline at runtime via --pipeline_class and --pipeline_module flags.
  • Refactored the underlying finetune and distill shell scripts to target the new unified runner.

MERGE WORKFLOW:

  1. Ensure pre-commit passes and you have at least 1 approval
  2. Comment /merge (or add the "ready" label) to enter the Merge Queue
  3. Full Test Suite runs automatically on a staging branch → auto-merge on success

ON-DEMAND TESTING (write access required):
/test full — Full Test Suite /test ssim — SSIM regression
/test training — Training pipeline /test encoder — Encoder tests
/test transformer — Transformer tests /test vae — VAE tests
/test kernel — CUDA kernel tests /test unit — Unit tests
See docs/contributing/pull_requests.md for all 17 test commands

Purpose

Fixes https://linear.app/fastvideo/issue/FAS-215/training-separate-trainingpipeline-class-definition-and-runner-script

Checklist

  • I ran pre-commit run --all-files and fixed all issues
  • I added or updated tests for my changes
  • I updated documentation if needed
  • I considered GPU memory impact of my changes

For model/pipeline changes, also check:

  • I verified SSIM regression tests pass
  • I updated the support matrix if adding a new model

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to FastVideo! Thanks for your first pull request.

How our CI works:

PRs run a two-tier CI system:

  1. Pre-commit — formatting (yapf), linting (ruff), type checking (mypy). Runs immediately on every PR.
  2. Fastcheck — core GPU tests (encoders, VAEs, transformers, kernels, unit tests). Runs automatically via Buildkite on relevant file changes (~10-15 min).
  3. Full Suite — integration tests, training pipelines, SSIM regression. Runs only when a reviewer adds the ready label.

Before your PR is reviewed:

  • pre-commit run --all-files passes locally
  • You've added or updated tests for your changes
  • The PR description explains what and why

If pre-commit fails, a bot comment will explain how to fix it. Fastcheck and Full Suite results appear in the Checks section below.

Useful links:

@mergify mergify Bot added type: misc Cleanup, config, dependencies scope: training Training pipeline, methods, configs labels Aug 7, 2026
@mergify

mergify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🤖 CI

Protection Waiting on
🔴 PR merge requirements 👀 reviews and 🤖 CI

🔴 PR merge requirements

Waiting for

  • #approved-reviews-by>=1
  • check-success=full-suite-passed
This rule is failing.
  • #approved-reviews-by>=1
  • check-success=full-suite-passed
  • check-success=fastcheck-passed
  • check-success~=pre-commit
  • title~=(?i)^\[(feat|feature|bugfix|fix|refactor|perf|ci|doc|docs|misc|chore|kernel|new.?model|skill|skills|infra)\]

@techverve
techverve force-pushed the refactor/separate-training-pipeline-runner branch from 9cfcace to 53ceb6e Compare August 7, 2026 06:47
@mergify mergify Bot added the scope: infra CI, tests, Docker, build label Aug 7, 2026
@techverve
techverve marked this pull request as ready for review August 7, 2026 12:09
@H1yori233

Copy link
Copy Markdown
Collaborator

Thanks for the contribution! This refactor makes sense. However, are many training scripts in the repo that invoke these pipeline files directly. Removing the existing entry points would break downstream compatibility. Could you keep backward-compatible entry points and update the in-repo scripts to use the new runner as well?

@techverve
techverve force-pushed the refactor/separate-training-pipeline-runner branch from 7d14ccb to f48b81d Compare August 22, 2026 04:38
@mergify

mergify Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Pre-commit checks failed

Hi @techverve, the pre-commit checks have failed. To fix them locally:

# Install pre-commit if you haven't already
uv pip install pre-commit
pre-commit install

# Run all checks and auto-fix what's possible
pre-commit run --all-files

Common fixes:

  • yapf: yapf -i <file> (formatting)
  • ruff: ruff check --fix <file> (linting)
  • codespell: codespell --write-changes <file> (spelling)

After fixing, commit and push the changes. The checks will re-run automatically.

For future commits, pre-commit will run automatically on changed files before each commit.

@techverve
techverve force-pushed the refactor/separate-training-pipeline-runner branch 4 times, most recently from 105e034 to 6ed353f Compare August 28, 2026 14:20
@techverve

Copy link
Copy Markdown
Author

Thanks for the contribution! This refactor makes sense. However, are many training scripts in the repo that invoke these pipeline files directly. Removing the existing entry points would break downstream compatibility. Could you keep backward-compatible entry points and update the in-repo scripts to use the new runner as well?

Hi @H1yori233 , I have addressed your suggestions could you please have a look again.
Thanks !

Comment thread fastvideo/training/wan_training_pipeline.py Outdated
Comment thread fastvideo/tests/training/test_runner.py Outdated
@techverve
techverve force-pushed the refactor/separate-training-pipeline-runner branch from abd05e0 to db01f15 Compare September 2, 2026 19:46
@H1yori233

Copy link
Copy Markdown
Collaborator

Thx, LGTM now.

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

Labels

scope: infra CI, tests, Docker, build scope: training Training pipeline, methods, configs type: misc Cleanup, config, dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants