Skip to content

Latest commit

 

History

History

examples

README.md

Model Optimizer End-to-End Tests

This directory contains end-to-end tests for the Model Optimizer's examples.

Adding new tests

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.

Running the tests

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/$TEST

Legacy Diffusers ONNX/TensorRT tests

Automatic 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.py

Environment variables

The 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.

Executable README scenarios

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.