ShuffleNet Folder Readme file information is correct?
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 9.8k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Ask a Question
Hi, I would like to know how I can follow the instructions to download shufflenet models from pytorch, convert them to onnx format and quantize to int8?
Question
Explain your question here.
I would like to follow the instructions from https://github.com/onnx/models/tree/main/vision/classification/shufflenet readme file.
I want to download pytorch models because the shufflenet models already in /shufflenet/model folder do not have batch size support which from pytorch you can select by using "dynamic_axes" and save the model.
This flag it is used in https://github.com/onnx/models/blob/main/vision/classification/shufflenet/ShufflenetV2-export.py line 152, however the script fails.
In addition, later, you can read on Readme file how to quantize the model, by using :
bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
--config=shufflenetv2.yaml
--output_model=path/to/save
However, I can't find "run_tuning.sh" and shufflenetv2.yaml files.
Moreover, I would like to know why in shufflenet models like "shufflenet-v2-12.onnx" you cannot find the input size in all modules, only at the input (1x3x224x224) with no batch size (picture 1) while using "mobilnetv2-12.onnx" (picture 2) model from https://github.com/onnx/models/tree/main/vision/classification/mobilenet/model you can see how the input has (batch_sizex3x224x224). It is also different from "densenet-12.onnx" file (picture 3) from https://github.com/onnx/models/tree/main/vision/classification/densenet-121 where before each module, you can see the input size.
Is this normal?, i would like to follow the Readme from shufflenet repo in order to chech if the sufflenet models are right o not.
Perhaps someone has done it before and can help me?



Further information
Relevant Area (e.g. model usage, backend, best practices, pre-/post- processing, converters):
I'm just using "ShufflenetV2-export.py" but already fails because an HTTP Error 300, I dont know if there is some links wrong, but no model from line 15 of the script works:
Traceback (most recent call last):
File "ShufflenetV2-export.py", line 178, in
shufflenetv2_test()
File "ShufflenetV2-export.py", line 129, in shufflenetv2_test
model = torch.hub.load(github_repo, model, pretrained=True)
File "/home/izcagal/.local/lib/python3.8/site-packages/torch/hub.py", line 397, in load
repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose, skip_validation)
File "/home/izcagal/.local/lib/python3.8/site-packages/torch/hub.py", line 192, in _get_cache_or_reload
download_url_to_file(url, cached_file, progress=False)
File "/home/izcagal/.local/lib/python3.8/site-packages/torch/hub.py", line 452, in download_url_to_file
u = urlopen(req)
File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.8/urllib/request.py", line 531, in open
response = meth(req, response)
File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
response = self.parent.error(
File "/usr/lib/python3.8/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 300: Multiple Choices
I update my python to python 3.8 and now I have another output to ShufflenetV2-export.py:
Downloading: "https://github.com/pytorch/vision/zipball/v0.5.0" to /mnt/beegfs/gap/izcagal/.cache/torch/hub/v0.5.0.zip
/mnt/beegfs/gap/izcagal/.local/lib/python3.8/site-packages/torch/hub.py:218: UserWarning: The ref v0.5.0 is ambiguous. Perhaps it is both a tag and a branch in the repo? Torchhub will now assume that it's a branch. You can disambiguate tags and branches by explicitly passing refs/heads/branch_name or refs/tags/tag_name as the ref. That might require using skip_validation=True.
warnings.warn(
/mnt/beegfs/gap/izcagal/.local/lib/python3.8/site-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and will be removed in 0.15, please use 'weights' instead.
warnings.warn(
/mnt/beegfs/gap/izcagal/.local/lib/python3.8/site-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or None for 'weights' are deprecated since 0.13 and will be removed in 0.15. The current behavior is equivalent to passing weights=ShuffleNet_V2_X0_5_Weights.IMAGENET1K_V1. You can also use weights=ShuffleNet_V2_X0_5_Weights.DEFAULT to get the most up-to-date weights.
warnings.warn(msg)
Downloading: "https://download.pytorch.org/models/shufflenetv2_x0.5-f707e7126e.pth" to /mnt/beegfs/gap/izcagal/.cache/torch/hub/checkpoints/shufflenetv2_x0.5-f707e7126e.pth
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5.28M/5.28M [00:00<00:00, 7.76MB/s]
Traceback (most recent call last):
File "ShufflenetV2-export.py", line 178, in
shufflenetv2_test()
File "ShufflenetV2-export.py", line 142, in shufflenetv2_test
model_dir, data_dir = save_model('shufflenetv2', model.cpu(), input_1, output_1,
File "ShufflenetV2-export.py", line 86, in save_model
torch.onnx.export(model, inputs, model_dir, verbose=True, input_names=input_names,
TypeError: export() got an unexpected keyword argument 'example_outputs'
Thank!
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Start with vision/classification/shufflenet/README.md and vision/classification/shufflenet/ShufflenetV2-export.py, especially the referenced lines around model loading and torch.onnx.export. Reproduce the reported failures with the stated Python and PyTorch versions, then check whether run_tuning.sh and shufflenetv2.yaml exist in the repository. Done means the README and export instructions accurately identify the required files, versions, and supported model behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- documentation, machine-learning
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100