I’m working on a model for Image Classification on Kaggle, I created a Learner with .to_native_fp16()
. After training i saved it with learn.save()
to later load it and train it further but the results weren’t getting better so I just stuck with the saved one. I loaded it with learn.load()
the next day and I exported it for inference. When I try to load it in a different kernel using load_learner
I get the following error:
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in
----> 1 learn = load_learner(Path(’…/input/89acc-effnet/89acc’), cpu=False).to_native_fp32()
/opt/conda/lib/python3.7/site-packages/fastai/learner.py in load_learner(fname, cpu, pickle_module)
372 "Load a `Learner` object in `fname`, optionally putting it on the `cpu`"
373 distrib_barrier()
--> 374 res = torch.load(fname, map_location='cpu' if cpu else None, pickle_module=pickle_module)
375 if hasattr(res, 'to_fp32'): res = res.to_fp32()
376 if cpu: res.dls.cpu()
/opt/conda/lib/python3.7/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
592 opened_file.seek(orig_position)
593 return torch.jit.load(opened_file)
--> 594 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
595 return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
596
/opt/conda/lib/python3.7/site-packages/torch/serialization.py in _load(zip_file, map_location, pickle_module, pickle_file, **pickle_load_args)
851 unpickler = pickle_module.Unpickler(data_file, **pickle_load_args)
852 unpickler.persistent_load = persistent_load
--> 853 result = unpickler.load()
854
855 torch._utils._validate_loaded_sparse_tensors()
AttributeError: Can't get attribute 'NativeMixedPrecision' on <module 'fastai.callback.fp16' from '/opt/conda/lib/python3.7/site-packages/fastai/callback/fp16.py'>`