Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Kagglehub mock and unpin keras-nlp #1401

Merged
merged 4 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 3 additions & 7 deletions tests/utils/kagglehub.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@ 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"
))
calderjo marked this conversation as resolved.
Show resolved Hide resolved
self.send_response(404)
self.end_headers()
return

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