loaderx 2.3.8__tar.gz → 2.4.0__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.
Files changed (110) hide show
  1. {loaderx-2.3.8/loaderx.egg-info → loaderx-2.4.0}/PKG-INFO +50 -39
  2. {loaderx-2.3.8 → loaderx-2.4.0}/README.md +49 -38
  3. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx/__init__.py +1 -1
  4. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx/converter.py +101 -44
  5. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx/zrecord.py +105 -6
  6. {loaderx-2.3.8 → loaderx-2.4.0/loaderx.egg-info}/PKG-INFO +50 -39
  7. {loaderx-2.3.8 → loaderx-2.4.0}/scripts/test_loaderx.py +143 -15
  8. {loaderx-2.3.8 → loaderx-2.4.0}/LICENSE +0 -0
  9. {loaderx-2.3.8 → loaderx-2.4.0}/MANIFEST.in +0 -0
  10. {loaderx-2.3.8 → loaderx-2.4.0}/build.zig +0 -0
  11. {loaderx-2.3.8 → loaderx-2.4.0}/build.zig.zon +0 -0
  12. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx/_lib.py +0 -0
  13. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx/_store.py +0 -0
  14. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx/dataloader.py +0 -0
  15. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx/utils.py +0 -0
  16. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx/zsampler.py +0 -0
  17. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx.egg-info/SOURCES.txt +0 -0
  18. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx.egg-info/dependency_links.txt +0 -0
  19. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx.egg-info/requires.txt +0 -0
  20. {loaderx-2.3.8 → loaderx-2.4.0}/loaderx.egg-info/top_level.txt +0 -0
  21. {loaderx-2.3.8 → loaderx-2.4.0}/pyproject.toml +0 -0
  22. {loaderx-2.3.8 → loaderx-2.4.0}/scripts/_bench_common.py +0 -0
  23. {loaderx-2.3.8 → loaderx-2.4.0}/scripts/bench.py +0 -0
  24. {loaderx-2.3.8 → loaderx-2.4.0}/scripts/bench_dense.py +0 -0
  25. {loaderx-2.3.8 → loaderx-2.4.0}/scripts/bench_ragged.py +0 -0
  26. {loaderx-2.3.8 → loaderx-2.4.0}/scripts/build_wheels.py +0 -0
  27. {loaderx-2.3.8 → loaderx-2.4.0}/scripts/prepare_tokens.py +0 -0
  28. {loaderx-2.3.8 → loaderx-2.4.0}/scripts/prepare_vision.py +0 -0
  29. {loaderx-2.3.8 → loaderx-2.4.0}/scripts/requirements-bench.txt +0 -0
  30. {loaderx-2.3.8 → loaderx-2.4.0}/setup.cfg +0 -0
  31. {loaderx-2.3.8 → loaderx-2.4.0}/setup.py +0 -0
  32. {loaderx-2.3.8 → loaderx-2.4.0}/src/record/engine.zig +0 -0
  33. {loaderx-2.3.8 → loaderx-2.4.0}/src/record/executor.zig +0 -0
  34. {loaderx-2.3.8 → loaderx-2.4.0}/src/record/storage.zig +0 -0
  35. {loaderx-2.3.8 → loaderx-2.4.0}/src/store.zig +0 -0
  36. {loaderx-2.3.8 → loaderx-2.4.0}/src/zsampler.zig +0 -0
  37. {loaderx-2.3.8 → loaderx-2.4.0}/src/zstd/c.zig +0 -0
  38. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/COPYING +0 -0
  39. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/LICENSE +0 -0
  40. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/allocations.h +0 -0
  41. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/bits.h +0 -0
  42. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/bitstream.h +0 -0
  43. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/compiler.h +0 -0
  44. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/cpu.h +0 -0
  45. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/debug.c +0 -0
  46. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/debug.h +0 -0
  47. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/entropy_common.c +0 -0
  48. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/error_private.c +0 -0
  49. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/error_private.h +0 -0
  50. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/fse.h +0 -0
  51. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/fse_decompress.c +0 -0
  52. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/huf.h +0 -0
  53. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/mem.h +0 -0
  54. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/pool.c +0 -0
  55. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/pool.h +0 -0
  56. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/portability_macros.h +0 -0
  57. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/threading.c +0 -0
  58. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/threading.h +0 -0
  59. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/xxhash.c +0 -0
  60. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/xxhash.h +0 -0
  61. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/zstd_common.c +0 -0
  62. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/zstd_deps.h +0 -0
  63. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/zstd_internal.h +0 -0
  64. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/common/zstd_trace.h +0 -0
  65. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/clevels.h +0 -0
  66. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/fse_compress.c +0 -0
  67. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/hist.c +0 -0
  68. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/hist.h +0 -0
  69. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/huf_compress.c +0 -0
  70. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_compress.c +0 -0
  71. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_compress_internal.h +0 -0
  72. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_compress_literals.c +0 -0
  73. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_compress_literals.h +0 -0
  74. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_compress_sequences.c +0 -0
  75. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_compress_sequences.h +0 -0
  76. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_compress_superblock.c +0 -0
  77. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_compress_superblock.h +0 -0
  78. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_cwksp.h +0 -0
  79. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_double_fast.c +0 -0
  80. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_double_fast.h +0 -0
  81. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_fast.c +0 -0
  82. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_fast.h +0 -0
  83. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_lazy.c +0 -0
  84. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_lazy.h +0 -0
  85. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_ldm.c +0 -0
  86. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_ldm.h +0 -0
  87. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_ldm_geartab.h +0 -0
  88. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_opt.c +0 -0
  89. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_opt.h +0 -0
  90. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_preSplit.c +0 -0
  91. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstd_preSplit.h +0 -0
  92. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstdmt_compress.c +0 -0
  93. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/compress/zstdmt_compress.h +0 -0
  94. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/decompress/huf_decompress.c +0 -0
  95. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/decompress/huf_decompress_amd64.S +0 -0
  96. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/decompress/zstd_ddict.c +0 -0
  97. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/decompress/zstd_ddict.h +0 -0
  98. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/decompress/zstd_decompress.c +0 -0
  99. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/decompress/zstd_decompress_block.c +0 -0
  100. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/decompress/zstd_decompress_block.h +0 -0
  101. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/decompress/zstd_decompress_internal.h +0 -0
  102. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/dictBuilder/cover.c +0 -0
  103. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/dictBuilder/cover.h +0 -0
  104. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/dictBuilder/divsufsort.c +0 -0
  105. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/dictBuilder/divsufsort.h +0 -0
  106. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/dictBuilder/fastcover.c +0 -0
  107. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/dictBuilder/zdict.c +0 -0
  108. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/zdict.h +0 -0
  109. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/zstd.h +0 -0
  110. {loaderx-2.3.8 → loaderx-2.4.0}/vendor/zstd/lib/zstd_errors.h +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: loaderx
3
- Version: 2.3.8
3
+ Version: 2.4.0
4
4
  Summary: Rebuildable high-performance ordered record containers
5
5
  Author-email: Ben0i0d <ben0i0d@foxmail.com>
6
6
  License-Expression: MIT
@@ -120,7 +120,6 @@ convert(
120
120
  dataset,
121
121
  "mnist",
122
122
  codec="zstd",
123
- batch_size=256,
124
123
  )
125
124
  ```
126
125
 
@@ -128,8 +127,9 @@ convert(
128
127
  snapshot, then downloads and returns the repository's DatasetDict. Repositories
129
128
  without one default config require `config=...`. `convert` is the independent
130
129
  persistence stage: it accepts that DatasetDict or one already normalized
131
- Dataset. `batch_size` bounds records per Python batch; actual bytes also depend
132
- on record sizes and Ragged packing.
130
+ Dataset. Conversion batches are bounded internally by decoded numeric bytes,
131
+ not a public row-count parameter; they flush at 32K records or near 64 MiB,
132
+ whichever comes first.
133
133
  For private or gated repositories, pass `token="hf_..."`; `None` uses the
134
134
  standard HF environment, local login, or anonymous access.
135
135
  Static or regularly batched numeric arrays become Dense stores, while dynamic
@@ -138,8 +138,9 @@ arrays become Ragged stores; source dtype and record shape are preserved.
138
138
  Zrecord persists numeric tensors rather than Python objects. A standard HF
139
139
  feature that cannot be represented losslessly fails with its column name;
140
140
  conversion does not filter, pad, tokenize, reshape, or run a transform stage.
141
- Arrow dtypes, including float64 and uint64, are preserved. Only the current
142
- batch is formatted; `with_format` never materializes the complete dataset.
141
+ Arrow dtypes, including float64 and uint64, are preserved. Hugging Face formats
142
+ only bounded decode slices; the converter retains their numeric results only
143
+ until the byte-aware append boundary and never formats the complete dataset.
143
144
 
144
145
  The result groups aligned streams under one published root:
145
146
 
@@ -267,10 +268,12 @@ with Dense.open("events") as events:
267
268
  ```
268
269
 
269
270
  Ragged creators may consume a one-pass iterable, while Dense creators take
270
- explicit ndarray batches. Concurrent append calls are serialized by the native
271
- writer lock, but their batch order is the lock-acquisition order rather than
272
- Python call-start order; sequence builders that require an external temporal
273
- order should use one producer or order batches before append.
271
+ explicit ndarray batches. Dense concurrent append calls are serialized by the
272
+ native writer lock, and their batch order is lock-acquisition order. Ragged
273
+ creators serialize packing and bounded submission through one producer lock;
274
+ their batches reach the native writer in FIFO submission order. Sequence
275
+ builders that require an external temporal order should still use one producer
276
+ or order batches before append.
274
277
 
275
278
  A ``DataLoader`` dynamically composes a dict of dense and ragged streams.
276
279
  Collation is the ``transform`` — a batch dict in, a batch dict out:
@@ -325,7 +328,10 @@ batch extends the logical sequence without exposing native physical completion
325
328
  order.
326
329
  Dense append is synchronous and borrows an already-contiguous ndarray without a
327
330
  snapshot copy. Ragged append consumes its iterable once into one owned packed
328
- buffer, then completes the native append before returning. Nothing is inferred.
331
+ buffer, then submits it to the creator's ``Queue(maxsize=1)`` writer. The next
332
+ Ragged batch can be packed while the native engine writes the current batch;
333
+ ``len()`` counts accepted records and ``close()`` drains them before publishing.
334
+ Nothing is inferred.
329
335
 
330
336
  ```python
331
337
  from loaderx.zrecord import Dense, Ragged
@@ -337,8 +343,8 @@ ds.append(single_image[None]) # one sample is batch_size 1 — add the ax
337
343
  ds.close() # publish before opening
338
344
 
339
345
  tok = Ragged.create('tokens', dtype=np.int32, ndim=1, codec='zstd')
340
- tok.append([seq_a, seq_b, seq_c])
341
- tok.close()
346
+ tok.append([seq_a, seq_b, seq_c]) # owned batch accepted by the bounded writer
347
+ tok.close() # drain, then publish
342
348
 
343
349
  with Dense.open('mnist/x') as ds:
344
350
  first_four = ds[:4] # opened containers are read-only
@@ -349,9 +355,12 @@ the native Header, must be in `1..255`, and defaults to four. Values near the
349
355
  writer lane count spread payload writes across independent files; opening a
350
356
  completed container discovers the value automatically.
351
357
 
352
- Dense and Ragged append both report native errors in the current call and return
353
- only after accepting the batch. A writer cannot be read, and a reader cannot be
354
- appended to. ``close()`` on a writer publishes the container Header;
358
+ Dense append reports native errors in the current call. Ragged validation errors
359
+ are direct; a background native error poisons that creator and is reported by a
360
+ later append or ``close()``. A failed build is discarded and rebuilt rather than
361
+ recovered; deterministic ``close()`` or a context manager is required to observe
362
+ writer errors. A writer cannot be read, and a reader cannot be appended to.
363
+ ``close()`` on a writer publishes the container Header;
355
364
  ``close()`` on a reader releases it. Dense, Ragged, and DataLoader support
356
365
  ``with`` for scoped lifetimes. Content is never changed in place: rerun the
357
366
  authoritative build at a new path, validate it, then switch consumers to it.
@@ -559,7 +568,9 @@ so CFFI, NumPy allocation, and Ragged list/shape reconstruction are timed.
559
568
  The comparison matrix began as one complete run on a warm page cache. Most Store
560
569
  matrices and the loader rows were refreshed on 2.3.6 with the default
561
570
  `data_shards=4`; the Dense token matrix was refreshed on 2.3.8 after the append
562
- window increased to 32,768 records. Every workload uses a prepared real source.
571
+ window increased to 32,768 records. Both Ragged matrices were refreshed after
572
+ the bounded writer began overlapping owned packing with native append. Every
573
+ workload uses a prepared real source.
563
574
  These are not three-run medians: an unexpected result is traced separately
564
575
  instead of being hidden by repeated aggregation. Within each store workload every
565
576
  backend receives identical source records. Correctness and timing use independent
@@ -676,23 +687,23 @@ list or a one-dimensional variable-length abstraction is not enough.
676
687
 
677
688
  | backend | logical write | logical gather | krecords/s | p95 | disk | ratio |
678
689
  |---|---:|---:|---:|---:|---:|---:|
679
- | zrecord-zstd | 852 MiB/s | 4546 MiB/s | 9.1 | 49.35 ms | 1032.2 MiB | 1.21x |
680
- | zrecord-zstdict | 705 MiB/s | 4493 MiB/s | 8.9 | 49.94 ms | 1032.9 MiB | 1.21x |
681
- | zrecord-raw | 2080 MiB/s | 13367 MiB/s | 26.7 | 13.74 ms | 1252.4 MiB | 1.00x |
682
- | hdf5-raw | 1909 MiB/s | 2302 MiB/s | 4.6 | 69.05 ms | 1253.1 MiB | 1.00x |
683
- | lmdb-raw | 1818 MiB/s | 8758 MiB/s | 17.5 | 23.61 ms | 1257.0 MiB | 1.00x |
684
- | arrow-ipc-raw | 1346 MiB/s | 4567 MiB/s | 9.1 | 41.32 ms | 1252.4 MiB | 1.00x |
685
- | parquet-raw | 722 MiB/s | 513 MiB/s | 1.0 | 283.13 ms | 1252.4 MiB | 1.00x |
686
- | arrayrecord-raw | 1644 MiB/s | 2753 MiB/s | 5.5 | 64.37 ms | 1253.0 MiB | 1.00x |
687
- | arrayrecord-zstd | 188 MiB/s | 2008 MiB/s | 4.0 | 95.29 ms | 1054.6 MiB | 1.19x |
688
-
689
- Zrecord-raw is 1.5x LMDB and 2.9x Arrow IPC in logical gather. Plain and
690
+ | zrecord-zstd | 1077 MiB/s | 5160 MiB/s | 10.3 | 46.26 ms | 1032.2 MiB | 1.21x |
691
+ | zrecord-zstdict | 815 MiB/s | 5075 MiB/s | 10.1 | 44.99 ms | 1032.9 MiB | 1.21x |
692
+ | zrecord-raw | 2407 MiB/s | 13793 MiB/s | 27.6 | 13.97 ms | 1252.4 MiB | 1.00x |
693
+ | hdf5-raw | 1879 MiB/s | 2336 MiB/s | 4.7 | 64.39 ms | 1253.1 MiB | 1.00x |
694
+ | lmdb-raw | 1779 MiB/s | 9218 MiB/s | 18.4 | 21.76 ms | 1257.0 MiB | 1.00x |
695
+ | arrow-ipc-raw | 1348 MiB/s | 4416 MiB/s | 8.8 | 40.51 ms | 1252.4 MiB | 1.00x |
696
+ | parquet-raw | 713 MiB/s | 512 MiB/s | 1.0 | 281.02 ms | 1252.4 MiB | 1.00x |
697
+ | arrayrecord-raw | 1877 MiB/s | 2839 MiB/s | 5.7 | 68.32 ms | 1253.0 MiB | 1.00x |
698
+ | arrayrecord-zstd | 215 MiB/s | 2074 MiB/s | 4.1 | 92.45 ms | 1054.6 MiB | 1.19x |
699
+
700
+ Zrecord-raw is 1.5x LMDB and 3.1x Arrow IPC in logical gather. Plain and
690
701
  dictionary zstd both reach 1.21x, confirming that dictionary mode is not useful
691
702
  for these large photographs. The Ragged matrix is intentionally asymmetric:
692
703
  HDF5 gzip, Arrow IPC zstd and Parquet zstd adapters are not implemented because
693
704
  the real 256-record batch took 1.1–1.7 seconds; TileDB variable queries took
694
705
  8.6–9.6 seconds and the backend was removed entirely. ArrayRecord zstd remains
695
- because its batch p95 is 95 ms.
706
+ because its batch p95 is 92 ms.
696
707
 
697
708
  ### Small Token Records
698
709
 
@@ -736,18 +747,18 @@ with exact `int32` values and original one-dimensional shapes.
736
747
 
737
748
  | backend | logical write | logical gather | krecords/s | p95 | disk | ratio |
738
749
  |---|---:|---:|---:|---:|---:|---:|
739
- | zrecord-zstd | 268 MiB/s | 337 MiB/s | 637.3 | 0.52 ms | 67.4 MiB | 1.57x |
740
- | zrecord-zstdict | 368 MiB/s | 367 MiB/s | 692.8 | 0.49 ms | 53.0 MiB | 2.00x |
741
- | zrecord-raw | 682 MiB/s | 434 MiB/s | 819.1 | 0.41 ms | 110.5 MiB | 0.96x |
742
- | lmdb-raw | 316 MiB/s | 108 MiB/s | 204.2 | 1.53 ms | 151.8 MiB | 0.70x |
743
- | arrow-ipc-raw | 317 MiB/s | 42 MiB/s | 80.3 | 4.65 ms | 109.1 MiB | 0.97x |
744
- | arrayrecord-raw | 291 MiB/s | 28 MiB/s | 52.7 | 7.63 ms | 118.0 MiB | 0.90x |
745
- | arrayrecord-zstd | 59 MiB/s | 29 MiB/s | 55.2 | 5.71 ms | 76.0 MiB | 1.39x |
750
+ | zrecord-zstd | 499 MiB/s | 369 MiB/s | 697.7 | 0.49 ms | 67.4 MiB | 1.57x |
751
+ | zrecord-zstdict | 587 MiB/s | 409 MiB/s | 771.9 | 0.44 ms | 53.0 MiB | 2.00x |
752
+ | zrecord-raw | 668 MiB/s | 469 MiB/s | 885.7 | 0.39 ms | 110.5 MiB | 0.96x |
753
+ | lmdb-raw | 369 MiB/s | 114 MiB/s | 214.6 | 2.10 ms | 151.8 MiB | 0.70x |
754
+ | arrow-ipc-raw | 345 MiB/s | 45 MiB/s | 85.0 | 4.11 ms | 109.1 MiB | 0.97x |
755
+ | arrayrecord-raw | 282 MiB/s | 26 MiB/s | 49.5 | 8.08 ms | 118.0 MiB | 0.90x |
756
+ | arrayrecord-zstd | 62 MiB/s | 28 MiB/s | 52.2 | 6.22 ms | 76.0 MiB | 1.39x |
746
757
 
747
758
  Here the record contract, not bulk byte bandwidth, is the useful scale.
748
- Zrecord's three codecs return 637–819 krecords/s with 0.41–0.52 ms p95.
749
- Dictionary zstd writes 37% faster than plain zstd, uses 21% less disk and gathers
750
- 9% faster in this pass.
759
+ Zrecord's three codecs return 698–886 krecords/s with 0.39–0.49 ms p95.
760
+ Dictionary zstd writes 18% faster than plain zstd, uses 21% less disk and gathers
761
+ 11% faster in this pass.
751
762
 
752
763
  ### Sampler
753
764
 
@@ -93,7 +93,6 @@ convert(
93
93
  dataset,
94
94
  "mnist",
95
95
  codec="zstd",
96
- batch_size=256,
97
96
  )
98
97
  ```
99
98
 
@@ -101,8 +100,9 @@ convert(
101
100
  snapshot, then downloads and returns the repository's DatasetDict. Repositories
102
101
  without one default config require `config=...`. `convert` is the independent
103
102
  persistence stage: it accepts that DatasetDict or one already normalized
104
- Dataset. `batch_size` bounds records per Python batch; actual bytes also depend
105
- on record sizes and Ragged packing.
103
+ Dataset. Conversion batches are bounded internally by decoded numeric bytes,
104
+ not a public row-count parameter; they flush at 32K records or near 64 MiB,
105
+ whichever comes first.
106
106
  For private or gated repositories, pass `token="hf_..."`; `None` uses the
107
107
  standard HF environment, local login, or anonymous access.
108
108
  Static or regularly batched numeric arrays become Dense stores, while dynamic
@@ -111,8 +111,9 @@ arrays become Ragged stores; source dtype and record shape are preserved.
111
111
  Zrecord persists numeric tensors rather than Python objects. A standard HF
112
112
  feature that cannot be represented losslessly fails with its column name;
113
113
  conversion does not filter, pad, tokenize, reshape, or run a transform stage.
114
- Arrow dtypes, including float64 and uint64, are preserved. Only the current
115
- batch is formatted; `with_format` never materializes the complete dataset.
114
+ Arrow dtypes, including float64 and uint64, are preserved. Hugging Face formats
115
+ only bounded decode slices; the converter retains their numeric results only
116
+ until the byte-aware append boundary and never formats the complete dataset.
116
117
 
117
118
  The result groups aligned streams under one published root:
118
119
 
@@ -240,10 +241,12 @@ with Dense.open("events") as events:
240
241
  ```
241
242
 
242
243
  Ragged creators may consume a one-pass iterable, while Dense creators take
243
- explicit ndarray batches. Concurrent append calls are serialized by the native
244
- writer lock, but their batch order is the lock-acquisition order rather than
245
- Python call-start order; sequence builders that require an external temporal
246
- order should use one producer or order batches before append.
244
+ explicit ndarray batches. Dense concurrent append calls are serialized by the
245
+ native writer lock, and their batch order is lock-acquisition order. Ragged
246
+ creators serialize packing and bounded submission through one producer lock;
247
+ their batches reach the native writer in FIFO submission order. Sequence
248
+ builders that require an external temporal order should still use one producer
249
+ or order batches before append.
247
250
 
248
251
  A ``DataLoader`` dynamically composes a dict of dense and ragged streams.
249
252
  Collation is the ``transform`` — a batch dict in, a batch dict out:
@@ -298,7 +301,10 @@ batch extends the logical sequence without exposing native physical completion
298
301
  order.
299
302
  Dense append is synchronous and borrows an already-contiguous ndarray without a
300
303
  snapshot copy. Ragged append consumes its iterable once into one owned packed
301
- buffer, then completes the native append before returning. Nothing is inferred.
304
+ buffer, then submits it to the creator's ``Queue(maxsize=1)`` writer. The next
305
+ Ragged batch can be packed while the native engine writes the current batch;
306
+ ``len()`` counts accepted records and ``close()`` drains them before publishing.
307
+ Nothing is inferred.
302
308
 
303
309
  ```python
304
310
  from loaderx.zrecord import Dense, Ragged
@@ -310,8 +316,8 @@ ds.append(single_image[None]) # one sample is batch_size 1 — add the ax
310
316
  ds.close() # publish before opening
311
317
 
312
318
  tok = Ragged.create('tokens', dtype=np.int32, ndim=1, codec='zstd')
313
- tok.append([seq_a, seq_b, seq_c])
314
- tok.close()
319
+ tok.append([seq_a, seq_b, seq_c]) # owned batch accepted by the bounded writer
320
+ tok.close() # drain, then publish
315
321
 
316
322
  with Dense.open('mnist/x') as ds:
317
323
  first_four = ds[:4] # opened containers are read-only
@@ -322,9 +328,12 @@ the native Header, must be in `1..255`, and defaults to four. Values near the
322
328
  writer lane count spread payload writes across independent files; opening a
323
329
  completed container discovers the value automatically.
324
330
 
325
- Dense and Ragged append both report native errors in the current call and return
326
- only after accepting the batch. A writer cannot be read, and a reader cannot be
327
- appended to. ``close()`` on a writer publishes the container Header;
331
+ Dense append reports native errors in the current call. Ragged validation errors
332
+ are direct; a background native error poisons that creator and is reported by a
333
+ later append or ``close()``. A failed build is discarded and rebuilt rather than
334
+ recovered; deterministic ``close()`` or a context manager is required to observe
335
+ writer errors. A writer cannot be read, and a reader cannot be appended to.
336
+ ``close()`` on a writer publishes the container Header;
328
337
  ``close()`` on a reader releases it. Dense, Ragged, and DataLoader support
329
338
  ``with`` for scoped lifetimes. Content is never changed in place: rerun the
330
339
  authoritative build at a new path, validate it, then switch consumers to it.
@@ -532,7 +541,9 @@ so CFFI, NumPy allocation, and Ragged list/shape reconstruction are timed.
532
541
  The comparison matrix began as one complete run on a warm page cache. Most Store
533
542
  matrices and the loader rows were refreshed on 2.3.6 with the default
534
543
  `data_shards=4`; the Dense token matrix was refreshed on 2.3.8 after the append
535
- window increased to 32,768 records. Every workload uses a prepared real source.
544
+ window increased to 32,768 records. Both Ragged matrices were refreshed after
545
+ the bounded writer began overlapping owned packing with native append. Every
546
+ workload uses a prepared real source.
536
547
  These are not three-run medians: an unexpected result is traced separately
537
548
  instead of being hidden by repeated aggregation. Within each store workload every
538
549
  backend receives identical source records. Correctness and timing use independent
@@ -649,23 +660,23 @@ list or a one-dimensional variable-length abstraction is not enough.
649
660
 
650
661
  | backend | logical write | logical gather | krecords/s | p95 | disk | ratio |
651
662
  |---|---:|---:|---:|---:|---:|---:|
652
- | zrecord-zstd | 852 MiB/s | 4546 MiB/s | 9.1 | 49.35 ms | 1032.2 MiB | 1.21x |
653
- | zrecord-zstdict | 705 MiB/s | 4493 MiB/s | 8.9 | 49.94 ms | 1032.9 MiB | 1.21x |
654
- | zrecord-raw | 2080 MiB/s | 13367 MiB/s | 26.7 | 13.74 ms | 1252.4 MiB | 1.00x |
655
- | hdf5-raw | 1909 MiB/s | 2302 MiB/s | 4.6 | 69.05 ms | 1253.1 MiB | 1.00x |
656
- | lmdb-raw | 1818 MiB/s | 8758 MiB/s | 17.5 | 23.61 ms | 1257.0 MiB | 1.00x |
657
- | arrow-ipc-raw | 1346 MiB/s | 4567 MiB/s | 9.1 | 41.32 ms | 1252.4 MiB | 1.00x |
658
- | parquet-raw | 722 MiB/s | 513 MiB/s | 1.0 | 283.13 ms | 1252.4 MiB | 1.00x |
659
- | arrayrecord-raw | 1644 MiB/s | 2753 MiB/s | 5.5 | 64.37 ms | 1253.0 MiB | 1.00x |
660
- | arrayrecord-zstd | 188 MiB/s | 2008 MiB/s | 4.0 | 95.29 ms | 1054.6 MiB | 1.19x |
661
-
662
- Zrecord-raw is 1.5x LMDB and 2.9x Arrow IPC in logical gather. Plain and
663
+ | zrecord-zstd | 1077 MiB/s | 5160 MiB/s | 10.3 | 46.26 ms | 1032.2 MiB | 1.21x |
664
+ | zrecord-zstdict | 815 MiB/s | 5075 MiB/s | 10.1 | 44.99 ms | 1032.9 MiB | 1.21x |
665
+ | zrecord-raw | 2407 MiB/s | 13793 MiB/s | 27.6 | 13.97 ms | 1252.4 MiB | 1.00x |
666
+ | hdf5-raw | 1879 MiB/s | 2336 MiB/s | 4.7 | 64.39 ms | 1253.1 MiB | 1.00x |
667
+ | lmdb-raw | 1779 MiB/s | 9218 MiB/s | 18.4 | 21.76 ms | 1257.0 MiB | 1.00x |
668
+ | arrow-ipc-raw | 1348 MiB/s | 4416 MiB/s | 8.8 | 40.51 ms | 1252.4 MiB | 1.00x |
669
+ | parquet-raw | 713 MiB/s | 512 MiB/s | 1.0 | 281.02 ms | 1252.4 MiB | 1.00x |
670
+ | arrayrecord-raw | 1877 MiB/s | 2839 MiB/s | 5.7 | 68.32 ms | 1253.0 MiB | 1.00x |
671
+ | arrayrecord-zstd | 215 MiB/s | 2074 MiB/s | 4.1 | 92.45 ms | 1054.6 MiB | 1.19x |
672
+
673
+ Zrecord-raw is 1.5x LMDB and 3.1x Arrow IPC in logical gather. Plain and
663
674
  dictionary zstd both reach 1.21x, confirming that dictionary mode is not useful
664
675
  for these large photographs. The Ragged matrix is intentionally asymmetric:
665
676
  HDF5 gzip, Arrow IPC zstd and Parquet zstd adapters are not implemented because
666
677
  the real 256-record batch took 1.1–1.7 seconds; TileDB variable queries took
667
678
  8.6–9.6 seconds and the backend was removed entirely. ArrayRecord zstd remains
668
- because its batch p95 is 95 ms.
679
+ because its batch p95 is 92 ms.
669
680
 
670
681
  ### Small Token Records
671
682
 
@@ -709,18 +720,18 @@ with exact `int32` values and original one-dimensional shapes.
709
720
 
710
721
  | backend | logical write | logical gather | krecords/s | p95 | disk | ratio |
711
722
  |---|---:|---:|---:|---:|---:|---:|
712
- | zrecord-zstd | 268 MiB/s | 337 MiB/s | 637.3 | 0.52 ms | 67.4 MiB | 1.57x |
713
- | zrecord-zstdict | 368 MiB/s | 367 MiB/s | 692.8 | 0.49 ms | 53.0 MiB | 2.00x |
714
- | zrecord-raw | 682 MiB/s | 434 MiB/s | 819.1 | 0.41 ms | 110.5 MiB | 0.96x |
715
- | lmdb-raw | 316 MiB/s | 108 MiB/s | 204.2 | 1.53 ms | 151.8 MiB | 0.70x |
716
- | arrow-ipc-raw | 317 MiB/s | 42 MiB/s | 80.3 | 4.65 ms | 109.1 MiB | 0.97x |
717
- | arrayrecord-raw | 291 MiB/s | 28 MiB/s | 52.7 | 7.63 ms | 118.0 MiB | 0.90x |
718
- | arrayrecord-zstd | 59 MiB/s | 29 MiB/s | 55.2 | 5.71 ms | 76.0 MiB | 1.39x |
723
+ | zrecord-zstd | 499 MiB/s | 369 MiB/s | 697.7 | 0.49 ms | 67.4 MiB | 1.57x |
724
+ | zrecord-zstdict | 587 MiB/s | 409 MiB/s | 771.9 | 0.44 ms | 53.0 MiB | 2.00x |
725
+ | zrecord-raw | 668 MiB/s | 469 MiB/s | 885.7 | 0.39 ms | 110.5 MiB | 0.96x |
726
+ | lmdb-raw | 369 MiB/s | 114 MiB/s | 214.6 | 2.10 ms | 151.8 MiB | 0.70x |
727
+ | arrow-ipc-raw | 345 MiB/s | 45 MiB/s | 85.0 | 4.11 ms | 109.1 MiB | 0.97x |
728
+ | arrayrecord-raw | 282 MiB/s | 26 MiB/s | 49.5 | 8.08 ms | 118.0 MiB | 0.90x |
729
+ | arrayrecord-zstd | 62 MiB/s | 28 MiB/s | 52.2 | 6.22 ms | 76.0 MiB | 1.39x |
719
730
 
720
731
  Here the record contract, not bulk byte bandwidth, is the useful scale.
721
- Zrecord's three codecs return 637–819 krecords/s with 0.41–0.52 ms p95.
722
- Dictionary zstd writes 37% faster than plain zstd, uses 21% less disk and gathers
723
- 9% faster in this pass.
732
+ Zrecord's three codecs return 698–886 krecords/s with 0.39–0.49 ms p95.
733
+ Dictionary zstd writes 18% faster than plain zstd, uses 21% less disk and gathers
734
+ 11% faster in this pass.
724
735
 
725
736
  ### Sampler
726
737
 
@@ -18,4 +18,4 @@ public publication boundary.
18
18
  step-based sampler + prefetch pipeline over them.
19
19
  """
20
20
 
21
- __version__ = "2.3.8"
21
+ __version__ = "2.4.0"
@@ -13,6 +13,10 @@ from .zrecord import Dense, Ragged
13
13
 
14
14
  __all__ = ["convert", "huggingface"]
15
15
 
16
+ _DECODE_BATCH_RECORDS = 64
17
+ _TARGET_BATCH_BYTES = 64 << 20
18
+ _MAX_BATCH_RECORDS = 32768
19
+
16
20
 
17
21
  def _path_component(name, kind):
18
22
  if (not isinstance(name, str) or not name or name in (".", "..")
@@ -21,39 +25,53 @@ def _path_component(name, kind):
21
25
  return name
22
26
 
23
27
 
24
- def _schema(feature, batch, column):
25
- """Return ``(Dense/Ragged, dtype, shape/ndim)`` for one column."""
26
-
27
- def numeric_dtype(value):
28
- try:
29
- dtype = np.dtype(value)
30
- except (TypeError, ValueError):
31
- return None
32
- return dtype if dtype.kind in "biufc" and dtype.itemsize else None
33
-
34
- def declared(value):
35
- name = type(value).__name__
36
- dtype = numeric_dtype(getattr(value, "dtype", None))
37
- if name in ("Value", "ClassLabel"):
38
- return None if dtype is None else (Dense, dtype, ())
39
- shape = getattr(value, "shape", None)
40
- if shape is not None and dtype is not None:
41
- if all(dimension is not None and int(dimension) >= 0 for dimension in shape):
42
- return Dense, dtype, tuple(int(dimension) for dimension in shape)
43
- return Ragged, dtype, len(shape)
44
- child = getattr(value, "feature", None)
45
- if child is not None:
46
- child_schema = declared(child)
47
- if child_schema is not None:
48
- child_kind, child_dtype, child_geometry = child_schema
49
- length = getattr(value, "length", None)
50
- if isinstance(length, int) and length >= 0 and child_kind is Dense:
51
- return Dense, child_dtype, (length, *child_geometry)
52
- child_ndim = len(child_geometry) if child_kind is Dense else child_geometry
53
- return Ragged, child_dtype, child_ndim + 1
28
+ def _numeric_dtype(value):
29
+ try:
30
+ dtype = np.dtype(value)
31
+ except (TypeError, ValueError):
54
32
  return None
33
+ return dtype if dtype.kind in "biufc" and dtype.itemsize else None
34
+
35
+
36
+ def _declared_schema(value):
37
+ name = type(value).__name__
38
+ dtype = _numeric_dtype(getattr(value, "dtype", None))
39
+ if name in ("Value", "ClassLabel"):
40
+ return None if dtype is None else (Dense, dtype, ())
41
+ shape = getattr(value, "shape", None)
42
+ if shape is not None and dtype is not None:
43
+ if all(dimension is not None and int(dimension) >= 0 for dimension in shape):
44
+ return Dense, dtype, tuple(int(dimension) for dimension in shape)
45
+ return Ragged, dtype, len(shape)
46
+ child = getattr(value, "feature", None)
47
+ if child is not None:
48
+ child_schema = _declared_schema(child)
49
+ if child_schema is not None:
50
+ child_kind, child_dtype, child_geometry = child_schema
51
+ length = getattr(value, "length", None)
52
+ if isinstance(length, int) and length >= 0 and child_kind is Dense:
53
+ return Dense, child_dtype, (length, *child_geometry)
54
+ child_ndim = len(child_geometry) if child_kind is Dense else child_geometry
55
+ return Ragged, child_dtype, child_ndim + 1
56
+ return None
55
57
 
56
- feature_schema = declared(feature) if feature is not None else None
58
+
59
+ def _decode_records(features):
60
+ if not features:
61
+ return _DECODE_BATCH_RECORDS
62
+ row_bytes = 0
63
+ for feature in features.values():
64
+ schema = _declared_schema(feature)
65
+ if schema is None or schema[0] is Ragged:
66
+ return _DECODE_BATCH_RECORDS
67
+ _, dtype, shape = schema
68
+ row_bytes += dtype.itemsize * max(1, int(np.prod(shape, dtype=np.intp)))
69
+ return min(_MAX_BATCH_RECORDS, max(1, _TARGET_BATCH_BYTES // row_bytes))
70
+
71
+
72
+ def _schema(feature, batch, column):
73
+ """Return ``(Dense/Ragged, dtype, shape/ndim)`` for one column."""
74
+ feature_schema = _declared_schema(feature) if feature is not None else None
57
75
  if feature_schema is not None:
58
76
  return feature_schema
59
77
  if isinstance(batch, dict) or len(batch) == 0:
@@ -66,26 +84,28 @@ def _schema(feature, batch, column):
66
84
  if isinstance(first, (bytes, np.bytes_)):
67
85
  raise ValueError(f"column {column!r} contains binary values, not numeric arrays")
68
86
  array = np.asarray(first)
69
- dtype = numeric_dtype(array.dtype)
87
+ dtype = _numeric_dtype(array.dtype)
70
88
  if dtype is None:
71
89
  raise ValueError(f"column {column!r} has no numeric dtype")
72
90
  if array.ndim == 0:
73
91
  return Dense, dtype, ()
74
92
  if isinstance(batch, np.ndarray) and batch.dtype != object:
75
- return Dense, numeric_dtype(batch.dtype), tuple(batch.shape[1:])
93
+ return Dense, _numeric_dtype(batch.dtype), tuple(batch.shape[1:])
76
94
  return Ragged, dtype, array.ndim
77
95
 
78
96
 
79
- def _write_dataset(dataset, target, codec, batch_size, dataset_type, iterable_type):
97
+ def _write_dataset(dataset, target, codec, dataset_type, iterable_type):
80
98
  features = getattr(dataset, "features", None)
81
99
  if isinstance(dataset, dataset_type):
100
+ decode_records = _decode_records(features)
82
101
  dataset = dataset.with_format("numpy", dtype=None)
83
102
  elif isinstance(dataset, iterable_type):
103
+ decode_records = _DECODE_BATCH_RECORDS
84
104
  dataset = dataset.with_format(None)
85
105
  else:
86
106
  raise TypeError("convert requires a Hugging Face Dataset or IterableDataset")
87
107
 
88
- batches = iter(dataset.iter(batch_size=batch_size))
108
+ batches = iter(dataset.iter(batch_size=decode_records))
89
109
  try:
90
110
  try:
91
111
  first = next(batches)
@@ -113,6 +133,9 @@ def _write_dataset(dataset, target, codec, batch_size, dataset_type, iterable_ty
113
133
  writer = Ragged.create(target / column, dtype, geometry, codec=codec)
114
134
  writers[column] = stack.enter_context(writer)
115
135
 
136
+ pending = {column: [] for column in columns}
137
+ pending_records = 0
138
+ pending_bytes = 0
116
139
  records = 0
117
140
  batch = first
118
141
  while batch is not None:
@@ -123,15 +146,42 @@ def _write_dataset(dataset, target, codec, batch_size, dataset_type, iterable_ty
123
146
  if any(length != count for length in lengths.values()):
124
147
  raise ValueError(f"dataset columns have different batch lengths: {lengths}")
125
148
  if count:
126
- for column, (kind, dtype, _) in schemas.items():
149
+ prepared = {}
150
+ batch_bytes = 0
151
+ for column, (kind, dtype, geometry) in schemas.items():
127
152
  if kind is Dense:
128
- writers[column].append(np.asarray(batch[column], dtype=dtype))
153
+ values = np.asarray(batch[column], dtype=dtype)
154
+ prepared[column] = [values]
155
+ batch_bytes += values.nbytes
129
156
  else:
130
- writers[column].append(
157
+ values = [
131
158
  np.asarray(record, dtype=dtype) for record in batch[column]
159
+ ]
160
+ prepared[column] = values
161
+ batch_bytes += sum(
162
+ value.nbytes + geometry * 8 for value in values
132
163
  )
164
+ if pending_records and (
165
+ pending_bytes + batch_bytes > _TARGET_BATCH_BYTES or
166
+ pending_records + count > _MAX_BATCH_RECORDS):
167
+ _flush(writers, schemas, pending)
168
+ pending = {column: [] for column in columns}
169
+ pending_records = 0
170
+ pending_bytes = 0
171
+ for column in columns:
172
+ pending[column].extend(prepared[column])
173
+ pending_records += count
174
+ pending_bytes += batch_bytes
133
175
  records += count
176
+ if (pending_bytes >= _TARGET_BATCH_BYTES or
177
+ pending_records >= _MAX_BATCH_RECORDS):
178
+ _flush(writers, schemas, pending)
179
+ pending = {column: [] for column in columns}
180
+ pending_records = 0
181
+ pending_bytes = 0
134
182
  batch = next(batches, None)
183
+ if pending_records:
184
+ _flush(writers, schemas, pending)
135
185
  if records == 0:
136
186
  raise ValueError("dataset is empty")
137
187
  finally:
@@ -140,12 +190,20 @@ def _write_dataset(dataset, target, codec, batch_size, dataset_type, iterable_ty
140
190
  close()
141
191
 
142
192
 
143
- def convert(dataset, output, *, codec, batch_size=256):
144
- """Persist one Dataset or every split in a DatasetDict as Zrecord."""
193
+ def _flush(writers, schemas, pending):
194
+ for column, (kind, _, _) in schemas.items():
195
+ values = pending[column]
196
+ if kind is Dense:
197
+ batch = values[0] if len(values) == 1 else np.concatenate(values, axis=0)
198
+ writers[column].append(batch)
199
+ else:
200
+ writers[column].append(values)
201
+
202
+
203
+ def convert(dataset, output, *, codec):
204
+ """Persist one Dataset or every split with internal byte-bounded appends."""
145
205
  if codec not in ("raw", "zstd"):
146
206
  raise ValueError("converter codec must be 'raw' or 'zstd'")
147
- if isinstance(batch_size, bool) or not isinstance(batch_size, int) or batch_size < 1:
148
- raise ValueError("batch_size must be a positive integer")
149
207
  try:
150
208
  from datasets import Dataset, DatasetDict, IterableDataset, IterableDatasetDict
151
209
  except ImportError:
@@ -168,12 +226,11 @@ def convert(dataset, output, *, codec, batch_size=256):
168
226
  source,
169
227
  temporary / _path_component(split, "split"),
170
228
  codec,
171
- batch_size,
172
229
  Dataset,
173
230
  IterableDataset,
174
231
  )
175
232
  else:
176
- _write_dataset(dataset, temporary, codec, batch_size, Dataset, IterableDataset)
233
+ _write_dataset(dataset, temporary, codec, Dataset, IterableDataset)
177
234
  if output.exists():
178
235
  raise FileExistsError(f"output was created during conversion: {output}")
179
236
  os.rename(temporary, output)