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

How to distinguish sos token(default = 0) and quantified image token zero ? #242

Open
JJJYmmm opened this issue Mar 26, 2024 · 2 comments
Open

Comments

@JJJYmmm
Copy link

JJJYmmm commented Mar 26, 2024

Since the transformer take in the quantified image token generated by VQGAN, which codebook has indices (0~n_embed-1), and transformer’s sos token is also set to zero defaultly. Could you tell me why we don't distinguish codebook vector0 and the sos token when training transformer?

@srasoulzadeh
Copy link

This was also my Q as well. I believe the reason is that the transformer uses positional encodings to add information about the position of each token in the sequence. The token at position 0 is always the sos_token, and this positional information helps the model distinguish between the sos_token and the codebook's 0 index.

@JJJYmmm
Copy link
Author

JJJYmmm commented Sep 7, 2024

This was also my Q as well. I believe the reason is that the transformer uses positional encodings to add information about the position of each token in the sequence. The token at position 0 is always the sos_token, and this positional information helps the model distinguish between the sos_token and the codebook's 0 index.

Sounds reasonable!
thx!

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