ML demo: a U-Net in SQL, for einfold to optimize convolutions against
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 領域
- data, machine-learning
調査の方向性
Start with benchmarks/ml/CONTRIBUTING.md and compare the structure of 01_attention.py and 02_nanogpt.py. Build a readable U-Net demo with a JAX reference, timed SQL steps across hosts in _hosts.py, and checks for forward results and input and weight gradients; completion means those comparisons agree to about 1e-15. einfold's shifted-key optimizer work is tracked separately, and results belong on #285.
索引モデルが issue の本文から書いたものです。
説明
🪭 Claude (einfold)
A request for a new demo in benchmarks/ml, following its CONTRIBUTING.md, which already lists "a small convolutional network over a grid, where a convolution is a join on shifted coordinates" among the demos that would fit. The proposal: a U-Net (Ronneberger, Fischer and Brox, U-Net: Convolutional Networks for Biomedical Image Segmentation, 2015), the encoder–decoder CNN with skip connections that geoscience uses for downscaling, nowcasting and segmentation.
einfold, XQL Systems' query optimizer that rewrites SQL plans into array algorithms, would use it the way it uses 01_attention.py: as the workload it optimizes against.
Why this model
- It is the convolution shape einfold doesn't detect yet. A convolution is a fold over a join whose keys are shifted,
i.y = o.y + w.dy, not equal columns. einfold's next design step for it is shifted keys in its fold IR, so that the dense kernels take convolutions directly. Strides and dilations become a multiplier on the offset. Padding needs no special case: border pixels simply have fewer taps, which is SQL's own result when the shifted rows don't exist. A demo gives that work a correctness reference (JAX) and a benchmark, as attention did for einfold's fused pipelines. - It exercises more than convolutions.
- Convolution, then bias, then ReLU, is a fold pipeline, which einfold's M2 fuses.
- Downsampling (a strided convolution, or a max-pool, which is
MAXover shifted keys) and upsampling (a transposed convolution) are the same join witho.y = 2·i.y + dyand its inverse. - Skip connections concatenate channels from two levels: a
UNION ALL, or a join on the pixel.
- It fits xarray-sql's audience. A U-Net on an ERA5 field, such as downscaling a coarse temperature grid or predicting a field one step ahead, is a model geoscientists train on gridded data. Its input is an xarray Dataset registered as a table of
(time, y, x, channel). - ddx gets new gradients to check. The gradient of a convolution with respect to its input is a transposed convolution, and with respect to its weights is a correlation of the input with the output gradient: the same shifted-key shape again.
Suggested shape
The pieces, as 02_nanogpt.py builds its model from functions named after the reference's:
conv(x, w, stride, dilation):SUM(x.v * w.v)overx JOIN w ON x.c = w.ci AND x.y = o.y * stride + w.dy * dilation AND …, grouped by the output's(n, y, x, co). One way to writeois a join against a coordinate table, orx.y - w.dygrouped directly;relu,bias: derived factors;down(x): a stride-2 convolution, or a 2 × 2 max-pool;up(x): a stride-2 transposed convolution, or nearest-neighbourJOIN ON o.y / 2 = i.y;skip(a, b): channels of two levels, concatenated;unet(depth, width): two or three levels, 8–32 channels, 3 × 3 kernels, on a grid of about 64 × 64 to 256 × 256.
Checked against the same network in JAX: jax.lax.conv_general_dilated, or Flax's nn.Conv, with 64-bit floats, so they agree to about 1e-15. Check the forward pass, and ddx's gradients with respect to the input and to every weight table.
The interesting knobs for einfold's measurements:
- grid size;
- channel widths, which make the convolutions dense or near-dense;
- depth, which is the number of folds in a pipeline;
- stride, against pooling.
As in the other demos: the same SQL on every host in _hosts.py, each step timed, with its error against JAX.
Not asked here
Speed. The demo should be written to be read, as the others are. einfold's side, detecting and running shifted-key folds, will be tracked in einfold. Results go on #285.
- 主要言語
- Python
- スター
- 142
- フォーク
- 19
- 平均マージ
- 3日 47分
- マージ済み PR(30日)
- 8
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
xqlsystems/xarray-sql のほかの issue
-
dependencies github_actions
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
xqlsystems/xarray-sql#295 ·
メンテナーはふだん 3 日以内に返信
-
A big-endian data variable registers, then every query fails: Byte-swapped arrays not supportedオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
xqlsystems/xarray-sql#288 ·
メンテナーはふだん 3 日以内に返信
-
documentation ml
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
xqlsystems/xarray-sql#268 ·
メンテナーはふだん 3 日以内に返信
-
enhancement ml
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
xqlsystems/xarray-sql#267 · コメント 4 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
xqlsystems/xarray-sql#243 ·
メンテナーはふだん 3 日以内に返信
xqlsystems/xarray-sql の issue をすべて見る
似ている issue
-
documentation good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
MarketSquare/robotframework-browser#5479 ·
メンテナーはふだん 1 日以内に返信
-
Visual COBOL: missing 11.0 and 12.0, and 9.0 date differs from Rocket Software's lifecycle pageオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
endoflife-date/endoflife.date#11561 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
OCA/l10n-brazil#5602 ·
メンテナーはふだん 1 日以内に返信
-
documentation review-2.0.0
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dkuenzel/meshcore-home-gateway#106 ·
メンテナーはふだん 1 日以内に返信