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
EagerUsageValidator
EagerUsageValidator
class max.pipelines.EagerUsageValidator(*, enabled=True, label='')
Bases: object
A scope that tracks production-unsafe API usages.
Reports:
- Eager ops that ran without being fused into a compiled graph.
- Graph breaks between compiled graphs.
- Compiled outputs that were materialized and never read.
- Device-to-host transfers that were not bulk transferred.
from max.experimental.validation import EagerUsageValidator
with EagerUsageValidator():
...To mark where unsafe API usage is deliberate, use escape hatches. Example:
from max.pipelines.modeling.eager_validation import eager_validator
with eager_validator.allow_eager(reason="input batching, off hot path"):
...-
Parameters:
allow_device_transfer()
allow_device_transfer(*, reason)
Opts in to device-to-host transfers for the duration of the block.
Prefer one bulk transfer inside such a block over a transfer per element.
allow_eager()
allow_eager(*, reason)
Opts in to eager execution for the duration of the block.
discard_output()
discard_output(output, *, reason)
Marks compiled-model outputs as intentionally unread.
enabled
property enabled: bool
Whether this validator is enabled.
enter()
enter()
Starts validating. Prefer the context manager form.
-
Return type:
exit()
exit(exc_type=None, exc=None, tb=None)
Stops validating and reports what the scope saw.
-
Parameters:
-
- exc_type (type[BaseException] | None)
- exc (BaseException | None)
- tb (TracebackType | None)
-
Return type:
-
None
graph_break()
graph_break(*, reason)
Marks the block as an expected boundary between compiled graphs.