"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "0ae96ff8a7e2d371242452d81bee85da8df202f5"
Commit 19cc2c08 authored by lukovnikov's avatar lukovnikov
Browse files

same

parent 2283dcca
...@@ -26,7 +26,8 @@ logger = logging.getLogger(__name__) ...@@ -26,7 +26,8 @@ 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 OpenAIAdam) training steps. """ Linearly increases learning rate over `warmup`*`t_total` (as provided to OpenAIAdam) 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