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
Fix warnings during GAN training #3334
base: master
Are you sure you want to change the base?
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of changing things to store in the Learner, let's instead rename to avoid name conflicts. I suggest adding a gan_
prefix as shown. You'll also need to update the usages of these names throughout the class to add the prefix. Many thanks for your PR!
fastai/vision/gan.py
Outdated
@@ -148,8 +148,8 @@ def _set_trainable(self): | |||
|
|||
def before_fit(self): | |||
"Initialize smootheners." | |||
self.generator,self.critic = self.model.generator,self.model.critic | |||
self.gen_mode = self.gen_first | |||
self.learn.generator,self.learn.critic = self.model.generator,self.model.critic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.learn.generator,self.learn.critic = self.model.generator,self.model.critic | |
self.gan_generator,self.gan_critic = self.model.generator,self.model.critic |
fastai/vision/gan.py
Outdated
self.generator,self.critic = self.model.generator,self.model.critic | ||
self.gen_mode = self.gen_first | ||
self.learn.generator,self.learn.critic = self.model.generator,self.model.critic | ||
self.learn.gen_mode = self.gen_first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.learn.gen_mode = self.gen_first | |
self.gan_gen_mode = self.gen_first |
My apologies for the late reply. I was too busy last weeks and could not find free time to update and check my patch. |
This issue is described in #3222
According to Callback documentation "Callbacks provide a shortcut to avoid having to write self.learn.bla for any bla attribute we seek; instead, just write self.bla. This only works for getting attributes, not for setting them."