-
Notifications
You must be signed in to change notification settings - Fork 988
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
latent padding training and inference different #660
Comments
pipeline里的代码由于一些历史原因写起来有点啰嗦,建议以training的代码作为参考。虽然实现方式有区别,但是最后的结果都是一样的。 |
可是inference的看起來比較合理,因為這樣image_latents的每一個latent才會跟video latent 對齊 |
@cdfan0627 看下面的推理代码。推理时num_frames已经提前算好了,肯定会整除patch_size_t的,所以不会触发补第一个frame的代码逻辑。 |
@JaywongWang 你可能要進去 |
@cdfan0627 image_latent是按照num_frames来pad的,保证了 image_latents.size(1) % self.transformer.config.patch_size_t 一定是0 |
@cdfan0627 否则如果触发这段代码,推理出来的结果肯定就不正常了。 |
@JaywongWang 在padding_shape裡面num_frames會減1,所以 |
@cdfan0627 我print出来,49/81帧的输入,余数是0的。你也可以试试。 |
@cdfan0627 减一是因为输入本身就是一张图了,padding后会变成num_frames的长度。 |
@JaywongWang 你是對的,很抱歉我當初在trace code的時候有弄錯,非常謝謝糾正。只是我覺得如果按照余数是0會導致image latent除了first frame latent 是 image 以外其他都是 0 tensor,然後inference的code最後又會有 |
@cdfan0627 仔细对比了下代码,确实像你说的这样。不过丢additional_frames这一步,是在denoised latent上做的,可能影响也不大,从逻辑上看,可能是少解码了第一帧? |
@JaywongWang 我覺得應該就是像你說的一樣少解码了第一帧,謝謝。 |
@cdfan0627 好的不客气的。 |
@cdfan0627 我仔细想了一下,因为video latent本身包含了首帧,并且又添加了additional_frames(所以video latent包含了2个首帧),所以denoised latent丢掉additional frames后,尽管image latent的部分丢掉了,但video latent里面还有首帧的信息。 |
您好,請問為什麼在CogvideoX 1.5 I2V model training的時候是先補齊latent的shape然後再對image latent 做padding,如下code 是 lora_trainer.py
inference的時候卻對image latent做padding後,再補上第一個frame,如下code是pipeline_cogvideox_image2video.py
理論上training跟inference應該要一樣,inference出來的結果才會正確的,所以想請問一下training跟inference哪個是對的呢
The text was updated successfully, but these errors were encountered: