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

LatentQuantize exploding loss #151

Open
jbmaxwell opened this issue Aug 1, 2024 · 2 comments
Open

LatentQuantize exploding loss #151

jbmaxwell opened this issue Aug 1, 2024 · 2 comments

Comments

@jbmaxwell
Copy link

jbmaxwell commented Aug 1, 2024

I'm trying to use the LatentQuantize model in an autoencoder context. My inputs are flat 1-d tensors (32) and my encoder passes a shape of (batch_size, 64) to the quantizer. For now, my "levels" is [8, 6, 4], my latent_dim is 64:

self.lq = LatentQuantize(
            levels=levels,
            dim=latent_dim,
            commitment_loss_weight=0.1,
            quantization_loss_weight=0.1,
        )

The loss starts at zero, then exponentially increases:
Screenshot 2024-08-01 at 1 53 43 PM

Any thoughts as to why this might happen?

@lucidrains
Copy link
Owner

someone actually pull requested this in and i'm unfamiliar with it

does the reconstruction loss look good?

@jbmaxwell
Copy link
Author

Well, actually, I've just discovered that it seems to be an LR thing...

Screenshot 2024-08-01 at 2 29 56 PM

zooming in on first 10k steps:

Screenshot 2024-08-01 at 2 29 26 PM

But recon seems to converge pretty steadily. So maybe just a false alarm. I still have to wrap my head around how LatentQuantize works (and how to get what I want), mind you!

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

2 participants