For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python class
CompilationTimer
CompilationTimerโ
class max.pipelines.lib.CompilationTimer(name)
Bases: object
Timer for logging graph build, compile, and init phases.
Use as a context manager. Starts timing on entry. Call
mark_build_complete() after graph building; per-phase timings are
logged on exit. Compile and init durations come from engine
instrumentation inside InferenceSession.compile() and
InferenceSession.init_all(), so they are accurate even when the
timer wraps a higher-level call like session.load_all.
For example, time the build, compile, and init phases of a model load inside a pipeline model method:
with CompilationTimer("model") as timer:
graph = self._build_graph(self.weights, self.adapter)
timer.mark_build_complete()
model = session.load(graph, weights_registry=self.state_dict)-
Parameters:
-
name (str) โ The name to use in log messages (such as
"model"or"vision model").
mark_build_complete()โ
mark_build_complete()
Marks the end of the build phase and logs build time.
-
Return type:
-
None