-
Notifications
You must be signed in to change notification settings - Fork 36
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
torch.nn.modules.module.ModuleAttributeError: 'MobileNetV3' object has no attribute 'reset_classifier' #12
Comments
same here. Double checked the ofa repo at current and 0.04* commit version, but can't find something like reset_classifier. Timm library has a function with same name, but MobileNetV3 is based on nn.Module, so not relies on timm. @mikelzc1990 did you extend the ofa module? |
Hi, I also had this error. In the end, I found that in codebase/networks/nsganetv2.py there are these lines:
and the reset_classifier function:
I then downloaded the ofa library code, add this to ofa/imagenet_classification/networks/mobilenet_v3.py, then setup:
It's obvious that we need to add another parameter:
After that it appears to work fine. I hope this can be of help to anyone who gets into this problem. |
I tried your method, but I still got the same mistake |
python python msunas.py --sec_obj flops --n_gpus 1 --gpu 1 --n_workers 4 --n_epochs 5 --dataset cifar10 --n_classes 10 --data ./data --predictor as --supernet_path data/ofa_mbv3_d234_e346_k357_w1.0 --save search-cifar10-flops-w1.0 --iterations 30 --vld_size 5000 Evaluation mode: subnet Color jitter: None, resize_scale: 0.08, img_size: 192 Traceback (most recent call last): File "evaluator.py", line 266, in <module> main(cfgs) File "evaluator.py", line 209, in main OFAEvaluator.eval( File "evaluator.py", line 155, in eval subnet.reset_classifier( File ".../anaconda3/envs/horovod/lib/python3.8/site-packages/torch/nn/modules/module.py", line 771, in __getattr__ raise ModuleAttributeError("'{}' object has no attribute '{}'".format( torch.nn.modules.module.ModuleAttributeError: 'MobileNetV3' object has no attribute 'reset_classifier'
I try to search architectures for cifar10 and I have checked the ofa.
but I don't find the 'reset_classifier'.
Could you please help? Thx
The text was updated successfully, but these errors were encountered: