I need help with my WGAN network

oscar1: <p>Hello everyone, this is my first time in the forum.<br>
I have a problem with my code. Me and a friend are try make a DCGAN and DCWGAN basic to compared between them.</p>
<p>We use the DCGAN pythorch code example of oficial page and it is work perfectly<br>
Now we try modify this code to make a DCWGAN vercion, but we have many problems. This actual version generate very bads imagen. I’ve been trying to fix it for days, but I can’t find anything better. Can you help me? If can you tell me what are doing bad I’m ok.</p>
<p>I uploaded my code to collab, the code should work correctaly and download the dataset without problem.</p>
<p>If you can tell us improvements so that the training goes faster and better or variables to visualize that it is going well, please tell us.<br>
Reminder that we want a basic WGAN, we want to leave things like GP for later</p>
<p>Thank you so much =)</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://colab.research.google.com/drive/1q4IABv3q3W6exAo_HHVCRYCqv673Fcqn?usp=sharing">
  <header class="source">
      <img src="https://ssl.gstatic.com/colaboratory-static/common/3a077359378273b5fabaa492f7d1440c/img/favicon.ico" class="site-icon" width="128" height="128">

      <a href="https://colab.research.google.com/drive/1q4IABv3q3W6exAo_HHVCRYCqv673Fcqn?usp=sharing" target="_blank" rel="noopener nofollow ugc">colab.research.google.com</a>
  </header>

  <article class="onebox-body">
    <img width="260" height="260" src="https://colab.research.google.com/img/colab_favicon_256px.png" class="thumbnail onebox-avatar">

<h3><a href="https://colab.research.google.com/drive/1q4IABv3q3W6exAo_HHVCRYCqv673Fcqn?usp=sharing" target="_blank" rel="noopener nofollow ugc">Google Colab</a></h3>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>


oscar1: <aside class="quote no-group" data-username="jerry4422cherry" data-post="2" data-topic="210952">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/j/90db22/48.png" class="avatar"> jerry4422cherry:</div>
<blockquote>
<p>Improvements for Faster and Better Training:<br>
Learning Rate Scheduling:</p>
<p>Consider using a learning rate scheduler to adjust the learning rate dynamically.<br>
Use of Adam Optimizer:</p>
<p>Ensure you’re using the Adam optimizer with appropriate parameters. A common choice is betas=(0.5, 0.999).<br>
Gradient Penalty:</p>
<p>While you want to avoid using gradient penalty (GP) for now, keep in mind that it’s a good idea to implement it later for improved stability.<br>
Monitoring Training:</p>
<p>Log the critic and generator losses during training. You can also visualize generated images at intervals to check the quality of generated samples.<br>
Normalization:</p>
<p>Ensure your input data is properly normalized, typically to the range [-1, 1] for images.<br>
Epochs and Checkpoints:</p>
<p>Train for a sufficient number of epochs and save model checkpoints to resume training or experiment with different settings.<br>
Visualization:<br>
You can visualize losses using libraries like Matplotlib. Here’s a quick snippet:</p>
<p>import matplotlib.pyplot as plt</p>
<p>plt.plot(losses_critic, label=‘Critic Loss’)<br>
plt.plot(losses_generator, label=‘Generator Loss’)<br>
plt.legend()<br>
plt.show()</p>
</blockquote>
</aside>
<p>Hello, thanks for responding but I have already applied everything you say before, if you review the code in Collab that happened you will be able to see:<br>
# Weight clipping<br>
for p in netD.parameters():<br>
p.data.clamp_(-0.01, 0.01) # Limit the weights in the range [-0.01, 0.01]<br>
The loss function errD = errD_fake - errD_real<br>
and the number of criticalis # Number of critical<br>
n_critic = 10</p>
<p>And what the hell is this about NYStateofHealth?<br>
NY State of Health login refers to a separate website where individuals sign up for health insurance policies while the Health Commerce System is designed specifically for providers. Nothing to do with what we are doing.</p>
<p>Additionally, the WGAN optimizer that is usually used is RMSprop. This is because Adam, although more popular in other neural network contexts, does not always perform well in WGAN due to the particular optimization dynamics of the Wasserstein loss.</p>
<p>This is a ChatGPT answer right? (-_-)</p>

ptrblck: <aside class="quote no-group" data-username="oscar1" data-post="3" data-topic="210952">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/oscar1/48/73081_2.png" class="avatar"> oscar1:</div>
<blockquote>
<p>And what the hell is this about NYStateofHealth?<br>
NY State of Health login refers to a separate website where individuals sign up for health insurance policies while the Health Commerce System is designed specifically for providers. Nothing to do with what we are doing.</p>
</blockquote>
</aside>
<aside class="quote no-group" data-username="oscar1" data-post="3" data-topic="210952">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/oscar1/48/73081_2.png" class="avatar"> oscar1:</div>
<blockquote>
<p>This is a ChatGPT answer right? (-_-)</p>
</blockquote>
</aside>
<p>Yes, unfortunately we are seeing a lot of bots posting unhelpful ChatBot responses and edit a spam link afterwards to their responses.<br>
We are usually fast in deleting these, but missed this post, so please ignore these responses as they are usually not really helpful.</p>

oscar1: <p>Don’t worry, thank you very much for the information. It’s a shame that Chatgpt is being used for these things.</p>