PKU-YuanGroup / Chat-UniVi

[CVPR 2024 Highlight🔥] Chat-UniVi: Unified Visual Representation Empowers Large Language Models with Image and Video Understanding
https://arxiv.org/abs/2311.08046
Apache License 2.0
862 stars 44 forks source link

dpc implementation #40

Open ReactiveCJ opened 5 months ago

ReactiveCJ commented 5 months ago

In the implementation of dpc algorithm, for code of this line, as we know the size of dist_matrix is B N N, because we want to get the max distance of each token, but if we flat the dist_matrix, we will only get the max distance of each batch. dist_max = dist_matrix.flatten(1).max(dim=-1)[0][:, None, None]

we can change the code to dist_max = dist_matrix.max(dim=-1)[0][:, :, None]

jpthu17 commented 5 months ago

Thanks for your code. I'll go over my previous code tomorrow.