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

AttributeError: 'tuple' object has no attribute 'betas' #186

Open
UmamaheswariRm opened this issue Aug 22, 2022 · 4 comments
Open

AttributeError: 'tuple' object has no attribute 'betas' #186

UmamaheswariRm opened this issue Aug 22, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@UmamaheswariRm
Copy link

training configuration

noise_dim = 32
dim = 128
batch_size = 16

log_step = 200
epochs = 10000+1
learning_rate = 5e-5

beta_1 = 0.5
beta_2 = 0.9

betas = (beta_1, beta_2)

models_dir = 'my_model_datasetB/'

data_dim = data_train.shape[1]
print('Shape of data: ', data_train.shape)
#Define the GAN and training parameters
#'batch_size', 'lr', 'betas', 'layers_dim', 'noise_dim','n_cols', 'seq_len', 'condition', 'n_critic', 'n_features', 'tau_gs'
gan_args = (batch_size, learning_rate, betas, noise_dim, data_dim, dim)
train_args = ('', epochs, log_step)

#Training the GAN model chosen: Vanilla GAN, CGAN, DCGAN, etc.
synthesizer = WGAN_GP(gan_args, n_critic=2)
synthesizer.train(data_train, train_args)

AttributeError Traceback (most recent call last)
in
1 #Training the GAN model chosen: Vanilla GAN, CGAN, DCGAN, etc.
----> 2 synthesizer = WGAN_GP(gan_args, betas)
3 synthesizer.train(data_train, train_args)

2 frames
/usr/local/lib/python3.7/dist-packages/ydata_synthetic/synthesizers/regular/wgangp/model.py in init(self, model_parameters, n_critic, gradient_penalty_weight)
24 self.n_critic = n_critic
25 self.gradient_penalty_weight = gradient_penalty_weight
---> 26 super().init(model_parameters)
27
28 def define_gan(self, activation_info: Optional[NamedTuple] = None):

/usr/local/lib/python3.7/dist-packages/typeguard/init.py in wrapper(*args, **kwargs)
1031 memo = _CallMemo(python_func, _localns, args=args, kwargs=kwargs)
1032 check_argument_types(memo)
-> 1033 retval = func(*args, **kwargs)
1034 try:
1035 check_return_type(retval, memo)

/usr/local/lib/python3.7/dist-packages/ydata_synthetic/synthesizers/gan.py in init(self, model_parameters)
52 pass
53 #Validate the provided model parameters
---> 54 if model_parameters.betas is not None:
55 assert len(model_parameters.betas) == 2, "Please provide the betas information as a tuple."
56

AttributeError: 'tuple' object has no attribute 'betas'

When I run the above code, I am getting attribute error. I tried giving as a list, still the same error persists. I noticed the message "Please provide the betas information as a tuple." How do I fix this error? Please help me.

@fabclmnt fabclmnt added the bug Something isn't working label May 16, 2023
@fabclmnt
Copy link
Contributor

fabclmnt commented May 16, 2023

Hi @UmamaheswariRm,

can you please share what version of the package are you using? Have your tried this with the most recent version of the package?

@fabclmnt fabclmnt added bug Something isn't working and removed bug Something isn't working labels May 16, 2023
@yameima
Copy link

yameima commented Nov 15, 2023

hello,may I ask how did you finally solve this problem, I have the same problem

@moonastar
Copy link

hello, I also have the same problem, do you solve this problem?

@moonastar
Copy link

the version of the package is 1.3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants