If you prefer working with pathlib, you can also use the Path.as_posix method to get a string referencing the same file. In that way you can handle paths with Path objects and get the string only when loading/saving the model.