Closed marekrogala closed 4 years ago
Added the PR with a naive solution - @kamilzyla: please test if it helps (I cannot easily do it on Windows from the forest I'm in).
Basically I have taken the two models in this repo and loaded each and exported again using: fastai==1.0.61 torch==1.4.0 torchvision==0.5.0 on the GCP's Linux VMs
If this doesn't work we will need to use methods 2 or 3. The problem with 2 is that in order to load a .pth file you need to have a learner already. While you can create an empty databunch (knowing the classes from an extra file), you also need to specify base architecture (ResNet-50 in our case) which is then triggering a download by default. The default won't work offline.
I tested this on Windows and Gabon model still fails with the same error, while Serengeti still works fine.
Fixed by overwriting model.model_dir with a string and re-exporting
We get the following error on Windows, only for the Gabon model:
PosixPath and WindowsPath are system-specific: https://docs.python.org/3/library/pathlib.html
this error is caused by PosixPath that got serialized. Fastai recommends using save/load instead (see https://github.com/fastai/fastai/issues/1482). But somehow the Serengeti model works. I looked on windows and linux and the below code gives PosixPath on Linux and WindowsPath on Windows. Why doesn't this work the same for the Gabon model? @swiezew what were the differences? probably different versions of pytorch and fastai used in training? did you do anything specific to make the Serengeti model work on Win?
i think we want to have a uniform version across models. Solutions i see:
save
d version (only weights) and change the runner script to expectpth
instead ofpkl
- as described in https://github.com/fastai/fastai/issues/1482/#issuecomment-587070809