modelopt.torch.distill.bypass#

bypass(student, teacher, train_dataloader, config=None, *, validation_dataloader=None, device_mesh=None)#

Optimize IQ native scales on streamed frozen teacher boundary inputs.

Parameters:
  • student (Module) – Existing ModelOpt IQ PTQ model; frozen formats may coexist.

  • teacher (Module) – Separate original-weight callable with matching boundary paths.

  • train_dataloader – Unique sample batches that exactly fill each global update. Dict batches accept boolean/integer valid_mask or loss_mask, in that order, with nonzero meaning valid rather than a token weight. Otherwise, attention_mask must be 2D boolean/integer. Floating or 4D attention masks require an explicit validity mask. Weighted masks are unsupported; other metadata does not define the loss mask.

  • config – A BypassConfig, a dict, or None for the established defaults.

  • validation_dataloader – Optional held-out batches for finalized-student valid-token MSE. Diagnostic failures propagate after committing training updates to the student. Zero-step preflight skips validation as well as training.

  • device_mesh – Caller-owned placement mesh, adopted by supported integrations.

Returns:

The supplied student, finalized for ordinary ModelOpt save/export. Temporary fields, hooks, modes and gradient flags are restored on every exit.

Return type:

Module