Skip to content

Commit

Permalink
Handle cached model missing file exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamanehSaadat committed Apr 15, 2024
1 parent 38243e6 commit 55396ad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions keras_nlp/utils/preset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ def get_file(preset, path):
)
else:
raise ValueError(message)
except ValueError as e:
message = str(e)
if message.find("is not present in the model files"):
raise FileNotFoundError(
f"`{path}` doesn't exist in preset directory `{preset}`."
)
else:
raise ValueError(message)

elif preset.startswith(GS_PREFIX):
url = os.path.join(preset, path)
Expand Down

0 comments on commit 55396ad

Please sign in to comment.