Context.prepare can't prepare a query that calls grad, vjp or jvp
Maintainer antworten meist innerhalb von 3 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- backend, machine-learning
Rechercherichtung
Start from Context.prepare() and Context.sql() in the xarray_sql package, and reproduce the ValueError from the snippet to see where DataFusion planning rejects grad. Then read xarray_sql.ad.sql_all and ddxdb's own prepare, and check how PreparedQuery handles writes into registered Datasets. Done means prepare() runs a query that calls grad, vjp or jvp and gives the same results as sql(). The interim NotImplementedError is tied to the unmerged #269 branch, so coordinate there first.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
🌀 Claude: Context.sql() computes a query's grad, vjp and jvp calls through ddx (the ml extra, on the ml-demos branch of #269), but Context.prepare() plans the query with DataFusion alone, so it fails on the call:
import numpy as np, xarray as xr, xarray_sql as xql
ctx = xql.Context()
ctx.from_dataset("w", xr.Dataset({"val": ("feature", np.array([1.0, 2.0]))}, coords={"feature": [0, 1]}))
q = ("WITH loss AS (SELECT SUM(val * val) AS l FROM w) "
"SELECT feature, grad(loss, val) AS g FROM w ORDER BY feature")
ctx.sql(q).to_pandas() # g = [2.0, 4.0]
ctx.prepare(q) # ValueError: Error during planning: Invalid function 'grad'. Did you mean 'rpad'?
(ddxdb 0.4.6, DataFusion 55.)
A training loop is where prepare matters most: it runs the same gradient step on every iteration, and planning ddx's programs costs far more than running them at small sizes. ddxdb has its own prepare, which plans the forward and backward programs once.
Proposal:
- Until this is done, #269 makes
prepare()raise aNotImplementedErrorthat namessql()andxarray_sql.ad.sql_all, rather than DataFusion's planning error. - Then route a query that calls
grad,vjporjvpthrough ddxdb'sprepare, keepingPreparedQuery's contract: writes into registered Datasets before a call, and the check that a table hasn't been registered again since the query was prepared. sql_all's several statements over one backward pass would want the same, as aprepare_allor apreparethat takes several statements.
- Vorherrschende Sprache
- Python
- Sterne
- 142
- Forks
- 19
- Ø Merge
- 3 T. 47 Min.
- Gemergte PRs (30 T.)
- 8
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus xqlsystems/xarray-sql
-
dependencies github_actions
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
xqlsystems/xarray-sql#295 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
A big-endian data variable registers, then every query fails: Byte-swapped arrays not supportedOffenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
xqlsystems/xarray-sql#288 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
documentation ml
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 85/100
xqlsystems/xarray-sql#268 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
enhancement ml
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
xqlsystems/xarray-sql#267 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 3 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 74/100
xqlsystems/xarray-sql#243 ·
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in xqlsystems/xarray-sql
Ähnliche Issues
-
documentation good first issue
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
MarketSquare/robotframework-browser#5479 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Visual COBOL: missing 11.0 and 12.0, and 9.0 date differs from Rocket Software's lifecycle pageOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
endoflife-date/endoflife.date#11561 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
OCA/l10n-brazil#5602 ·
Maintainer antworten meist innerhalb von 1 Tag
-
documentation review-2.0.0
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
dkuenzel/meshcore-home-gateway#106 ·
Maintainer antworten meist innerhalb von 1 Tag