I have created a model named 'model' but when I'm trying to save it using pickle it just gives an 'NotFoundError'.
import pickle
with open("test.pkl","wb") as file:
pickle.dump(model, file)
This is the error message I get upon running the code.
Error message
INFO:tensorflow:Assets written to: ram://471dfd58-f3fe-4d9f-9075-60a1568cc629/assets
---------------------------------------------------------------------------
NotFoundError Traceback (most recent call last)
<ipython-input-47-0abd122520e5> in <module>
1 import pickle
2 with open("test.pkl","wb") as file:
----> 3 pickle.dump(model, file)
~\anaconda3\lib\site-packages\keras\engine\training.py in __reduce__(self)
313 if self.built:
314 return (pickle_utils.deserialize_model_from_bytecode,
--> 315 pickle_utils.serialize_model_as_bytecode(self))
316 else:
317 # SavedModel (and hence serialize_model_as_bytecode) only support
~\anaconda3\lib\site-packages\keras\saving\pickle_utils.py in serialize_model_as_bytecode(model)
75 with tf.io.gfile.GFile(dest_path, "rb") as f:
76 info = tarfile.TarInfo(name=os.path.relpath(dest_path, temp_dir))
---> 77 info.size = f.size()
78 archive.addfile(tarinfo=info, fileobj=f)
79 tf.io.gfile.rmtree(temp_dir)
~\anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py in size(self)
97 def size(self):
98 """Returns the size of the file."""
---> 99 return stat(self.__name).length
100
101 def write(self, file_content):
~\anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py in stat(filename)
908 errors.OpError: If the operation fails.
909 """
--> 910 return stat_v2(filename)
911
912
~\anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py in stat_v2(path)
924 errors.OpError: If the operation fails.
925 """
--> 926 return _pywrap_file_io.Stat(compat.path_to_str(path))
927
928
NotFoundError:
Any help would be massively appreciated