Skip to content

Cyclical learning rates broken in TFA 0.8.2 #1158

@lcsfrey

Description

@lcsfrey

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
    Windows 10.0.16299 Build 16299
  • TensorFlow version and how it was installed (source or binary):
    2.1.0 installed via pip
  • TensorFlow-Addons version and how it was installed (source or binary):
    0.8.2 installed via pip
  • Python version:
    3.6.8
  • Is GPU used? (yes/no):
    no

Code to reproduce the issue

from tensorflow_addons.optimizers import cyclical_learning_rate

callback = cyclical_learning_rate.ExponentialCyclicalLearningRate(
    initial_learning_rate=1e-8,
    maximal_learning_rate=1e-2,
    step_size=100,
)

Other info / logs
Stack trace:

Traceback (most recent call last):
  File "tfa_error.py", line 6, in <module>
    step_size=100,
  File "C:\dev\anaconda3\envs\lamro\lib\site-packages\typeguard\__init__.py", line 808, in wrapper
    memo = _CallMemo(python_func, _localns, args=args, kwargs=kwargs)
  File "C:\dev\anaconda3\envs\lamro\lib\site-packages\typeguard\__init__.py", line 93, in __init__
    self.arguments = self.signature.bind(*args, **kwargs).arguments
  File "C:\dev\anaconda3\envs\lamro\lib\inspect.py", line 2997, in bind
    return args[0]._bind(args[1:], kwargs)
  File "C:\dev\anaconda3\envs\lamro\lib\inspect.py", line 2968, in _bind
    format(arg=param_name)) from None
TypeError: missing a required argument: 'scale_fn'

The issue was caused by commit f42ca1dd7487c237b8adbc5014d5a54af5c7e4e2 which added type hints to the cyclic learning rates module. An additional scale_fn argument was copied over from the base CyclicalLearningRate class to its subclasses despite the subclasses not needing that argument.

image
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions