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 modeling/blocks.py #17

Open
JJJYmmm opened this issue Jul 18, 2024 · 3 comments
Open

About modeling/blocks.py #17

JJJYmmm opened this issue Jul 18, 2024 · 3 comments

Comments

@JJJYmmm
Copy link

JJJYmmm commented Jul 18, 2024

N, C, H, W = z_quantized.shape
assert H == 1 and W == self.num_latent_tokens, f"{H}, {W}, {self.num_latent_tokens}"
x = z_quantized.reshape(N, C*H, W).permute(0, 2, 1) # NLD

I think line 201 should be x = z_quantized.reshape(N, C, H*W).permute(0, 2, 1)

@JJJYmmm
Copy link
Author

JJJYmmm commented Jul 18, 2024

another issue is #16

@JJJYmmm
Copy link
Author

JJJYmmm commented Jul 18, 2024

I'm also confused about two-stage training, does the current code only contains the content of stage1? Because the TikTok decoder can't decode tokens without pixel_decoder(from maskgit)

def decode(self, z_quantized):
decoded_latent = self.decoder(z_quantized)
quantized_states = torch.einsum(
'nchw,cd->ndhw', decoded_latent.softmax(1),
self.pixel_quantize.embedding.weight)
decoded = self.pixel_decoder(quantized_states)
return decoded

@JJJYmmm
Copy link
Author

JJJYmmm commented Jul 18, 2024

elif len(indices.shape) == 2:
z_quantized = torch.einsum('bd,dn->bn', indices, self.embedding.weight)

enisum here is also weird, embedding.weight's shape should be nd

Sorry for so many issues :)

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

1 participant