From 9e138cb01d656e571257f61b0289824d452a6098 Mon Sep 17 00:00:00 2001 From: Kiersten Stokes Date: Thu, 29 Jan 2026 00:55:50 -0600 Subject: [PATCH] [Misc][Build] Lazy load cv2 in nemotron_parse.py (#33189) Signed-off-by: kiersten-stokes --- vllm/model_executor/models/nemotron_parse.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vllm/model_executor/models/nemotron_parse.py b/vllm/model_executor/models/nemotron_parse.py index b14bf09ab..afefafcc4 100644 --- a/vllm/model_executor/models/nemotron_parse.py +++ b/vllm/model_executor/models/nemotron_parse.py @@ -11,7 +11,6 @@ import math from collections.abc import Iterable, Mapping, Sequence from typing import Annotated, Literal -import cv2 import numpy as np import torch import torch.nn as nn @@ -416,6 +415,8 @@ class NemotronParseImageProcessor: else: self.target_height = self.target_width = int(self.final_size) + import cv2 + self.transform = A.Compose( [ A.PadIfNeeded( @@ -457,6 +458,8 @@ class NemotronParseImageProcessor: new_height = int(new_width / aspect_ratio) # Use cv2.INTER_LINEAR like the original + import cv2 + return cv2.resize( image, (new_width, new_height), interpolation=cv2.INTER_LINEAR )