A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 6, 13:15 UTC
[Bugfix] Fix mock.patch resolution failure for standalone_compile.FakeTensorMode on Python <= 3.10 (#37158)
Signed-off-by: Dimitrios Bariamis <12195802+dbari@users.noreply.github.com> Co-authored-by: Dimitrios Bariamis <12195802+dbari@users.noreply.github.com>
Dimitrios Bariamis committed
Mar 17, 2026 at 21:13 UTC
1204cf0a9d0d4079183c44568dd2d6f8b46a3666
1 file changed
+9
-2
vllm/compilation/compiler_interface.py
+9
-2
@@ -373,8 +373,15 @@ class InductorStandaloneAdaptor(CompilerInterface):
373
break
374
375
if input_fake_mode is not None:
376
- fake_mode_ctx: Any = patch(
377
- "torch._inductor.standalone_compile.FakeTensorMode",
376
+ # Use patch.object on the actual module from sys.modules
377
+ # because in Python <=3.10 the string-based patch() resolves
378
+ # torch._inductor.standalone_compile to the wrapper function
379
+ # (defined in __init__.py) instead of the module.
380
+ import sys
381
+
382
+ fake_mode_ctx: Any = patch.object(
383
+ sys.modules["torch._inductor.standalone_compile"],
384
+ "FakeTensorMode",
385
lambda *a, **kw: input_fake_mode,
386
)
387
else: