ResNet models tuning
This example demonstrates how to use NVIDIA AITune to tune a ResNet model.
Environment Setup
You can use either of the following options to set up the environment:
Option 1 - virtual environment managed by you
Activate your virtual environment and install the dependencies:
Option 2 - virtual environment managed by uv
Install dependencies:
Usage
To tune the ResNet model, run:
or for uv:
After tuning, run classification with:
or for uv:
User-provided dynamic shapes
The dynamic-shapes mode uses the same tuning flow while explicitly defining its batch and spatial ranges. With the
defaults, it records batch sizes 1–4 at 224×224 and then runs inference at the unseen shape (2, 3, 256, 256):
The full-rank shape definition uses integers for fixed dimensions. Dimensions with the same name are shared, even when defined as separate objects:
Logging hardware metrics
If you would like to log hardware metrics during tuning or inference export AITUNE_HARDWARE_METRICS=True envorinment variable e.g.
AI Dynamo ResNet Deployment with Batching
Run ResNet as an AI Dynamo service with dynamic batching:
This script starts the frontend and backend services, waits for them to be ready, then runs a test client to send a sample request. Once the test completes, all services are automatically shut down. This is meant as a functional check, not to provide a permanent server.
Dynamic batching
The service uses dynamic batching — requests are grouped and processed together for efficiency. Currently, there is one frontend and one worker. To support multiple workers, move batching to a separate service that handles request grouping.
Model Details
Can be found in following pages: