Skip to content
Merged
Changes from all 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
25 changes: 13 additions & 12 deletions src/openpi/shared/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,19 @@ def maybe_download(url: str, *, force_download: bool = False, **kwargs) -> pathl
else:
local_path.unlink()

# Download the data to a local cache.
logger.info(f"Downloading {url} to {local_path}")
scratch_path = local_path.with_suffix(".partial")
# Route openpi-assets through gsutil to avoid gcsfs auth issues with this bucket.
# All other gs:// URLs (e.g. big_vision) continue to use gcsfs as normal.
if parsed.scheme == "gs" and parsed.netloc == "openpi-assets":
_download_gsutil(url, scratch_path, **kwargs)
else:
_download_fsspec(url, scratch_path, **kwargs)

shutil.move(scratch_path, local_path)
_ensure_permissions(local_path)
if not local_path.exists():
# Download the data to a local cache.
logger.info(f"Downloading {url} to {local_path}")
scratch_path = local_path.with_suffix(".partial")
# Route openpi-assets through gsutil to avoid gcsfs auth issues with this bucket.
# All other gs:// URLs (e.g. big_vision) continue to use gcsfs as normal.
if parsed.scheme == "gs" and parsed.netloc == "openpi-assets":
_download_gsutil(url, scratch_path, **kwargs)
else:
_download_fsspec(url, scratch_path, **kwargs)

shutil.move(scratch_path, local_path)
_ensure_permissions(local_path)

except PermissionError as e:
msg = (
Expand Down
Loading