(cfg)
| 125 | |
| 126 | |
| 127 | def build_scheduler(cfg): |
| 128 | if cfg.name == "constant_with_warmup": |
| 129 | return ConstantWithWarmupScheduler(t_warmup=cfg.t_warmup) |
| 130 | elif cfg.name == "cosine_with_warmup": |
| 131 | return CosineAnnealingWithWarmupScheduler(t_warmup=cfg.t_warmup, alpha_f=cfg.alpha_f) |
| 132 | elif cfg.name == "linear_decay_with_warmup": |
| 133 | return LinearWithWarmupScheduler(t_warmup=cfg.t_warmup, alpha_f=cfg.alpha_f) |
| 134 | elif cfg.name == "warmup_stable_decay": |
| 135 | return WarmupStableDecayScheduler(t_warmup=cfg.t_warmup, alpha_f=cfg.alpha_f) |
| 136 | else: |
| 137 | raise ValueError(f"Not sure how to build scheduler: {cfg.name}") |
| 138 | |
| 139 | |
| 140 | def build_optimizer(cfg, model): |
no test coverage detected