Automatic Sparsity(ASP) on Jetson AGX Orin for Pytorch model

Hello Team,

I am trying to implement Automatic Sparsity - ASP on Pytorch model by using following github: apex/apex/contrib/sparsity at master · NVIDIA/apex · GitHub.

I was able to installed apex but when I tried with ResNet50 pretrained keras weights, it was asking to specify all the hyper-parameters so while prunning it will take refernce from pretrained base model. However, I have mentioned but it was failing and throwing AssertionError. Can you guys provide some sample script or guide that how to apply ASP on model zoo pretrained models?

Regards,
Nimesh

Hi,

Could you share the error message with us first?
Please check if you can find some information in the below repository:

Thanks.

Hi,

I have attached the snippet of my script below as:

import torch
from apex.contrib.sparsity import ASP
from torchvision.models import resnet50

model = resnet50(pretrained=True)
model.eval()

optimizer = torch.optim.SGD(model.parameters(), lr = 0.01, momentum=0.9)
device = torch.device(“cuda”)
ASP.prune_trained_model(model, optimizer)

After this line, I was getting errors and have save that error logs in txt file which attached here.
error_log.txt (53.0 KB)

Regards,
Nimesh

Hi,

Based on the error, it looks like there are some missing configure in your model:

AttributeError: 'ResNet' object has no attribute 'module'

Would you mind opening a topic on the GitHub repository so the ASP team can check it directly.
Thanks.

Hi,

I have resolved that error but now when I am trying to perform ASP again it was taking more than 20hrs but not getting prunned weights.

ASP.prune_trained_model(model, optimizer)
After above line, It is taking infinite time. Can you pls help to assist me how to apply ASP on pretrained model?

Regards,
Nimesh

Hi,

Do you want to apply for the training on Orin?

Based on the description of the ASP repository, it targets distributed training with PyTorch.
However, PyTorch distributed training might implement with CUDA IPC which is not available on Jetson.

It’s recommended to check if ASP can work on Jetson first.
Thanks.

Hi,

Currently, I am taking reference from this blog (https://developer.nvidia.com/blog/accelerating-inference-with-sparsity-using-ampere-and-tensorrt/) and trying to replicate same thing on Jetson AGX Orin. In this blog, they have implemented and tested on NVIDIA A100 GPU.

Can you please tell me how to check that ASP can work on Jetson? It will be great help.

Regards,
Nimesh

Hi,

Please file a topic on GitHub directly to reach out to the ASP team.
Thanks.