mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-31 02:02:21 +06:00
Editing issue with pickle def with lambda function (#23869)
* Editing issue with pickle def with lambda function * fix type * Made helper function private * delete tab --------- Co-authored-by: georgebredis <9454-georgebredis@users.noreply.gitlab.aicrowd.com>
This commit is contained in:
parent
af2aac51fc
commit
6451ad0471
@ -32,6 +32,10 @@ from .utils.versions import require_version
|
||||
logger = logging.get_logger(__name__)
|
||||
|
||||
|
||||
def _get_constant_lambda(_=None):
|
||||
return 1
|
||||
|
||||
|
||||
def get_constant_schedule(optimizer: Optimizer, last_epoch: int = -1):
|
||||
"""
|
||||
Create a schedule with a constant learning rate, using the learning rate set in optimizer.
|
||||
@ -46,7 +50,7 @@ def get_constant_schedule(optimizer: Optimizer, last_epoch: int = -1):
|
||||
`torch.optim.lr_scheduler.LambdaLR` with the appropriate schedule.
|
||||
"""
|
||||
|
||||
return LambdaLR(optimizer, lambda _: 1, last_epoch=last_epoch)
|
||||
return LambdaLR(optimizer, _get_constant_lambda, last_epoch=last_epoch)
|
||||
|
||||
|
||||
def get_reduce_on_plateau_schedule(optimizer: Optimizer):
|
||||
|
Loading…
Reference in New Issue
Block a user