Skip to content

Commit 3fcdbe0

Browse files
Recognize /tfhub as a remote location. (#21211)
* Recognize /tfhub as a remote location. * Add test
1 parent 81c5097 commit 3fcdbe0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

keras/src/utils/file_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ def is_remote_path(filepath):
415415
416416
This function checks if the filepath represents a known remote pattern
417417
such as GCS (`/gcs`), CNS (`/cns`), CFS (`/cfs`), HDFS (`/hdfs`), Placer
418-
(`/placer`), or a URL (`.*://`).
418+
(`/placer`), TFHub (`/tfhub`), or a URL (`.*://`).
419419
420420
Args:
421421
filepath (str): The path to be checked.
@@ -424,7 +424,8 @@ def is_remote_path(filepath):
424424
bool: True if the filepath is a recognized remote path, otherwise False
425425
"""
426426
if re.match(
427-
r"^(/cns|/cfs|/gcs|/hdfs|/readahead|/placer|.*://).*$", str(filepath)
427+
r"^(/cns|/cfs|/gcs|/hdfs|/readahead|/placer|/tfhub|.*://).*$",
428+
str(filepath),
428429
):
429430
return True
430431
return False

keras/src/utils/file_utils_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,9 @@ def test_placer_remote_path(self):
726726
file_utils.is_remote_path("/placer/prod/scratch/home/some/path")
727727
)
728728

729+
def test_tfhub_remote_path(self):
730+
self.assertTrue(file_utils.is_remote_path("/tfhub/some/path"))
731+
729732
def test_cfs_remote_path(self):
730733
self.assertTrue(file_utils.is_remote_path("/cfs/some/path"))
731734

0 commit comments

Comments
 (0)