MLBazaar / MLPrimitives

Primitives for machine learning and data science.
https://mlbazaar.github.io/MLPrimitives
MIT License
69 stars 38 forks source link

Save `keras` primitives in Windows environment #261

Closed sarahmish closed 2 years ago

sarahmish commented 2 years ago

Description

Saving any keras based model using the adapter in windows machine, we get the following error

OSError: Unable to create file (unable to open file: name = 'C:\Users\Sarah\AppData\Local\Temp\tmp2ll0lzdn.hdf5', errno = 13, error message = 'Permission denied', flags = 13, o_flags = 302)

In windows, when we create temporary files, we need to explicitly set the permissions of the file in order to write to it. A quick fix to this problem is to set delete=False in the state setting and getting mode. https://github.com/MLBazaar/MLPrimitives/blob/dc43778c0a59d0232ed2995810b9f4c1522c858e/mlprimitives/adapters/keras.py#L31