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

About the Generator and Discriminatror #8

Open
Fly2flies opened this issue Dec 8, 2019 · 2 comments
Open

About the Generator and Discriminatror #8

Fly2flies opened this issue Dec 8, 2019 · 2 comments

Comments

@Fly2flies
Copy link

Hello,
I'm a fresh man for the pytorch and GAN. Thanks for you to share such a good implementation. But I'm confused about your training procesure about the G & D. To my best knownledge, the D should try to identify different modalities, while the G do oppsite. Meanwhile, they should be trained respectively and alternately. But as your code:

if epoch%K:
            loss_total = loss_G - gamma*loss_D
        else:
            loss_total = nu*(gamma*loss_D - loss_G)

        loss_total.backward()
        optimizer.step()

The G and D are trained simultaneously, which casued the loss of D become very high while G is being trained, and then the training of G become unstable because of the big loss of D when it's D's turn.
When I try to apply the framework to other work, the loss become Nan quickly. So the training process cannot continue.Is there something wrong with my idea, or the codes.
Another confusion is that adding the L2 regularization is a neccesary for avoiding overfitting?
Looking forward your reply.

Thanks.

@prismformore
Copy link

@EternallyTruth From my personal experience, there is something wrong with the code, and could not converge even after the bugs fixed. Good luck.

@jiangyanjavawin
Copy link

Hello,
I'm a fresh man for the pytorch and GAN. Thanks for you to share such a good implementation. But I'm confused about your training procesure about the G & D. To my best knownledge, the D should try to identify different modalities, while the G do oppsite. Meanwhile, they should be trained respectively and alternately. But as your code:

if epoch%K:
            loss_total = loss_G - gamma*loss_D
        else:
            loss_total = nu*(gamma*loss_D - loss_G)

        loss_total.backward()
        optimizer.step()

The G and D are trained simultaneously, which casued the loss of D become very high while G is being trained, and then the training of G become unstable because of the big loss of D when it's D's turn.
When I try to apply the framework to other work, the loss become Nan quickly. So the training process cannot continue.Is there something wrong with my idea, or the codes.
Another confusion is that adding the L2 regularization is a neccesary for avoiding overfitting?
Looking forward your reply.

Thanks.

Hello,have you solved the issue?

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

3 participants