From d0d8e03df571793e2f876857ca3e0bfbfe076161 Mon Sep 17 00:00:00 2001 From: Gyula Chinoradszki Date: Fri, 7 Aug 2026 18:25:04 +0000 Subject: [PATCH] [Bugfix][models_multimodal] Restore torch.nn.functional typing aliases for MiniCPM-V 2.5 remote code openbmb/MiniCPM-Llama3-V-2_5's remote resampler.py annotates with List without importing it, relying on the alias leaking from 'from torch.nn.functional import *'. Recent torch uses builtin generics and no longer re-exports it, so loading the model in the HF runner raises NameError. Co-authored-by: Cursor Agent Signed-off-by: Gyula Chinoradszki --- tests/models/multimodal/conftest.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/models/multimodal/conftest.py b/tests/models/multimodal/conftest.py index d00c3df786dc..70d4eee9b357 100644 --- a/tests/models/multimodal/conftest.py +++ b/tests/models/multimodal/conftest.py @@ -6,9 +6,18 @@ import warnings import torch +import torch.nn.functional as F from vllm.platforms import current_platform +# openbmb/MiniCPM-Llama3-V-2_5's remote ``resampler.py`` annotates with ``List`` +# without importing it, relying on the alias leaking from +# ``from torch.nn.functional import *``. Recent torch uses builtin generics and no +# longer re-exports the typing aliases, so executing that module raises NameError. +# TODO: Remove once the checkpoint fixes its imports. +if not hasattr(F, "List"): + F.List = list + def pytest_configure(config): """Early ROCm configuration that must happen before test collection."""