This directory contains end-to-end tests for the Model Optimizer's examples.
To add a test for a new example, create a new example directory in tests/examples following the existing examples as guidance.
Make sure to use as small models and less data as possible to keep the tests fast. Unless needed, have tests finish under 15 minutes.
To run a test, start from the recommended docker image from our installation docs.
Then mount your local modelopt directory to /workspace/Model-Optimizer and run this from the root of the repository.
cd /workspace/Model-Optimizer
pip install -e ".[all,dev-test]"
pytest tests/examples/$TESTAutomatic example CI excludes diffusers/test_diffusers_onnx_trt.py while retaining
HF export, quantization, and PyTorch inference coverage. The legacy ONNX/TensorRT
tests remain available for manual validation during the deprecation transition:
pytest tests/examples/diffusers/test_diffusers_onnx_trt.pyThe following environment variables can be set to control the behavior of the tests:
MODELOPT_LOCAL_MODEL_ROOT: If set, the tests will use the local model directory instead of downloading the model from the internet. Default is not set, which means the model will be downloaded.
The LLM QAT and Megatron Bridge examples reference ID-marked Markdown shell and Python fences from standalone scenarios and existing end-to-end tests. Costly integrations outside default CI are explicitly excluded. See the snippet contract and CPU/GPU commands for local development, collection, reduced-scale inputs and acceptance checks.