-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Some models do not drop the unused stages when specifying out indices
This might be related to this. I had the impression it happens also with other models, but I might be wrong and this may be be specific to tf_efficientnets.
In any case, thanks a lot for this amazing library!
To Reproduce
import timm
import torch
resnet_full = timm.create_model('resnet18', features_only=True)
resnet = timm.create_model('resnet18', features_only=True, out_indices=(0,1,2))
effnet_full = timm.create_model('tf_efficientnet_b2', features_only=True)
effnet = timm.create_model('tf_efficientnet_b2', features_only=True, out_indices=(0,1,2))
get_n_params = lambda model: sum(p.numel() for p in model.parameters() if p.requires_grad)
resnet_params_full = get_n_params(resnet_full)
resnet_params = get_n_params(resnet)
assert resnet_params_full > resnet_params
effnet_params_full = get_n_params(effnet_full)
effnet_params = get_n_params(effnet)
assert effnet_params_full > effnet_params # FailsDesktop (please complete the following information):
- OS: [e.g. Windows 10, Ubuntu 18.04]
- This repository version [e.g. pip 0.3.1 or commit ref]
- PyTorch version w/ CUDA/cuDNN [e.g. from
conda list, 1.7.0 py3.8_cuda11.0.221_cudnn8.0.3_0]
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working