Git Product home page Git Product logo

Comments (3)

czg1225 avatar czg1225 commented on June 7, 2024

Hello @BuKeMod ,
Consider verifying if you have altered the '--gradsize' parameter. The default setting for 'gradsize' is 1000. It's important to ensure that the 'gradsize' value is less than the 'trainsize'.
Thanks.

from slimsam.

BuKeMod avatar BuKeMod commented on June 7, 2024

I've encountered a new issue. Do you have any examples of training, such as using Colab or Kaggle? I'm a beginner and don't quite understand yet. Thank you.

CUDA visible devices: 1
CUDA Device Name: Tesla P100-PCIE-16GB
===========================Parameter Settings===========================
Pruning Ratio: 0.3
VIT num_heads: 12
norm_type: mean
imptype: Disturb
global: False
learning rate: 0.0001
a_weight: 0.5
round_to 12
TRAIN_SIZE 40 VAL_SIZE 12 GRAD_SIZE 0 Epochs 5
===========================Pruning Start===========================
/kaggle/working/SlimSAM/torch_pruning/dependency.py:639: UserWarning: Unwrapped parameters detected: ['pos_embed', 'neck.3.bias', 'neck.3.weight', 'neck.1.bias', 'neck.1.weight'].
Torch-Pruning will prune the last non-singleton dimension of a parameter. If you wish to customize this behavior, please provide an unwrapped_parameters argument.
warnings.warn(warning_str)
Traceback (most recent call last):
File "/kaggle/working/SlimSAM/prune_distill_step1.py", line 295, in
train_model()
File "/kaggle/working/SlimSAM/prune_distill_step1.py", line 136, in train_model
model.image_encoder = prune_sam_step1(model=model.image_encoder, example_inputs=example_inputs, model_name=model_name, round_to=round_to, ratio=ratio, imptype = imptype, norm_type=norm_type, global_way=global_way)
File "/kaggle/working/SlimSAM/prune_funcs.py", line 140, in prune_sam_step1
pruner.step()
File "/kaggle/working/SlimSAM/torch_pruning/pruner/algorithms/metapruner.py", line 162, in step
for group in pruning_fn():
File "/kaggle/working/SlimSAM/torch_pruning/pruner/algorithms/metapruner.py", line 212, in prune_local
imp = self.estimate_importance(group, ch_groups=ch_groups)
File "/kaggle/working/SlimSAM/torch_pruning/pruner/algorithms/metapruner.py", line 166, in estimate_importance
return self.importance(group, ch_groups=ch_groups)
File "/kaggle/working/SlimSAM/torch_pruning/pruner/importance.py", line 426, in call
dw = layer.weight.grad.data[idxs].flatten(1)
AttributeError: 'NoneType' object has no attribute 'data'

from slimsam.

czg1225 avatar czg1225 commented on June 7, 2024

Please ensure that the 'gradsize' parameter is set to a value greater than 0. The importance estimation algorithm relies on gradient information for each parameter, making it essential that 'gradsize' is not zero. Note that while 'gradsize' should be less than 'trainsize', a larger 'gradsize' can be more effective for pruning purposes.
Thanks!

from slimsam.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.