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 9, 10:00 UTC
[Misc][Build] Lazy load cv2 in nemotron_parse.py (#33189)
Signed-off-by: kiersten-stokes <kierstenstokes@gmail.com>
Kiersten Stokes committed
Jan 29, 2026 at 00:55 UTC
9e138cb01d656e571257f61b0289824d452a6098
1 file changed
+4
-1
vllm/model_executor/models/nemotron_parse.py
+4
-1
@@ -11,7 +11,6 @@ import math
11
from collections.abc import Iterable, Mapping, Sequence
12
from typing import Annotated, Literal
13
14
-import cv2
14
import numpy as np
15
import torch
16
import torch.nn as nn
@@ -416,6 +415,8 @@ class NemotronParseImageProcessor:
415
else:
416
self.target_height = self.target_width = int(self.final_size)
417
418
+ import cv2
419
+
420
self.transform = A.Compose(
421
[
422
A.PadIfNeeded(
@@ -457,6 +458,8 @@ class NemotronParseImageProcessor:
458
new_height = int(new_width / aspect_ratio)
459
460
# Use cv2.INTER_LINEAR like the original
461
+ import cv2
462
+
463
return cv2.resize(
464
image, (new_width, new_height), interpolation=cv2.INTER_LINEAR
465
)