Skip to content

Commit

Permalink
python/pytorch: add wrapper for parse_url to fix upstream torch imports
Browse files Browse the repository at this point in the history
Signed-off-by: Soham Manoli <[email protected]>
  • Loading branch information
msoham123 committed Jun 28, 2024
1 parent 0732eb9 commit b628816
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion python/aistore/pytorch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from aistore.sdk.object import Object
from aistore.sdk.bucket import Bucket
from aistore.sdk.types import ArchiveSettings
from aistore.sdk.utils import parse_url
from aistore.sdk.utils import parse_url as sdk_parse_url


def list_objects(
Expand Down Expand Up @@ -199,3 +199,17 @@ def list_wds_samples_iter(
for bucket in bucket_list:
for shard in bucket.list_objects_iter():
yield from __samples_from_bck_iter(shard.name, bucket, etl_name)


def parse_url(url: str) -> Tuple[str, str, str]:
"""
Wrapper of sdk/utils.py parse_url. Parse AIS URLs for bucket and object names.
TODO: This can be removed once the upstream torch package for aiso is updated.
Args:
url (str): Complete URL of the object (e.g., "ais://bucket1/file.txt")
Returns:
Tuple[str, str, str]: Provider, bucket name, and object name
"""
return sdk_parse_url(url)

0 comments on commit b628816

Please sign in to comment.