Self-Forcing / trainer /__init__.py
Cccccz's picture
Add files using upload-large-folder tool
510ab6b verified
Raw
History Blame Contribute Delete
972 Bytes
"""Trainer exports loaded on demand.
Keeping this package initializer dependency-free lets the standalone
Predictor-v4 path run without importing the legacy wandb-based trainers.
"""
from __future__ import annotations
from importlib import import_module
_EXPORTS = {
"DiffusionTrainer": ("trainer.diffusion", "Trainer"),
"GANTrainer": ("trainer.gan", "Trainer"),
"ODETrainer": ("trainer.ode", "Trainer"),
"ScoreDistillationTrainer": ("trainer.distillation", "Trainer"),
"PredictorV4Trainer": ("trainer.predictor_v4", "Trainer"),
"PredictorV4RolloutTrainer": ("trainer.predictor_v4_rollout", "Trainer"),
"PredictorV4DMDTrainer": ("trainer.predictor_v4_dmd", "Trainer"),
}
__all__ = list(_EXPORTS)
def __getattr__(name: str):
if name not in _EXPORTS:
raise AttributeError(name)
module_name, attribute = _EXPORTS[name]
value = getattr(import_module(module_name), attribute)
globals()[name] = value
return value