Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when using SNIP and Grasp for initialization #2

Open
dywu98 opened this issue Apr 22, 2024 · 0 comments
Open

Problem when using SNIP and Grasp for initialization #2

dywu98 opened this issue Apr 22, 2024 · 0 comments

Comments

@dywu98
Copy link

dywu98 commented Apr 22, 2024

It seems that when assigning --sparse_init GraSP there are problems:

Traceback (most recent call last):
File "/home/dancer/chase/Cifar/main_dst_chase.py", line 469, in
main()
File "/home/dancer/chase/Cifar/main_dst_chase.py", line 371, in main
mask.add_module(model, sparse_init=args.sparse_init, density=args.density)
File "/home/dancer/chase/Cifar/sparselearning/core_dst_chase.py", line 1508, in add_module
self.init(mode=sparse_init, density=density)
File "/home/dancer/chase/Cifar/sparselearning/core_dst_chase.py", line 1227, in init
layer_wise_sparsities = GraSP(self.module, self.density, self.train_loader, self.device)
File "/home/dancer/chase/Cifar/sparselearning/snip.py", line 217, in GraSP
inputs, targets = GraSP_fetch_data(train_dataloader, num_classes, samples_per_class)
File "/home/dancer/chase/Cifar/sparselearning/snip.py", line 160, in GraSP_fetch_data
if len(datas[category]) == samples_per_class:
IndexError: list index out of range

Moreover, when assigning --sparse_init SNIP, there is also a bug:

Traceback (most recent call last):
File "/home/dancer/chase/Cifar/main_dst_chase.py", line 469, in
main()
File "/home/dancer/chase/Cifar/main_dst_chase.py", line 395, in main
train(args, model, device, train_loader, epoch,mask)
File "/home/dancer/chase/Cifar/main_dst_chase.py", line 142, in train
if mask is not None: mask.step()
File "/home/dancer/chase/Cifar/sparselearning/core_dst_chase.py", line 1017, in step
self.truncate_weights_prune(self.death_rate)
File "/home/dancer/chase/Cifar/sparselearning/core_dst_chase.py", line 1786, in truncate_weights_prune
tokill=self.total_nonzero-self.baseline_nonzero
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

So, could you please provide an instruction how to use other sparse init method aside from 'fixed_ERK'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant