Skip to content

Commit

Permalink
Parse version.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamanehSaadat committed Apr 23, 2024
1 parent 8818403 commit 4162f7c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions keras_nlp/utils/preset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import re

from absl import logging
from packaging.version import parse

from keras_nlp.api_export import keras_nlp_export
from keras_nlp.backend import config as backend_config
Expand Down Expand Up @@ -442,10 +443,10 @@ def upload_preset(
"Uploading a model to Kaggle Hub requires the `kagglehub` package. "
"Please install with `pip install kagglehub`."
)
if kagglehub.__version__ < "0.2.1":
if parse(kagglehub.__version__) < parse("0.2.1"):
raise ImportError(
"Uploading a model to Kaggle Hub requires the `kagglehub` package version `0.2.1` or higher. "
"Please upgrade `kagglehub` with `pip install --upgrade kagglehub`."
"Please upgrade with `pip install --upgrade kagglehub`."
)
kaggle_handle = uri.removeprefix(KAGGLE_PREFIX)
kagglehub.model_upload(kaggle_handle, preset)
Expand Down

0 comments on commit 4162f7c

Please sign in to comment.