mit-han-lab / once-for-all

[ICLR 2020] Once for All: Train One Network and Specialize it for Efficient Deployment
https://ofa.mit.edu/
MIT License
1.89k stars 333 forks source link

error when custom sub sampling a model #74

Closed MMorafah closed 1 year ago

MMorafah commented 1 year ago

Hello,

I have cloned the code and use the following lines to sub-sample a custom model:

super_net_name = "ofa_resnet50" ofa_network = ofa_net(net_name, pretrained=True) ofa_network.set_active_subnet(ks=7, e=5, d=4) subnet = ofa_network.get_active_subnet(preserve_weight=True)

However, I get the following error: RuntimeError: The size of tensor a (1040) must match the size of tensor b (88) at non-singleton dimension 0

Please let me know if I am missing something?

Thank you very much in advance.

han-cai commented 1 year ago

Hi MMorafah,

The supported search space of "ofa_resnet50" is OFA Network Design Space Resolution Width Multiplier Depth Expand Ratio kernel Size
ofa_resnet50 ResNet50D 128 - 224 0.65, 0.8, 1.0 0, 1, 2 0.2, 0.25, 0.35 3

"ks=7, e=5, d=4" is not a valid subnet configuration in this search space.

Best, Han