Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: __init__() missing 1 required positional argument: 'name' #2

Open
vamsireddy01 opened this issue Jun 24, 2020 · 1 comment

Comments

@vamsireddy01
Copy link

Hi while working East model, I have the following issue with adamw.py

Error I am getting is:
**super(AdamW, self).init(kwargs)
TypeError: init() missing 1 required positional argument: 'name'

Code is as below:
class AdamW(Optimizer):
"""Adam optimizer.
Default parameters follow those provided in the original paper.
# Arguments
lr: float >= 0. Learning rate.
beta_1: float, 0 < beta < 1. Generally close to 1.
beta_2: float, 0 < beta < 1. Generally close to 1.
epsilon: float >= 0. Fuzz factor.
decay: float >= 0. Learning rate decay over each update.
weight_decay: float >= 0. Decoupled weight decay over each update.
# References
- Adam - A Method for Stochastic Optimization
- Optimization for Deep Learning Highlights in 2017
- Fixing Weight Decay Regularization in Adam
"""

def __init__(self,lr=0.001, beta_1=0.9, beta_2=0.999, weight_decay=1e-4, epsilon=1e-8, decay=0., **kwargs):
    super(AdamW, self).__init__(**kwargs)
    with K.name_scope(self.__class__.__name__):
        self.iterations = K.variable(0, dtype='int64', name='iterations')
        self.lr = K.variable(lr, name='lr')
        self.beta_1 = K.variable(beta_1, name='beta_1')
        self.beta_2 = K.variable(beta_2, name='beta_2')
        self.decay = K.variable(decay, name='decay')
        self.wd = K.variable(weight_decay, name='weight_decay') # decoupled weight decay (2/4)
    self.epsilon = epsilon
@zhenglinghan
Copy link

I meet a same problem ,does any one have any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants