Skip to content

Commit 44fa98f

Browse files
authored
Update Kagglehub mock and unpin keras-nlp (#1401)
wrongly pinned keras-nlp, let's unpinned it. update mock to support optional files. https://b.corp.google.com/issues/341982731
1 parent 34e9a4a commit 44fa98f

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Dockerfile.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ ADD patches/keras_internal_test.py /opt/conda/lib/python3.10/site-packages/tenso
224224
# We ignore dependencies since tf2.15 and Keras 3.* should work despite pip saying it won't.
225225
# Currently, keras tries to install a nightly version of tf 2.16: https://github.com/keras-team/keras/blob/fe2f54aa5bc42fb23a96449cf90434ab9bb6a2cd/requirements.txt#L2
226226
# b/341360061 Unpin keras-nlp once kaggle-hub is able to provide task.json file when requested
227-
RUN pip install --no-deps "keras>3" keras-cv "keras-nlp==0.9.3" namex && \
227+
RUN pip install --no-deps "keras>3" keras-cv keras-nlp namex && \
228228
/tmp/clean-layer.sh
229229

230230
# b/328788268 libpysal 4.10 seems to fail with "module 'shapely' has no attribute 'Geometry'. Did you mean: 'geometry'"

tests/utils/kagglehub.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ def do_GET(self):
2626
path = m.group(2)
2727
filepath = f"/input/tests/data/kagglehub/models/{model_handle}/{path}"
2828
if not os.path.isfile(filepath):
29-
raise ValueError((
30-
"Internet is disabled in our tests\n"
31-
"kagglehub uses a fake API server\n"
32-
f"Use `kagglehub.model_download('{model_handle}', path='{path}')` to download the missing file\n"
33-
f"and copy it to `./docker-python/tests/data/kagglehub/models/{model_handle}/{path}`\n"
34-
))
29+
self.send_error(404, "Internet is disabled in our tests "
30+
"kagglehub uses a fake API server. "
31+
f"Use `kagglehub.model_download('{model_handle}', path='{path}')` to download the missing file "
32+
f"and copy it to `./docker-python/tests/data/kagglehub/models/{model_handle}/{path}`.")
3533
return
36-
34+
3735
with open(filepath, "rb") as f:
3836
self.send_response(200)
3937
self.send_header("Content-type", "application/octet-stream")

0 commit comments

Comments
 (0)