[Bugfix] Fix the issue where no exception is thrown when graph capture fails. (#5644)

### What this PR does / why we need it?

Fix the issue where no exception is thrown when graph capture fails.


- vLLM version: v0.13.0
- vLLM main:
https://github.com/vllm-project/vllm/commit/2f4e6548efec402b913ffddc8726230d9311948d

Signed-off-by: WithHades <244036962@qq.com>
This commit is contained in:
无脸男 authored and GitHub committed 2026-03-12 16:14:45 +08:00
1 parent 77b43492ae
commit 09d26754cd
1 file changed
+2
+2
View File
@@ -3225,6 +3225,8 @@ def _replace_gpu_model_runner_function_wrapper(target_module_name):
target_module = sys.modules[target_module_name]
setattr(target_module, "graph_capture", graph_capture) # noqa: B010
yield
except Exception as e:
raise RuntimeError(f"NPUModelRunner failed, error is {e}")
finally:
setattr(target_module, "graph_capture", graph_capture) # noqa: B010