walkwithfastai / walkwithfastai.github.io

Host for https://walkwithfastai.com
Other
143 stars 53 forks source link

No module named 'timm.models.layers.se' #42

Closed johnyquest7 closed 3 years ago

johnyquest7 commented 3 years ago

Following is my code from fastai.vision.all import from wwf.vision.timm import learn = load_learner('models/predict.pkl')


ModuleNotFoundError Traceback (most recent call last)

in ----> 1 learn = load_learner('models/predict.pkl') ~/anaconda3/envs/fastjul/lib/python3.8/site-packages/fastai/learner.py in load_learner(fname, cpu, pickle_module) 382 "Load a `Learner` object in `fname`, optionally putting it on the `cpu`" 383 distrib_barrier() --> 384 res = torch.load(fname, map_location='cpu' if cpu else None, pickle_module=pickle_module) 385 if hasattr(res, 'to_fp32'): res = res.to_fp32() 386 if cpu: res.dls.cpu() ~/anaconda3/envs/fastjul/lib/python3.8/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args) 605 opened_file.seek(orig_position) 606 return torch.jit.load(opened_file) --> 607 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) 608 return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) 609 ~/anaconda3/envs/fastjul/lib/python3.8/site-packages/torch/serialization.py in _load(zip_file, map_location, pickle_module, pickle_file, **pickle_load_args) 880 unpickler = UnpicklerWrapper(data_file, **pickle_load_args) 881 unpickler.persistent_load = persistent_load --> 882 result = unpickler.load() 883 884 torch._utils._validate_loaded_sparse_tensors() ~/anaconda3/envs/fastjul/lib/python3.8/site-packages/torch/serialization.py in find_class(self, mod_name, name) 873 def find_class(self, mod_name, name): 874 mod_name = load_module_mapping.get(mod_name, mod_name) --> 875 return super().find_class(mod_name, name) 876 877 # Load the data (which may in turn use `persistent_load` to load tensors) ModuleNotFoundError: No module named 'timm.models.layers.se' -
muellerzr commented 3 years ago

Did you install timm 0.2.1 like it states at the top of the article? I can't verify if things changed on timm since then.

pip install timm==0.2.1

johnyquest7 commented 3 years ago

Solved it by downgrading timm Thanks a lot