Existing project using v0.5.x fails due to functions in the model

Aperta
#2,933 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
python, pytorch

Direzione di ricerca

Riproduci il fallimento con torch~=2.9.0 e onnxscript~=0.5.6 utilizzando esclusivamente torch.nn.Linear e torch.onnx.export. Esamina le specifiche delle dipendenze e il fallimento _ConvertVersionPassRequiresInline, quindi verifica che le dipendenze risolte consentano l’esportazione senza le funzioni impreviste del modello.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

New deployment of a project with dependencies torch~=2.9.0, onnxscript~=0.5.6 ran into errors on torch.onnx.export. The error is not correlated to the exporting module (exporting a sole torch.nn.Linear still causes error). Example output:

[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
Traceback (most recent call last):
  File "D:\Workspaces\Playgrounds\.venv\Lib\site-packages\onnx_ir\passes\_pass_infra.py", line 250, in call
    pass_result = pass_(model)
                  ^^^^^^^^^^^^
  File "D:\Workspaces\Playgrounds\.venv\Lib\site-packages\onnx_ir\passes\_pass_infra.py", line 127, in __call__
    result = self.call(model)
             ^^^^^^^^^^^^^^^^
  File "D:\Workspaces\Playgrounds\.venv\Lib\site-packages\onnxscript\version_converter\__init__.py", line 77, in call
    raise ValueError(
ValueError: The model contains functions. The version conversion pass does not support functions. Please use `common_passes.InlinePass` to inline the functions before applying this pass (_ConvertVersionPassRequiresInline).

The above exception was the direct cause of the following exception:
……
onnx_ir.passes.PassError: An error occurred when running the '<onnxscript.version_converter._ConvertVersionPassRequiresInline object at 0x00000194E90F6E70>' pass after the following passes: ['<onnx_ir.passes.common.inliner.InlinePass object at 0x00000194E2E0C770>']

Breaking into where the error is raised, inspecting pass_result.model.functions gives {('pkg.onnxscript.torch_lib.common', 'Rank', ''): Function('pkg.onnxscript.torch_lib.common', 'Rank', '', inputs=[Value(name='input')], attributes={}), outputs=[Value(name='return_val', producer='n1', index=0)]), ('pkg.onnxscript.torch_lib.common', 'IsScalar', ''): Function('pkg.onnxscript.torch_lib.common', 'IsScalar', '', inputs=[Value(name='input')], attributes={}), outputs=[Value(name='return_val', producer='n3', index=0)])}, which is not empty as expected.

It looks like a problem with the dependency specifications of onnxscript, as previous deployments with the same requirements.txt did not encounter such error.

Updating the package seems to clear the error but I guess it would be better if the dependencies could be fixed.

EDIT: Seems to be related to https://github.com/microsoft/onnxscript/issues/2790

Lingua principale
Python
Stelle
457
Fork
149
Merge medio
3g 15h
PR unite (30g)
24

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/onnxscript

Tutte le issue di microsoft/onnxscript

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.