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

Abierto
#2,933 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Tranquilo
Stack tecnológico
python, pytorch

Línea de trabajo

Reproduce el fallo con torch~=2.9.0 y onnxscript~=0.5.6 utilizando únicamente torch.nn.Linear y torch.onnx.export. Inspecciona las especificaciones de las dependencias y el fallo _ConvertVersionPassRequiresInline; después, verifica que las dependencias resueltas permitan la exportación sin las funciones inesperadas del modelo.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Python
Estrellas
457
Forks
149
Merge medio
3 d 15 h
PR fusionados (30 d)
24

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/onnxscript

Todos los issues de microsoft/onnxscript

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.