Revisit format/transform interface and implementation (datasets 4 lazy Columns)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
調査の方向性
src/dataset.jl とガイドの「The "julia" format and transforms」セクションから始めて、現在の単一スロットの動作を理解します。数値データセットと画像データセットの両方で perf/ ハーネスを実行し、現在の形式と numpy ベースの代替形式を比較します。ベンチマーク結果を記録し、それらを使って内部最適化または opt-in の第 2 の形式軸が正当化されるかどうかを判断できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
Revisit the format / transform interface (and its implementation) now that
datasets >= 4 returns lazy Column objects for column access. The current
behavior is intentional and documented — this issue is a placeholder to
reconsider the design, not a bug report.
Current model
A Dataset has two independent underlying slots:
- the python format
pyds._format_type(set viadatasets' own
set_format):nothing,"numpy","torch","pandas","arrow",
"polars", … - the julia
jltransformfield:py2jl,identity, or a user function.
The public API couples them into a single "format" slot (src/dataset.jl,
set_format!):
"julia"≡(_format_type = nothing, jltransform = py2jl)- any python format
X≡(_format_type = X, jltransform = identity)
So the two slots are mutually exclusive through the API: setting "julia"
resets the python format to nothing; setting a python format installs
identity. The one combination that cannot be expressed is "python format X
and py2jl on top."
What prompted this
With datasets >= 4, ds["col"] returns a lazy datasets.Column, which we now
wrap in a lazy HuggingFaceDatasets.Column <: AbstractVector (added alongside
the datasets >= 4 support). It was observed that the "julia" format calls reset_format(),
so ds.pyds["col"] is always a Column.
Worth recording: resetting to nothing is not what forces the Column. In
datasets 4, Dataset.__getitem__(str) returns a Column for every format
except arrow/pandas/polars:
| python format | ds["col"] returns |
|---|---|
nothing (our "julia") |
datasets.Column (lazy) |
"numpy" |
datasets.Column (lazy) |
"torch" |
datasets.Column (lazy) |
"pandas" |
pandas.Series (native) |
"arrow" |
pyarrow.ChunkedArray (native) |
"polars" |
polars.Series (native) |
So decoupling the two formats would not avoid Columns in general — the lazy
Column is simply the v4 default for column access.
Points to reconsider
-
One format slot vs. two independent axes. Conceptually the python format
and the julia conversion are orthogonal (whatdatasetsproduces vs. a
julia-side transform). Exposing both is more faithful but roughly doubles the
state space; most combinations are redundant (py2jlalready absorbs numpy
copylessly via DLPack) or ill-defined (py2jlhas no branch for a pandas
Series/ arrow table / torch tensor). Current stance: keep the single slot;
with_jltransform/MLUtils.mapobsare the intended composition points. -
The one real limitation — numeric throughput. Under
nothing, a numeric
batch comes back as a pythonlistandpy2jlcopies it element-by-element;
under"numpy"it would be annp.ndarray→numpy2jl(zero-copy). This is
the single case where"numpy" + py2jlgenuinely wins. -
Possible internal optimization (benchmark first). Rather than exposing a
second format knob, consider whether the"julia"format should sit on
"numpy"instead ofnothing, so numeric columns transfer copyless. Tradeoff:
image columns currently arrive asPIL.Image(→Gray/RGBImageCore
views) undernothing; under"numpy"they'd be raw transposed arrays and we
lose that clean path. Best validated with theperf/harness on both numeric
and image datasets before changing anything.
Non-goals / decision so far
- Keep the current format behavior as-is for now (intentional, documented in the
guide's "The"julia"format and transforms" section). - No API change until the numeric zero-copy question (2/3) is benchmarked and we
decide whether the win justifies either an internal base-format change or a
second, opt-in axis.
- 主要言語
- Julia
- スター
- 38
- フォーク
- 1
- 平均マージ
- 3時間 30分
- マージ済み PR(30日)
- 20
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaGenAI/HuggingFaceDatasets.jl のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
JuliaGenAI/HuggingFaceDatasets.jl#96 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
JuliaGenAI/HuggingFaceDatasets.jl#32 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
JuliaGenAI/HuggingFaceDatasets.jl の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
JuliaMath/Polynomials.jl#647 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
OpenSourceAWE/SymbolicAWEModels.jl#431 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 89/100
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信