pytorch-quantization example is incompatible with latest torchvision version
@ttyio is already working on this.
Since Nov 28, 2023.
- Dominant language
- C++
- Stars
- 13.4k
- Forks
- 2.4k
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
Description
I'm trying to run the following pytorch-quantization example:
tools/pytorch-quantization/examples/calibrate_quant_resnet50.ipynb
The notebook "manually" imports functions from torchvision (without version reference), which seem to have been updated since, thereby leading to an error when running the example.
Specifically, in the "Create data loader" section:
_args = collections.namedtuple('mock_args', ['model', 'distributed', 'cache_dataset'])
dataset, dataset_test, train_sampler, test_sampler = load_data(traindir, valdir, _args(model='resnet50', distributed=False, cache_dataset=False))
I get the following error using the function load_data:
'mock_args' object has no attribute 'val_resize_size'
It seems that the namedtuple _args is expected to have more attributes. I checked out the load_data function and it expects many more attributes besides 'val_resize_size'.
Unless I imported the wrong function or forgot to run another code-block, I'd guess that the example needs to be updated to be compatible with the current torchvision functions. At the very least, the example could point to the version that was used.
This example is referenced in an Nvidia blog. Keeping this up-to-date might help others stumbling upon this.
Environment
TensorRT Version: 8.6.1
Operating System: Windows
Python Version: 3.9.12
PyTorch Version: 2.1.1+cu121
Steps To Reproduce
Run tools/pytorch-quantization/examples/calibrate_quant_resnet50.ipynb
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.