File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
components/src/dynamo/planner/utils Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 2020from typing import Optional
2121
2222import numpy as np
23- import scipy
2423
2524from dynamo .runtime .logging import configure_dynamo_logging
2625
@@ -80,6 +79,9 @@ def __init__(
8079 self .min_isl = min (self .prefill_isl )
8180 self .max_isl = max (self .prefill_isl )
8281
82+ # Lazy import scipy only when interpolation is actually needed
83+ import scipy .interpolate
84+
8385 # perform 1d interpolation
8486 self .ttft_interpolator = scipy .interpolate .interp1d (
8587 self .prefill_isl , self .prefill_ttft , kind = "cubic"
@@ -151,6 +153,9 @@ def __init__(
151153 self .yi = np .linspace (0 , max (self .y_context_length ), resolution )
152154 self .X , self .Y = np .meshgrid (self .xi , self .yi )
153155
156+ # Lazy import scipy only when interpolation is actually needed
157+ import scipy .interpolate
158+
154159 # perform 2d interpolation with fallback for NaN values
155160 self .itl_interpolator = scipy .interpolate .griddata (
156161 (self .x_kv_usage , self .y_context_length ),
You can’t perform that action at this time.
0 commit comments