Open elvisnava opened 1 year ago
@elvisnava Thank you very much for pointing this out. To be honest, the code in this repository is based on an earlier release by the author in the OpenReview as Supplementary Material [the zip file].
Your point has shown me that I have been performing the calculations in the wrong dimension. Furthermore, there seems to be a similar problem in the official implementation published by the author: https://github.com/weixi-feng/Structured-Diffusion-Guidance/blob/master/scripts/txt2img_demo.py#L159-L167.
Also, thank you for pointing out the problem of a possible lack of alignment between tokens and spans. This appears to be handled properly by the official implementation, and we will incorporate it into our pipeline with reference to that implementation.
I will be fixing this issue as soon as I can. Thank you very much for pointing this out to me.
Thank you for your response. I believe that in the original code, the original dimensions of seq
and full_seq
are meant to be (B, 77, 768), with B being the batch size. Then, the transpose operation would successfully operate on the sequence dimension (77).
I would advise anyone against using this implementation until these issues are fixed.
In the function for sequence alignment (but the same can be said about
_expand_sequence
), we have:which is supposed to replace embeddings in
full_seq
(77,768) betweenstart
andend
with the ones fromseq
. However, a transpose operation is first performed, makingfull_seq
have a shape of (768,77), which makes the assignmentfull_seq[start:end]
be over the wrong dimension. Similarly,seq
is also addressed wrongly.Moreover, I believe the calculation of spans to also be incorrect, as it considers words without considering the possibility of a word being broken into multiple tokens. In the repository of the paper author, this function
is used to perform this mapping between word spans and token spans.