Refactor(qwen3-vl) optimize position encoding interpolation (#16781)

Signed-off-by: chenzhenyang <andy271828@163.com>
Signed-off-by: chenzhenyang <chenzhenyang@moonshot.cn>
Co-authored-by: chenzhenyang <chenzhenyang@moonshot.cn>
Co-authored-by: zhaochenyang20 <zhaochen20@outlook.com>
This commit is contained in:
aaaandychen
2026-02-05 10:26:35 -08:00
committed by GitHub
co-authored by chenzhenyang zhaochenyang20
parent d22163eb8c
commit 6a4b81e2d9
2 changed files with 126 additions and 25 deletions
+3 -2
View File
@@ -71,9 +71,10 @@ class TestEmbedInterpolate(unittest.TestCase):
norm_eps=1e-6,
prefix="visual",
)
embeddings = model.fast_pos_embed_interpolate(
[(t, s, s) for t, s in zip(t_dim, s_dim)]
grid_thw = torch.tensor(
[(t, s, s) for t, s in zip(t_dim, s_dim)], dtype=torch.int32
)
embeddings = model.fast_pos_embed_interpolate(grid_thw)
embeddings_s0 = embeddings[: s_dim[0] * s_dim[0], :]
embeddings_s1 = embeddings[s_dim[0] * s_dim[0] : 2 * s_dim[0] * s_dim[0], :]