Comments (6)
With a bit more research, it comes from the call of optimizer.step() here
disentangling-vae/disvae/models/losses.py
Line 283 in 535bbd2
commenting it out works fine, but then how to do the optimization step of the model before training the discriminator?
from disentangling-vae.
This seems to be an issue with pytorch > 1.4 (e.g. pytorch/pytorch#39141 (comment) )
I.e. I'm currently modifying the weights before finishing computing the gradients, which is not allowed from pytorch 1.5.
I see 2 possibilities:
- downgrading to 1.4. Probably the quickest for now.
- moving VAE optimization right before discriminator optimization. I believe this should work, but I have to test it.
from disentangling-vae.
It should work now with Pytorch 1.7 (I only tested factor_mnist). Let me know if it doesn't and thank you for pointing the issue.
from disentangling-vae.
All good it works now, but doesn't it change the optimization dynamics ? Since now model parameters are not updated via optimizer.step() before latent_sample2 = model.sample_latent(data2) is called
from disentangling-vae.
I believe that it does slightly change the dynamics (in that the discriminator now tries to discriminate sample from "the previous step" but that shouldn't make a big difference). I don't see how to bypass that "issue" without computing the first sample twice (once for each optimizer)... But if you have a better suggestion I'm happy to change that.
What is important is that the gradient computation is correct, and I think it is because we are detaching the second sample z_perm = _permute_dims(latent_sample2).detach()
and so no gradients flow in the VAE when computing the gradients for the discriminator.
from disentangling-vae.
OK thanks for the quick reply !
from disentangling-vae.
Related Issues (20)
- Low MIG and AAM metrics HOT 6
- negetive total correlation loss for btc-vae HOT 5
- Error in losses explanation? HOT 2
- Readme Losses Explanation
- Training not using GPU HOT 2
- TC-BetaVAE's MSS Question
- Doubts about the calculation of H_z HOT 6
- Why is tc_loss in bTCVAE negative? HOT 11
- FashionMNIST background_color not set
- Computing MIG and AAM for other datasets HOT 3
- Low MIG values bug found & solution HOT 3
- PlotNeuralNet Code HOT 2
- evaluate.py compute_losses?
- Minor bug in loss logging HOT 1
- Which paper does Axis Alignment Metric publish? HOT 1
- How can I apply it to my own dataset? HOT 2
- Duplicating hyperparameters when training a FactorVAE
- imageio.mimsave error HOT 1
- Dataset with incomplete combinations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from disentangling-vae.