Skip to content

Fix warnings during GAN training#3334

Open
AndreyYashkin wants to merge 2 commits into
fastai:masterfrom
AndreyYashkin:master
Open

Fix warnings during GAN training#3334
AndreyYashkin wants to merge 2 commits into
fastai:masterfrom
AndreyYashkin:master

Conversation

@AndreyYashkin

Copy link
Copy Markdown

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."

@AndreyYashkin AndreyYashkin requested a review from jph00 as a code owner April 22, 2021 19:29
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jph00 jph00 left a comment

Copy link
Copy Markdown
Member

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!

Comment thread fastai/vision/gan.py Outdated
"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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.learn.generator,self.learn.critic = self.model.generator,self.model.critic
self.gan_generator,self.gan_critic = self.model.generator,self.model.critic

Comment thread 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.learn.gen_mode = self.gen_first
self.gan_gen_mode = self.gen_first

@AndreyYashkin AndreyYashkin requested a review from jph00 May 14, 2021 17:57
@AndreyYashkin

Copy link
Copy Markdown
Author

My apologies for the late reply. I was too busy last weeks and could not find free time to update and check my patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants