keras-team / keras-core

A multi-backend implementation of the Keras API, with support for TensorFlow, JAX, and PyTorch.
Apache License 2.0
1.27k stars 115 forks source link

TypeError: copy() got an unexpected keyword argument 'overwrite' #949

Closed colbybanbury closed 8 months ago

colbybanbury commented 8 months ago

load_model() in saving/saving_api.py calls file_utils.copy() with the argument 'overwrite', which does not exist in utils/file_utils.py

https://github.com/keras-team/keras-core/blob/3a464f904dc8dd09de9c51d248a7fe7c575d7f3e/keras_core/saving/saving_api.py#L169

Removing overwrite=True from the function call fixes the error but is probably not the desired behavior.

Full Error:

Traceback (most recent call last): File "/home/colby/vww-2/cross_validate.py", line 17, in vww_model = keras.saving.load_model("gs://wake-vision-storage/saved_models/2023_11_06-03_59_51_PM/vww_mobilenetv1.keras") File "/home/colby/.local/lib/python3.10/site-packages/keras_core/src/saving/saving_api.py", line 169, in load_model file_utils.copy(filepath, local_path, overwrite=True) TypeError: copy() got an unexpected keyword argument 'overwrite'

colbybanbury commented 8 months ago

shutil copy overwrites by default But gfile copy does not

Given that the file is copied to a tmp path, it actually probably does make sense to just always overwrite the file.

colbybanbury commented 8 months ago

Moving this issue to the new repo location. My mistake