tostorchconnector 1.0.5__tar.gz → 1.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tostorchconnector might be problematic. Click here for more details.
- {tostorchconnector-1.0.5/tostorchconnector.egg-info → tostorchconnector-1.0.7}/PKG-INFO +3 -3
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/pyproject.toml +3 -3
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tests/test_tos_dataset.py +3 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tests/test_tosclient.py +32 -9
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tests/test_tosrawclient.py +15 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector/tos_object_reader.py +1 -2
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7/tostorchconnector.egg-info}/PKG-INFO +3 -3
- tostorchconnector-1.0.7/tostorchconnector.egg-info/requires.txt +3 -0
- tostorchconnector-1.0.5/tostorchconnector.egg-info/requires.txt +0 -3
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/LICENSE +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/README.md +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/setup.cfg +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector/__init__.py +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector/tos_checkpoint.py +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector/tos_client.py +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector/tos_common.py +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector/tos_iterable_dataset.py +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector/tos_map_dataset.py +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector/tos_object_meta.py +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector/tos_object_writer.py +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector.egg-info/SOURCES.txt +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector.egg-info/dependency_links.txt +0 -0
- {tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tostorchconnector
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: TOS connector integration for PyTorch
|
|
5
5
|
Author-email: xiangshijian <xiangshijian@bytedance.com>
|
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -14,12 +14,12 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
14
14
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Topic :: Utilities
|
|
17
|
-
Requires-Python: <3.
|
|
17
|
+
Requires-Python: <3.14,>=3.8
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
20
|
Requires-Dist: torch>=2.0
|
|
21
21
|
Requires-Dist: tos>=2.8.0
|
|
22
|
-
Requires-Dist: tosnativeclient>=1.0.
|
|
22
|
+
Requires-Dist: tosnativeclient>=1.0.4
|
|
23
23
|
Dynamic: license-file
|
|
24
24
|
|
|
25
25
|
# TOS Connector for pytorch
|
|
@@ -5,10 +5,10 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "tostorchconnector"
|
|
8
|
-
version = "1.0.
|
|
8
|
+
version = "1.0.7"
|
|
9
9
|
description = "TOS connector integration for PyTorch"
|
|
10
10
|
authors = [{ name = "xiangshijian", email = "xiangshijian@bytedance.com" }]
|
|
11
|
-
requires-python = ">=3.8,<3.
|
|
11
|
+
requires-python = ">=3.8,<3.14"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
classifiers = [
|
|
14
14
|
"Development Status :: 4 - Beta",
|
|
@@ -26,7 +26,7 @@ classifiers = [
|
|
|
26
26
|
dependencies = [
|
|
27
27
|
"torch >= 2.0",
|
|
28
28
|
"tos>=2.8.0",
|
|
29
|
-
"tosnativeclient >= 1.0.
|
|
29
|
+
"tosnativeclient >= 1.0.4"
|
|
30
30
|
]
|
|
31
31
|
|
|
32
32
|
[tool.setuptools.packages]
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import unittest
|
|
3
3
|
|
|
4
|
+
from torch.utils.data import DataLoader
|
|
5
|
+
|
|
4
6
|
from tostorchconnector import TosMapDataset, TosIterableDataset, TosCheckpoint
|
|
5
7
|
from tostorchconnector.tos_client import CredentialProvider, ReaderType
|
|
6
8
|
|
|
@@ -31,6 +33,7 @@ class TestTosDataSet(unittest.TestCase):
|
|
|
31
33
|
datasets = TosMapDataset.from_prefix(f'tos://{bucket}/prefix', region=region,
|
|
32
34
|
endpoint=endpoint, cred=CredentialProvider(ak, sk),
|
|
33
35
|
use_native_client=USE_NATIVE_CLIENT)
|
|
36
|
+
|
|
34
37
|
for i in range(len(datasets)):
|
|
35
38
|
item = datasets[i]
|
|
36
39
|
print(item.bucket, item.key)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import pickle
|
|
2
3
|
import unittest
|
|
3
4
|
import uuid
|
|
4
5
|
|
|
@@ -6,6 +7,21 @@ from tosnativeclient import TosClient, TosException
|
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class TestTosClient(unittest.TestCase):
|
|
10
|
+
def test_pickle(self):
|
|
11
|
+
region = os.getenv('TOS_REGION')
|
|
12
|
+
endpoint = os.getenv('TOS_ENDPOINT')
|
|
13
|
+
ak = os.getenv('TOS_ACCESS_KEY')
|
|
14
|
+
sk = os.getenv('TOS_SECRET_KEY')
|
|
15
|
+
bucket = 'tos-pytorch-connector'
|
|
16
|
+
tos_client = TosClient(region, endpoint, ak, sk, directives='info', directory='logs',
|
|
17
|
+
file_name_prefix='app.log')
|
|
18
|
+
pickled_tos_client = pickle.dumps(tos_client)
|
|
19
|
+
assert isinstance(pickled_tos_client, bytes)
|
|
20
|
+
unpickled_tos_client = pickle.loads(pickled_tos_client)
|
|
21
|
+
|
|
22
|
+
self._test_list_objects(bucket, unpickled_tos_client)
|
|
23
|
+
self._test_write_read_object(bucket, unpickled_tos_client)
|
|
24
|
+
|
|
9
25
|
def test_list_objects(self):
|
|
10
26
|
region = os.getenv('TOS_REGION')
|
|
11
27
|
endpoint = os.getenv('TOS_ENDPOINT')
|
|
@@ -14,7 +30,20 @@ class TestTosClient(unittest.TestCase):
|
|
|
14
30
|
bucket = 'tos-pytorch-connector'
|
|
15
31
|
tos_client = TosClient(region, endpoint, ak, sk, directives='info', directory='logs',
|
|
16
32
|
file_name_prefix='app.log')
|
|
33
|
+
self._test_list_objects(bucket, tos_client)
|
|
17
34
|
|
|
35
|
+
def test_write_read_object(self):
|
|
36
|
+
region = os.getenv('TOS_REGION')
|
|
37
|
+
endpoint = os.getenv('TOS_ENDPOINT')
|
|
38
|
+
ak = os.getenv('TOS_ACCESS_KEY')
|
|
39
|
+
sk = os.getenv('TOS_SECRET_KEY')
|
|
40
|
+
bucket = 'tos-pytorch-connector'
|
|
41
|
+
tos_client = TosClient(region, endpoint, ak, sk, directives='info', directory='logs',
|
|
42
|
+
file_name_prefix='app.log')
|
|
43
|
+
|
|
44
|
+
self._test_write_read_object(bucket, tos_client)
|
|
45
|
+
|
|
46
|
+
def _test_list_objects(self, bucket, tos_client):
|
|
18
47
|
list_stream = tos_client.list_objects(bucket, '', max_keys=1000)
|
|
19
48
|
count = 0
|
|
20
49
|
try:
|
|
@@ -30,15 +59,7 @@ class TestTosClient(unittest.TestCase):
|
|
|
30
59
|
except TosException as e:
|
|
31
60
|
print(e.args[0].message)
|
|
32
61
|
|
|
33
|
-
def
|
|
34
|
-
region = os.getenv('TOS_REGION')
|
|
35
|
-
endpoint = os.getenv('TOS_ENDPOINT')
|
|
36
|
-
ak = os.getenv('TOS_ACCESS_KEY')
|
|
37
|
-
sk = os.getenv('TOS_SECRET_KEY')
|
|
38
|
-
bucket = 'tos-pytorch-connector'
|
|
39
|
-
tos_client = TosClient(region, endpoint, ak, sk, directives='info', directory='logs',
|
|
40
|
-
file_name_prefix='app.log')
|
|
41
|
-
|
|
62
|
+
def _test_write_read_object(self, bucket, tos_client):
|
|
42
63
|
key = str(uuid.uuid4())
|
|
43
64
|
read_stream = tos_client.get_object(bucket, key, '', 1)
|
|
44
65
|
|
|
@@ -59,6 +80,8 @@ class TestTosClient(unittest.TestCase):
|
|
|
59
80
|
write_stream.close()
|
|
60
81
|
|
|
61
82
|
output = tos_client.head_object(bucket, key)
|
|
83
|
+
print(output.etag, output.size)
|
|
84
|
+
|
|
62
85
|
read_stream = tos_client.get_object(bucket, key, output.etag, output.size)
|
|
63
86
|
try:
|
|
64
87
|
offset = 0
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import io
|
|
1
2
|
import os
|
|
2
3
|
import unittest
|
|
3
4
|
import uuid
|
|
@@ -47,6 +48,20 @@ class TestTosRawClient(unittest.TestCase):
|
|
|
47
48
|
rdata = goutput.read_all()
|
|
48
49
|
assert rdata == data
|
|
49
50
|
|
|
51
|
+
goutput: GetObjectOutput = tos_raw_client.get_object(GetObjectInput(bucket, key))
|
|
52
|
+
assert goutput.status_code == 200
|
|
53
|
+
assert goutput.etag == poutput.etag
|
|
54
|
+
|
|
55
|
+
rdata = io.BytesIO()
|
|
56
|
+
while 1:
|
|
57
|
+
chunk = goutput.read()
|
|
58
|
+
if not chunk:
|
|
59
|
+
break
|
|
60
|
+
rdata.write(chunk)
|
|
61
|
+
|
|
62
|
+
rdata.seek(0)
|
|
63
|
+
assert rdata.read() == data
|
|
64
|
+
|
|
50
65
|
doutput = tos_raw_client.delete_object(DeleteObjectInput(bucket, key))
|
|
51
66
|
assert doutput.status_code == 204
|
|
52
67
|
|
|
@@ -244,11 +244,10 @@ class SequentialTosObjectReader(TosObjectReader):
|
|
|
244
244
|
while offset > size:
|
|
245
245
|
chunk = self._object_stream.sequential_read(DEFAULT_CHUNK_SIZE)
|
|
246
246
|
if not chunk:
|
|
247
|
+
self._total_size = self._buffer.tell()
|
|
247
248
|
break
|
|
248
249
|
size += self._buffer.write(chunk)
|
|
249
250
|
|
|
250
|
-
self._total_size = self._buffer.tell()
|
|
251
|
-
|
|
252
251
|
def _buffer_size(self) -> int:
|
|
253
252
|
cur_pos = self._buffer.tell()
|
|
254
253
|
self._buffer.seek(0, SEEK_END)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tostorchconnector
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: TOS connector integration for PyTorch
|
|
5
5
|
Author-email: xiangshijian <xiangshijian@bytedance.com>
|
|
6
6
|
Classifier: Development Status :: 4 - Beta
|
|
@@ -14,12 +14,12 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
14
14
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Topic :: Utilities
|
|
17
|
-
Requires-Python: <3.
|
|
17
|
+
Requires-Python: <3.14,>=3.8
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
20
|
Requires-Dist: torch>=2.0
|
|
21
21
|
Requires-Dist: tos>=2.8.0
|
|
22
|
-
Requires-Dist: tosnativeclient>=1.0.
|
|
22
|
+
Requires-Dist: tosnativeclient>=1.0.4
|
|
23
23
|
Dynamic: license-file
|
|
24
24
|
|
|
25
25
|
# TOS Connector for pytorch
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector/tos_iterable_dataset.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{tostorchconnector-1.0.5 → tostorchconnector-1.0.7}/tostorchconnector.egg-info/top_level.txt
RENAMED
|
File without changes
|