mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-01 18:51:14 +06:00
commit
db4dccd1b5
@ -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 BertAdam) training steps.
|
""" Linearly increases learning rate over `warmup`*`t_total` (as provided to BertAdam) training steps.
|
||||||
|
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user