+20









Zhou Taichang
Claude Opus 4.7
NumberWan
dsinghvi
Dnoob
Yueqian Lin
Hongsheng Liu
knlnguyen1802
Samit
rein yang
Nick Cao
zhumingjue138
Ricardo Noriega
lyj-jjj
Cursor
gcanlin
wangyu
weizhoublue
weizhoublue
dengyunyang
汪志鹏
WeiQing Chen
Jie Liu
Yueqian Lin
NATURE
bjf-frz
amy-why-3459
Y. Fisher
Zeyu Huang | 黃澤宇
Copilot Autofix powered by AI
eb4e60ee64
Signed-off-by: tzhouam <tzhouam@connect.ust.hk> Signed-off-by: Zhou Taichang <tzhouam@connect.ust.hk> Signed-off-by: NumberWan <wantszkin2003@gmail.com> Signed-off-by: Divyansh Singhvi <divyanshsinghvi@gmail.com> Signed-off-by: dsinghvi <divyanshsinghvi@gmail.com> Signed-off-by: Dnoob <dxpouo@gmail.com> Signed-off-by: Yueqian Lin <70319226+linyueqian@users.noreply.github.com> Signed-off-by: knlnguyen1802 <knlnguyen1802@gmail.com> Signed-off-by: rein yang <ruiruyang2@gmail.com> Signed-off-by: Nick Cao <ncao@redhat.com> Signed-off-by: zhumingjue <zhumingjue@huawei.com> Signed-off-by: Ricardo Noriega De Soto <rnoriega@redhat.com> Signed-off-by: lyj-jjj <liuyingjun5@huawei.com> Signed-off-by: gcanlin <canlinguosdu@gmail.com> Signed-off-by: wangyu <410167048@qq.com> Signed-off-by: weizhoublue <weizhoublue@github.com> Signed-off-by: weizhou.lan@daocloud.io <weizhou.lan@daocloud.io> Signed-off-by: dengyunyang <584797741@qq.com> Signed-off-by: 汪志鹏 <wangzhipeng628@gmail.com> Signed-off-by: David Chen <530634352@qq.com> Signed-off-by: Jie Liu <33612777+keeper-jie@users.noreply.github.com> Signed-off-by: Yueqian Lin <linyueqian@outlook.com> Signed-off-by: princepride <wangzhipeng628@gmail.com> Signed-off-by: natureofnature <wzliu@connect.hku.hk> Signed-off-by: bjf-frz <frz123db@gmail.com> Signed-off-by: amy-why-3459 <wuhaiyan17@huawei.com> Signed-off-by: KexiongYu <yukexiong1@huawei.com> Signed-off-by: Huang, Zeyu <11222265+fhfuih@users.noreply.github.com> Signed-off-by: Zeyu Huang | 黃澤宇 <11222265+fhfuih@users.noreply.github.com> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com> Co-authored-by: NumberWan <wantszkin2003@gmail.com> Co-authored-by: dsinghvi <divyanshsinghvi@gmail.com> Co-authored-by: Dnoob <dxpouo@gmail.com> Co-authored-by: Yueqian Lin <70319226+linyueqian@users.noreply.github.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com> Co-authored-by: knlnguyen1802 <knlnguyen1802@gmail.com> Co-authored-by: Samit <285365963@qq.com> Co-authored-by: rein yang <73573651+R2-Y@users.noreply.github.com> Co-authored-by: Nick Cao <ncao@redhat.com> Co-authored-by: zhumingjue138 <zhumingjue@huawei.com> Co-authored-by: Ricardo Noriega <rnoriega@redhat.com> Co-authored-by: lyj-jjj <liuyingjun5@huawei.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: gcanlin <canlinguosdu@gmail.com> Co-authored-by: wangyu <53896905+yenuo26@users.noreply.github.com> Co-authored-by: weizhoublue <45163302+weizhoublue@users.noreply.github.com> Co-authored-by: weizhoublue <weizhoublue@github.com> Co-authored-by: dengyunyang <584797741@qq.com> Co-authored-by: 汪志鹏 <wangzhipeng628@gmail.com> Co-authored-by: WeiQing Chen <40507679+david6666666@users.noreply.github.com> Co-authored-by: Jie Liu <33612777+keeper-jie@users.noreply.github.com> Co-authored-by: Yueqian Lin <linyueqian@outlook.com> Co-authored-by: NATURE <wzliu@connect.hku.hk> Co-authored-by: bjf-frz <frz123db@gmail.com> Co-authored-by: amy-why-3459 <wuhaiyan17@huawei.com> Co-authored-by: Y. Fisher <yukexiong1@huawei.com> Co-authored-by: Zeyu Huang | 黃澤宇 <11222265+fhfuih@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
82 lines
2.2 KiB
Python
82 lines
2.2 KiB
Python
import pytest
|
|
import torch
|
|
|
|
from vllm_omni.worker.gpu_generation_model_runner import GPUGenerationModelRunner
|
|
|
|
pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
|
|
|
|
|
|
class _DummyInputBatch:
|
|
def __init__(self):
|
|
self.req_ids = ["req-1"]
|
|
self.req_id_to_index = {"req-1": 0}
|
|
self.num_reqs = 1
|
|
self.vocab_size = 10
|
|
|
|
|
|
def _make_runner(multimodal_outputs):
|
|
runner = object.__new__(GPUGenerationModelRunner)
|
|
runner.execute_model_state = (
|
|
None,
|
|
None,
|
|
None,
|
|
None,
|
|
None,
|
|
None,
|
|
None,
|
|
None,
|
|
None,
|
|
multimodal_outputs,
|
|
None,
|
|
)
|
|
runner.kv_connector_output = None
|
|
runner.input_batch = _DummyInputBatch()
|
|
runner.use_async_scheduling = False
|
|
runner.device = torch.device("cpu")
|
|
runner.supports_mm_inputs = False
|
|
runner.speculative_config = None
|
|
runner.routed_experts_initialized = False
|
|
return runner
|
|
|
|
|
|
def test_sample_tokens_tensor_output():
|
|
multimodal_outputs = torch.randn(1, 2, 3)
|
|
runner = _make_runner(multimodal_outputs)
|
|
|
|
output = GPUGenerationModelRunner.sample_tokens(runner)
|
|
|
|
assert len(output.pooler_output) == 1
|
|
assert output.pooler_output[0]["model_outputs"].shape == (2, 3)
|
|
|
|
|
|
def test_sample_tokens_list_output():
|
|
multimodal_outputs = [torch.randn(2, 1)]
|
|
runner = _make_runner(multimodal_outputs)
|
|
|
|
output = GPUGenerationModelRunner.sample_tokens(runner)
|
|
|
|
assert len(output.pooler_output) == 1
|
|
assert output.pooler_output[0]["model_outputs"].shape == (2, 1)
|
|
|
|
|
|
def test_sample_tokens_list_allows_none_output():
|
|
multimodal_outputs = [None]
|
|
runner = _make_runner(multimodal_outputs)
|
|
|
|
output = GPUGenerationModelRunner.sample_tokens(runner)
|
|
|
|
assert len(output.pooler_output) == 1
|
|
assert output.pooler_output[0]["model_outputs"] is None
|
|
|
|
|
|
def test_sample_tokens_dict_output():
|
|
multimodal_outputs = {"audio": torch.randn(1, 4), "unused": None}
|
|
runner = _make_runner(multimodal_outputs)
|
|
|
|
output = GPUGenerationModelRunner.sample_tokens(runner)
|
|
|
|
assert len(output.pooler_output) == 1
|
|
assert "audio" in output.pooler_output[0]
|
|
assert "unused" not in output.pooler_output[0]
|
|
assert output.pooler_output[0]["audio"].shape == (1, 4)
|