taming-transformers icon indicating copy to clipboard operation
taming-transformers copied to clipboard

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

Open JJJYmmm opened this issue 1 year ago • 2 comments
trafficstars

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?

JJJYmmm avatar Mar 26 '24 12:03 JJJYmmm

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.

srasoulzadeh avatar Sep 03 '24 14:09 srasoulzadeh

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!

JJJYmmm avatar Sep 07 '24 15:09 JJJYmmm