Skip to content

ResNet models tuning with Torch Tweak

This example demonstrates how to use Torch Tweak 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:

pip install --index-url https://download.pytorch.org/whl/xpu \
        --extra-index-url https://pypi.org/simple \
        .

Option 2 - virtual environment managed by uv

Install dependencies:

uv sync

Usage

To tune the ResNet model, run:

tune --model-name resnet50

or for uv:

uv run tune --model-name resnet50

After tuning, run classification with:

inference --model-name resnet50 --image-path your_image

or for uv:

uv run inference --model-name resnet50 --image-path your_image

Model Details

Can be found in following pages: * https://pytorch.org/vision/stable/models.html#classification * https://huggingface.co/timm