[trainer,data,model] feat: add SFT and offline DPO - #220
Open
Jayce-Ping wants to merge 74 commits into
Open
Conversation
Jayce-Ping
force-pushed
the
feat/sft-offline-dpo
branch
2 times, most recently
from
August 29, 2026 03:28
03048a3 to
3c15ed7
Compare
Jayce-Ping
marked this pull request as ready for review
August 30, 2026 23:56
Jayce-Ping
force-pushed
the
feat/sft-offline-dpo
branch
from
August 31, 2026 00:04
45e22d9 to
0929d52
Compare
Jayce-Ping
force-pushed
the
feat/sft-offline-dpo
branch
from
August 31, 2026 00:42
7c7f638 to
826cf59
Compare
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.
Important
This is a stacked PR on top of #219 (
feat/precision-aware-model-loading).Review and merge #219 first; this PR intentionally targets that feature branch rather than
main.Summary
This PR extends Flow-Factory with finite-data SFT and offline DPO while preserving the existing
online RL and distillation paths. The final architecture keeps acquisition, dataset schema,
pipeline semantics, model-specific condition/output transforms, and algorithm objectives as
separate contracts.
DistributedSamplerfor offline training;typeand add an optional input-only semanticslotfor bindings such as first/last frame;across SFT target binding and all offline-DPO chosen/rejected policy/reference forwards;
model-specific layouts; and
Public SFT and offline-DPO smoke datasets
Two independent public, ungated CC0 mini datasets make the offline rows reproducible without
checking media assets into this repository:
pinned at
50e7f0e897ed2ce4160b14340fc8a982fe6c6919;pinned at
b6ec289238eefdd6c855b7fb8f87ccc80ee3040f.Each repository contains 32 deterministic records for each of the 10 main semantic modes plus the
supplemental
image-i2icontract gate. The checked-in builder reconstructs all procedural media,the publisher validates the complete staging tree before any Hub mutation, and the preparer
materializes exactly two rank-local batches from immutable revisions. Input conditions and outputs
reuse the official ordered
PipelineIOContract; current assets cover image, video, and ordered(video, audio)outputs, while the schema remains compatible with a future audio-only adapter.No target/chosen/rejected VAE latent is cached.
The final remote revisions are public and non-gated; sampled manifests are byte-identical to the
deterministic build and exercise the released
diffusers==0.40.0contract.Model and workflow coverage
Wan
accept exactly
first_frame, dedicated FLF2V requires both endpoints, and Wan2.2 I2V-A14B alsosupports an optional VAE-only
last_frame.offline-DPO arms.
LTX2
(video, audio)target codecs, including LTX 2.3.objective reduction.
and excludes it from the active loss region.
generation round trip.
MiniMax H3
(video, audio)output contract.first_frame,last_frame, or both; last-only input is not conflated with afirst-frame positional shorthand.
image or video.
candidates and model scopes.
data-ward velocity convention remain adapter-owned.
Real-weight GPU validation completed
The complete dynamic smoke scope retains successful terminal evidence for 144/144 unique jobs:
The main matrix used DDP, DeepSpeed ZeRO-2, and FSDP2 with GRPO, SFT, offline DPO, and TDM.
Every semantic mode completed all 12 backend/algorithm cells:
sd35-t2istabilityai/stable-diffusion-3.5-mediumbagel-mri2iByteDance-Seed/BAGEL-7B-MoTwan-t2vWan-AI/Wan2.1-T2V-1.3B-Diffuserswan-i2v-firstWan-AI/Wan2.2-TI2V-5B-Diffuserswan-flf2vWan-AI/Wan2.1-FLF2V-14B-720P-diffusersltx2-t2avLightricks/LTX-2ltx2-i2avLightricks/LTX-2h3-t2vaMiniMaxAI/MiniMax-H3h3-fl2vaMiniMaxAI/MiniMax-H3h3-ref2vaMiniMaxAI/MiniMax-H3All 144 jobs retain successful multi-rank, real-weight training evidence and completed the intended
smoke length: two acquisition/training cycles for GRPO/TDM or two rank-local finite-loader batches
for SFT/offline DPO. Enhanced finite-loss/gradient, component-update, and route evidence was
captured for the instrumented subset, including all six strict A14B gates. Some earlier direct-run
logs predate the full command/environment/metrics artifact contract; missing historical fields
remain disclosed as gaps and were not backfilled.
Variant and optimizer gates
endpoint routing (4, including two corrected redundant executions of the dedicated FLF2V
checkpoint),
dg845/LTX-2.3-DiffusersT2AV (2) and I2AV (2), and H3 FL2VAfirst-plus-last (2).
both sides of the timestep boundary.
loading.
These are reduced-geometry, finite-length execution smokes. They establish archived real-weight
execution coverage across loading, distributed backends, model-specific conditioning, structured
image/video/audio-video paths, optimizers, and finite-data termination; the instrumented strict
gates provide deeper routing/update evidence where required. They do not claim that every
historical log contains the full formal artifact set, nor do they claim long-run convergence,
reward improvement, visual/audio quality parity, or numerical parity.
The executable matrix contract and acceptance criteria are documented in
guidance/gpu_validation.md.Final merge review
skills were reconciled with the current execution/runtime contracts.
pinned Diffusers contract.
anchors resolve. Changed-file formatting/import checks, compilation, and diff hygiene passed.
Review notes
reference rounds remain a separate fail-fast stress case.
use_orig_params=True.