MCPcopy Create free account
hub / github.com/AnswerDotAI/ModernBERT / build_scheduler

Function build_scheduler

sequence_classification.py:127–137  ·  view source on GitHub ↗
(cfg)

Source from the content-addressed store, hash-verified

125
126
127def 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
140def build_optimizer(cfg, model):

Callers 1

trainFunction · 0.70

Calls 1

Tested by

no test coverage detected