CogVideo icon indicating copy to clipboard operation
CogVideo copied to clipboard

想请教一下论文中的3D full attention的实现具体在哪里呢?

Open woshipapa opened this issue 1 year ago • 3 comments

看到paper中提出了3D full attention和2D+1D attention的对比,并实验证明说生成视频的效果更好。论文中也提到可以用多种并行策略优化,想请教一下这部分有开源的代码吗

woshipapa avatar Nov 06 '24 05:11 woshipapa

3D full attention和2D+1D可以理解为patch化的方式不一样吧,3D full就是直接3个维度全都patch了,一个patch就是221(hwt),分开attention是分别保留了时间和空间维度信息的。

DidiD1 avatar Nov 06 '24 09:11 DidiD1

3D full attention就是对整个序列做attention,时空分离的attention是指同一帧内部(空间)做attention或所有帧同一个位置(时间)做attention

yzy-thu avatar Nov 06 '24 16:11 yzy-thu

3D full attention就是对整个序列做attention,时空分离的attention是指同一帧内部(空间)做attention或所有帧同一个位置(时间)做attention

3d 请问是这里吗,在padding_embedding这边

woshipapa avatar Nov 08 '24 09:11 woshipapa

你可以进行调试,假设tensor shape是(b,f,h,w)。之前的工作通常(b * f,h * w)进行spatial attention ,(b * h * w,f)进行temporal attentio。而在cogvideox是(b,f * h * w)的3d full attention。以10 * 480 * 720为例,他的attention map是(2,48,3* 30* 45+226,3* 30* 45+226),其中2是batch,48是head,3是进过3dvae缩减的frame个数,30和45是attention map长宽,226是text emb长度。我写了一份可视化cogvideox中3d full attention map的代码,感兴趣可以star使用一下。https://github.com/YibooZhao/cogvideox_vis_attention

YibooZhao avatar Nov 18 '24 07:11 YibooZhao

你可以进行调试,假设tensor shape是(b,f,h,w)。之前的工作通常(b * f,h * w)进行spatial attention ,(b * h * w,f)进行temporal attentio。而在cogvideox是(b,f * h * w)的3d full attention。以10 * 480 * 720为例,他的attention map是(2,48,3* 30* 45+226,3* 30* 45+226),其中2是batch,48是head,3是进过3dvae缩减的frame个数,30和45是attention map长宽,226是text emb长度。我写了一份可视化cogvideox中3d full attention map的代码,感兴趣可以star使用一下。https://github.com/YibooZhao/cogvideox_vis_attention

多谢哥们

woshipapa avatar Nov 18 '24 07:11 woshipapa