Skip to content

Commit

Permalink
Update Kagglehub mock and unpin keras-nlp (#1401)
Browse files Browse the repository at this point in the history
wrongly pinned keras-nlp, let's unpinned it. update mock to support
optional files.

https://b.corp.google.com/issues/341982731
  • Loading branch information
calderjo authored May 28, 2024
1 parent 34e9a4a commit 44fa98f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ ADD patches/keras_internal_test.py /opt/conda/lib/python3.10/site-packages/tenso
# We ignore dependencies since tf2.15 and Keras 3.* should work despite pip saying it won't.
# Currently, keras tries to install a nightly version of tf 2.16: https://github.com/keras-team/keras/blob/fe2f54aa5bc42fb23a96449cf90434ab9bb6a2cd/requirements.txt#L2
# b/341360061 Unpin keras-nlp once kaggle-hub is able to provide task.json file when requested
RUN pip install --no-deps "keras>3" keras-cv "keras-nlp==0.9.3" namex && \
RUN pip install --no-deps "keras>3" keras-cv keras-nlp namex && \
/tmp/clean-layer.sh

# b/328788268 libpysal 4.10 seems to fail with "module 'shapely' has no attribute 'Geometry'. Did you mean: 'geometry'"
Expand Down
12 changes: 5 additions & 7 deletions tests/utils/kagglehub.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ def do_GET(self):
path = m.group(2)
filepath = f"/input/tests/data/kagglehub/models/{model_handle}/{path}"
if not os.path.isfile(filepath):
raise ValueError((
"Internet is disabled in our tests\n"
"kagglehub uses a fake API server\n"
f"Use `kagglehub.model_download('{model_handle}', path='{path}')` to download the missing file\n"
f"and copy it to `./docker-python/tests/data/kagglehub/models/{model_handle}/{path}`\n"
))
self.send_error(404, "Internet is disabled in our tests "
"kagglehub uses a fake API server. "
f"Use `kagglehub.model_download('{model_handle}', path='{path}')` to download the missing file "
f"and copy it to `./docker-python/tests/data/kagglehub/models/{model_handle}/{path}`.")
return

with open(filepath, "rb") as f:
self.send_response(200)
self.send_header("Content-type", "application/octet-stream")
Expand Down

0 comments on commit 44fa98f

Please sign in to comment.