"tests/git@developer.sourcefind.cn:chenpangpang/diffusers.git" did not exist on "f4d3f913f40713cb41485a7f8aab3a31b59e86e6"
Commit bed6408d authored by lukovnikov's avatar lukovnikov
Browse files

branches, optim cosine fix

parent f3e54048
...@@ -26,7 +26,9 @@ logger = logging.getLogger(__name__) ...@@ -26,7 +26,9 @@ logger = logging.getLogger(__name__)
def warmup_cosine(x, warmup=0.002): def warmup_cosine(x, warmup=0.002):
if x < warmup: if x < warmup:
return x/warmup return x/warmup
return 0.5 * (1.0 + torch.cos(math.pi * x))
x_ = (x - warmup) / (1 - warmup) # progress after warmup
return 0.5 * (1. + math.cos(math.pi * x_))
def warmup_constant(x, warmup=0.002): def warmup_constant(x, warmup=0.002):
""" Linearly increases learning rate over `warmup`*`t_total` (as provided to BertAdam) training steps. """ Linearly increases learning rate over `warmup`*`t_total` (as provided to BertAdam) training steps.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment