Cannot instantiate 'WindowsPath' when loading learner

I’m having issue when trying to load_learner on colab a learner that was exported from a Windows machine. The problem seems to be that the learner.path is serialized as pathlib.WindowsPath and when we try to deserialize the system cannot instantiate. Is there a way I can change the learner.path to a string and then export? I tried to force this, but it fails to export. Any ideas?

The error I get from collab is:
NotImplementedError: cannot instantiate ‘WindowsPath’ on your system

I had the opposite problem: I trained my learner on azure linux VM and then tried to load it on my Windows laptop. Adding the following code fixed it for me:

import pathlib
plt = platform.system()
if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath

Maybe you could flip flop that and do pathlib.WindowsPath = pathlib.PosixPath?


It worked! Thank you so much!