loaderx 0.2.1__tar.gz → 0.4.1__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.
- loaderx-0.4.1/PKG-INFO +98 -0
- loaderx-0.4.1/README.md +54 -0
- loaderx-0.4.1/loaderx/__init__.py +4 -0
- loaderx-0.4.1/loaderx/_sampler.py +97 -0
- {loaderx-0.2.1 → loaderx-0.4.1}/loaderx/dataloader.py +1 -5
- loaderx-0.4.1/loaderx/dataset.py +39 -0
- loaderx-0.4.1/loaderx/lib/libsampler.so +0 -0
- loaderx-0.4.1/loaderx.egg-info/PKG-INFO +98 -0
- {loaderx-0.2.1 → loaderx-0.4.1}/loaderx.egg-info/SOURCES.txt +0 -1
- loaderx-0.4.1/loaderx.egg-info/requires.txt +3 -0
- {loaderx-0.2.1 → loaderx-0.4.1}/pyproject.toml +2 -2
- loaderx-0.2.1/PKG-INFO +0 -260
- loaderx-0.2.1/README.md +0 -216
- loaderx-0.2.1/loaderx/__init__.py +0 -5
- loaderx-0.2.1/loaderx/_sampler.py +0 -114
- loaderx-0.2.1/loaderx/dataset.py +0 -93
- loaderx-0.2.1/loaderx/lib/libsampler.so +0 -0
- loaderx-0.2.1/loaderx/utils.py +0 -51
- loaderx-0.2.1/loaderx.egg-info/PKG-INFO +0 -260
- loaderx-0.2.1/loaderx.egg-info/requires.txt +0 -3
- {loaderx-0.2.1 → loaderx-0.4.1}/LICENSE +0 -0
- {loaderx-0.2.1 → loaderx-0.4.1}/loaderx.egg-info/dependency_links.txt +0 -0
- {loaderx-0.2.1 → loaderx-0.4.1}/loaderx.egg-info/top_level.txt +0 -0
- {loaderx-0.2.1 → loaderx-0.4.1}/setup.cfg +0 -0
loaderx-0.4.1/PKG-INFO
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: loaderx
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: A record-based data runtime, focused on delivering extreme throughput and low latency
|
|
5
|
+
Author-email: Ben0i0d <ben0i0d@foxmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 EOELAB AI Research
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://codeberg.org/eoelab/loaderx
|
|
29
|
+
Project-URL: Documentation, https://codeberg.org/eoelab/loaderx
|
|
30
|
+
Project-URL: Source, https://codeberg.org/eoelab/loaderx
|
|
31
|
+
Project-URL: Bug Tracker, https://codeberg.org/eoelab/loaderx
|
|
32
|
+
Keywords: flax,python,dataloader
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Requires-Python: ==3.13
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
License-File: LICENSE
|
|
40
|
+
Requires-Dist: numpy
|
|
41
|
+
Requires-Dist: blosc2
|
|
42
|
+
Requires-Dist: cffi
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# Loaderx
|
|
46
|
+
A compact and high-performance single-machine data loader designed for JAX/Flax.
|
|
47
|
+
|
|
48
|
+
**Only Linux_amd64**
|
|
49
|
+
## Design Philosophy
|
|
50
|
+
|
|
51
|
+
loaderx is built around several core principles:
|
|
52
|
+
|
|
53
|
+
1. A pragmatic approach that prioritizes minimal memory overhead and minimal dependencies.
|
|
54
|
+
2. A strong focus on single-machine training workflows.
|
|
55
|
+
3. We implement based on NumPy semantics, supporting Blosc2 backends.
|
|
56
|
+
4. An **immortal (endless) step-based data loader**, rather than the traditional epoch-based design—better aligned with modern ML training practices.
|
|
57
|
+
|
|
58
|
+
## Zsampler
|
|
59
|
+
Index Generator: a high-performance sampler implemented in Zig
|
|
60
|
+
|
|
61
|
+
1. Sequential generation: indices are produced by traversing the index space in order.
|
|
62
|
+
* Sliding traversal: indices are obtained using a fixed-size sliding window. Note that in this case, the index space is treated as a circular queue to avoid truncation at the tail.
|
|
63
|
+
2. Random generation: indices are sampled randomly from the index space.
|
|
64
|
+
* Global random: a set of samples is drawn randomly from the entire index space.
|
|
65
|
+
|
|
66
|
+
## Convert a NumPy tensor to Blosc2
|
|
67
|
+
```
|
|
68
|
+
import blosc2
|
|
69
|
+
import numpy as np
|
|
70
|
+
|
|
71
|
+
np_arr = np.load('arr.npy',mmap_mode='r')
|
|
72
|
+
b2_arr = blosc2.asarray(np_arr, urlpath="arr.b2nd", mode="w")
|
|
73
|
+
```
|
|
74
|
+
Then, you can use `b2_arr` or load as `b2_arr = blosc2.open("arr.b2nd")`
|
|
75
|
+
|
|
76
|
+
## Current Limitations
|
|
77
|
+
Currently, loaderx only supports single-host environments and does not yet support multi-host training.
|
|
78
|
+
|
|
79
|
+
## Quick Start
|
|
80
|
+
```
|
|
81
|
+
from loaderx import Dataset, DataLoader
|
|
82
|
+
|
|
83
|
+
dataset = Dataset('train_data.b2nd')
|
|
84
|
+
labelset = Dataset('train_label.b2nd')
|
|
85
|
+
|
|
86
|
+
loader = DataLoader(dataset, labelset)
|
|
87
|
+
|
|
88
|
+
for i, batch in enumerate(loader):
|
|
89
|
+
if i >= 256:
|
|
90
|
+
break
|
|
91
|
+
|
|
92
|
+
print(batch['data'].shape)
|
|
93
|
+
print(batch['label'].shape)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Integrating with JAX/Flax
|
|
97
|
+
|
|
98
|
+
For practical integration examples, please refer to the **[Data2Latent](https://codeberg.org/eoelab/Data2Latent)** repository
|
loaderx-0.4.1/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Loaderx
|
|
2
|
+
A compact and high-performance single-machine data loader designed for JAX/Flax.
|
|
3
|
+
|
|
4
|
+
**Only Linux_amd64**
|
|
5
|
+
## Design Philosophy
|
|
6
|
+
|
|
7
|
+
loaderx is built around several core principles:
|
|
8
|
+
|
|
9
|
+
1. A pragmatic approach that prioritizes minimal memory overhead and minimal dependencies.
|
|
10
|
+
2. A strong focus on single-machine training workflows.
|
|
11
|
+
3. We implement based on NumPy semantics, supporting Blosc2 backends.
|
|
12
|
+
4. An **immortal (endless) step-based data loader**, rather than the traditional epoch-based design—better aligned with modern ML training practices.
|
|
13
|
+
|
|
14
|
+
## Zsampler
|
|
15
|
+
Index Generator: a high-performance sampler implemented in Zig
|
|
16
|
+
|
|
17
|
+
1. Sequential generation: indices are produced by traversing the index space in order.
|
|
18
|
+
* Sliding traversal: indices are obtained using a fixed-size sliding window. Note that in this case, the index space is treated as a circular queue to avoid truncation at the tail.
|
|
19
|
+
2. Random generation: indices are sampled randomly from the index space.
|
|
20
|
+
* Global random: a set of samples is drawn randomly from the entire index space.
|
|
21
|
+
|
|
22
|
+
## Convert a NumPy tensor to Blosc2
|
|
23
|
+
```
|
|
24
|
+
import blosc2
|
|
25
|
+
import numpy as np
|
|
26
|
+
|
|
27
|
+
np_arr = np.load('arr.npy',mmap_mode='r')
|
|
28
|
+
b2_arr = blosc2.asarray(np_arr, urlpath="arr.b2nd", mode="w")
|
|
29
|
+
```
|
|
30
|
+
Then, you can use `b2_arr` or load as `b2_arr = blosc2.open("arr.b2nd")`
|
|
31
|
+
|
|
32
|
+
## Current Limitations
|
|
33
|
+
Currently, loaderx only supports single-host environments and does not yet support multi-host training.
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
```
|
|
37
|
+
from loaderx import Dataset, DataLoader
|
|
38
|
+
|
|
39
|
+
dataset = Dataset('train_data.b2nd')
|
|
40
|
+
labelset = Dataset('train_label.b2nd')
|
|
41
|
+
|
|
42
|
+
loader = DataLoader(dataset, labelset)
|
|
43
|
+
|
|
44
|
+
for i, batch in enumerate(loader):
|
|
45
|
+
if i >= 256:
|
|
46
|
+
break
|
|
47
|
+
|
|
48
|
+
print(batch['data'].shape)
|
|
49
|
+
print(batch['label'].shape)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Integrating with JAX/Flax
|
|
53
|
+
|
|
54
|
+
For practical integration examples, please refer to the **[Data2Latent](https://codeberg.org/eoelab/Data2Latent)** repository
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import time
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
from cffi import FFI
|
|
6
|
+
|
|
7
|
+
ffi = FFI()
|
|
8
|
+
|
|
9
|
+
ffi.cdef("""
|
|
10
|
+
typedef struct Sampler Sampler;
|
|
11
|
+
|
|
12
|
+
Sampler* cinit(
|
|
13
|
+
uint64_t length,
|
|
14
|
+
uint64_t batch_size,
|
|
15
|
+
uint8_t mode,
|
|
16
|
+
uint64_t seed
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
void cdeinit(Sampler* s);
|
|
20
|
+
|
|
21
|
+
void cnext(Sampler* s, uint64_t* indices_ptr, size_t indices_len);
|
|
22
|
+
""")
|
|
23
|
+
|
|
24
|
+
lib_path = Path(__file__).resolve().parent / "lib" / "libsampler.so"
|
|
25
|
+
lib = ffi.dlopen(str(lib_path))
|
|
26
|
+
|
|
27
|
+
class Sampler:
|
|
28
|
+
class Mode:
|
|
29
|
+
SEQUENTIAL = 0
|
|
30
|
+
IID = 1
|
|
31
|
+
|
|
32
|
+
def __init__(self, length: int, batch_size: int, mode: int, seed: int = 42):
|
|
33
|
+
# sampler
|
|
34
|
+
self.sampler = lib.cinit(length, batch_size, mode, seed)
|
|
35
|
+
if self.sampler == ffi.NULL:
|
|
36
|
+
raise MemoryError("Failed to create sampler")
|
|
37
|
+
# indices
|
|
38
|
+
self.indices = np.zeros(batch_size, dtype=np.uint64)
|
|
39
|
+
|
|
40
|
+
# step
|
|
41
|
+
def next(self):
|
|
42
|
+
ptr = ffi.cast("uint64_t *", self.indices.ctypes.data)
|
|
43
|
+
lib.cnext(self.sampler, ptr, self.indices.size)
|
|
44
|
+
# return copy to avoid loss
|
|
45
|
+
return self.indices.copy()
|
|
46
|
+
|
|
47
|
+
# iterator
|
|
48
|
+
def __iter__(self):
|
|
49
|
+
return self
|
|
50
|
+
def __next__(self):
|
|
51
|
+
return self.next()
|
|
52
|
+
|
|
53
|
+
# clean
|
|
54
|
+
def __del__(self):
|
|
55
|
+
if hasattr(self, "sampler") and self.sampler != ffi.NULL:
|
|
56
|
+
lib.cdeinit(self.sampler)
|
|
57
|
+
self.sampler = ffi.NULL
|
|
58
|
+
|
|
59
|
+
def run():
|
|
60
|
+
from itertools import islice
|
|
61
|
+
length = 10
|
|
62
|
+
batch_size = 4
|
|
63
|
+
n_steps = 5
|
|
64
|
+
|
|
65
|
+
print("=== Sampler SEQUENTIAL ===")
|
|
66
|
+
sampler = Sampler(length, batch_size, Sampler.Mode.SEQUENTIAL)
|
|
67
|
+
for indices in islice(sampler, n_steps):
|
|
68
|
+
print(indices)
|
|
69
|
+
|
|
70
|
+
print("=== Sampler IID ===")
|
|
71
|
+
sampler = Sampler(length, batch_size, Sampler.Mode.IID)
|
|
72
|
+
for indices in islice(sampler, n_steps):
|
|
73
|
+
print(indices)
|
|
74
|
+
|
|
75
|
+
# Benchmark, zig-sampler speeder 3.66x
|
|
76
|
+
def bench():
|
|
77
|
+
length = 1_000_000
|
|
78
|
+
batch_size = 8192
|
|
79
|
+
n_steps = 10_000
|
|
80
|
+
|
|
81
|
+
print("=== NumPy IID ===")
|
|
82
|
+
t0 = time.time()
|
|
83
|
+
batch = np.zeros(batch_size, dtype=np.uint64)
|
|
84
|
+
for _ in range(n_steps):
|
|
85
|
+
batch[:] = np.random.randint(0, length, size=batch_size, dtype=np.uint64)
|
|
86
|
+
print(f"{(time.time() - t0)*1000:.2f} ms")
|
|
87
|
+
|
|
88
|
+
print("=== Sampler IID ===")
|
|
89
|
+
t0 = time.time()
|
|
90
|
+
sampler = Sampler(length, batch_size, Sampler.Mode.IID)
|
|
91
|
+
for _ in range(n_steps):
|
|
92
|
+
sampler.next()
|
|
93
|
+
print(f"{(time.time() - t0)*1000:.2f} ms")
|
|
94
|
+
|
|
95
|
+
if __name__ == "__main__":
|
|
96
|
+
run()
|
|
97
|
+
bench()
|
|
@@ -47,8 +47,7 @@ class DataLoader:
|
|
|
47
47
|
Sample indices from the dataset and put them into the index queue.
|
|
48
48
|
"""
|
|
49
49
|
while not self.stop_signal.is_set():
|
|
50
|
-
self.sampler.next()
|
|
51
|
-
self.indices.put(self.sampler.batch_indices.copy())
|
|
50
|
+
self.indices.put(self.sampler.next())
|
|
52
51
|
|
|
53
52
|
def _prefetch(self, transform):
|
|
54
53
|
"""
|
|
@@ -94,9 +93,6 @@ class DataLoader:
|
|
|
94
93
|
|
|
95
94
|
for thread in self.threads:
|
|
96
95
|
thread.join()
|
|
97
|
-
|
|
98
|
-
self.dataset.close()
|
|
99
|
-
self.labelset.close()
|
|
100
96
|
|
|
101
97
|
def __del__(self):
|
|
102
98
|
self.close()
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import blosc2
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
class Dataset:
|
|
5
|
+
def __init__(self, path):
|
|
6
|
+
"""
|
|
7
|
+
Initialize a dataset.
|
|
8
|
+
"""
|
|
9
|
+
self._array = blosc2.open(path)
|
|
10
|
+
def __getitem__(self, idx):
|
|
11
|
+
"""
|
|
12
|
+
Get the item at index idx from the dataset.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
idx (int): Index of the item to retrieve.
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
np.ndarray: The item at index idx from the dataset.
|
|
19
|
+
"""
|
|
20
|
+
return self._array[idx]
|
|
21
|
+
def __len__(self):
|
|
22
|
+
"""
|
|
23
|
+
Return the number of samples in the dataset.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
int: The number of samples in the dataset.
|
|
27
|
+
"""
|
|
28
|
+
return len(self._array)
|
|
29
|
+
def __getitems__(self, idxs):
|
|
30
|
+
"""
|
|
31
|
+
Get the items at index idxs from the dataset.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
idxs (list of int): indices of the items to retrieve.
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
np.ndarray: The items at index idxs from the dataset.
|
|
38
|
+
"""
|
|
39
|
+
return self._array[idxs]
|
|
Binary file
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: loaderx
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: A record-based data runtime, focused on delivering extreme throughput and low latency
|
|
5
|
+
Author-email: Ben0i0d <ben0i0d@foxmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 EOELAB AI Research
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://codeberg.org/eoelab/loaderx
|
|
29
|
+
Project-URL: Documentation, https://codeberg.org/eoelab/loaderx
|
|
30
|
+
Project-URL: Source, https://codeberg.org/eoelab/loaderx
|
|
31
|
+
Project-URL: Bug Tracker, https://codeberg.org/eoelab/loaderx
|
|
32
|
+
Keywords: flax,python,dataloader
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Requires-Python: ==3.13
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
License-File: LICENSE
|
|
40
|
+
Requires-Dist: numpy
|
|
41
|
+
Requires-Dist: blosc2
|
|
42
|
+
Requires-Dist: cffi
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# Loaderx
|
|
46
|
+
A compact and high-performance single-machine data loader designed for JAX/Flax.
|
|
47
|
+
|
|
48
|
+
**Only Linux_amd64**
|
|
49
|
+
## Design Philosophy
|
|
50
|
+
|
|
51
|
+
loaderx is built around several core principles:
|
|
52
|
+
|
|
53
|
+
1. A pragmatic approach that prioritizes minimal memory overhead and minimal dependencies.
|
|
54
|
+
2. A strong focus on single-machine training workflows.
|
|
55
|
+
3. We implement based on NumPy semantics, supporting Blosc2 backends.
|
|
56
|
+
4. An **immortal (endless) step-based data loader**, rather than the traditional epoch-based design—better aligned with modern ML training practices.
|
|
57
|
+
|
|
58
|
+
## Zsampler
|
|
59
|
+
Index Generator: a high-performance sampler implemented in Zig
|
|
60
|
+
|
|
61
|
+
1. Sequential generation: indices are produced by traversing the index space in order.
|
|
62
|
+
* Sliding traversal: indices are obtained using a fixed-size sliding window. Note that in this case, the index space is treated as a circular queue to avoid truncation at the tail.
|
|
63
|
+
2. Random generation: indices are sampled randomly from the index space.
|
|
64
|
+
* Global random: a set of samples is drawn randomly from the entire index space.
|
|
65
|
+
|
|
66
|
+
## Convert a NumPy tensor to Blosc2
|
|
67
|
+
```
|
|
68
|
+
import blosc2
|
|
69
|
+
import numpy as np
|
|
70
|
+
|
|
71
|
+
np_arr = np.load('arr.npy',mmap_mode='r')
|
|
72
|
+
b2_arr = blosc2.asarray(np_arr, urlpath="arr.b2nd", mode="w")
|
|
73
|
+
```
|
|
74
|
+
Then, you can use `b2_arr` or load as `b2_arr = blosc2.open("arr.b2nd")`
|
|
75
|
+
|
|
76
|
+
## Current Limitations
|
|
77
|
+
Currently, loaderx only supports single-host environments and does not yet support multi-host training.
|
|
78
|
+
|
|
79
|
+
## Quick Start
|
|
80
|
+
```
|
|
81
|
+
from loaderx import Dataset, DataLoader
|
|
82
|
+
|
|
83
|
+
dataset = Dataset('train_data.b2nd')
|
|
84
|
+
labelset = Dataset('train_label.b2nd')
|
|
85
|
+
|
|
86
|
+
loader = DataLoader(dataset, labelset)
|
|
87
|
+
|
|
88
|
+
for i, batch in enumerate(loader):
|
|
89
|
+
if i >= 256:
|
|
90
|
+
break
|
|
91
|
+
|
|
92
|
+
print(batch['data'].shape)
|
|
93
|
+
print(batch['label'].shape)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Integrating with JAX/Flax
|
|
97
|
+
|
|
98
|
+
For practical integration examples, please refer to the **[Data2Latent](https://codeberg.org/eoelab/Data2Latent)** repository
|
|
@@ -7,7 +7,7 @@ name = "loaderx"
|
|
|
7
7
|
dynamic = ["version"]
|
|
8
8
|
description = "A record-based data runtime, focused on delivering extreme throughput and low latency"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = "
|
|
10
|
+
requires-python = "==3.13"
|
|
11
11
|
authors = [
|
|
12
12
|
{name = "Ben0i0d", email = "ben0i0d@foxmail.com"},
|
|
13
13
|
]
|
|
@@ -19,7 +19,7 @@ classifiers = [
|
|
|
19
19
|
"License :: OSI Approved :: MIT License",
|
|
20
20
|
"Programming Language :: Python :: 3",
|
|
21
21
|
]
|
|
22
|
-
dependencies = ["numpy", "
|
|
22
|
+
dependencies = ["numpy", "blosc2", "cffi"]
|
|
23
23
|
|
|
24
24
|
[tool.setuptools]
|
|
25
25
|
packages = ["loaderx"]
|