[Bugfix] Fix various bugs in multi-modal processor (#12031)

Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
Cyrus Leung
2025-01-14 20:16:11 +08:00
committed by GitHub
parent ff39141a49
commit bb354e6b2d
3 changed files with 69 additions and 58 deletions

View File

@@ -421,6 +421,8 @@ def test_find_replace_tokens(
"pattern_1": [32000, 32000],
"pattern_2": [],
"pattern_3": [1550, 918, 1550],
# Test different modalities having the same tokens (32000)
"pattern_4": [32000],
},
],
)
@@ -438,6 +440,14 @@ def test_find_replace_tokens(
replacement=[32000, 32000],
),
],
"pattern_4": [
PlaceholderInfo(
modality="pattern_4",
item_idx=0,
start_idx=3,
replacement=[32000],
),
],
}
),
@@ -466,6 +476,7 @@ def test_find_replace_tokens(
replacement=[1550, 918, 1550],
),
],
# No match for pattern_4 as it has lower priority than pattern_1
}
),
(
@@ -485,6 +496,14 @@ def test_find_replace_tokens(
replacement=[32000, 32000],
),
],
"pattern_4": [
PlaceholderInfo(
modality="pattern_4",
item_idx=0,
start_idx=5,
replacement=[32000],
),
],
"pattern_3": [
PlaceholderInfo(
modality="pattern_3",