Skip to content

AttributeError: 'LeafSpec' object has no attribute 'type' when using nightly pytorch #18073

@Gasoonjia

Description

@Gasoonjia

🐛 Describe the bug

We are hitting the AttributeError: 'LeafSpec' object has no attribute 'type' error when trying to install ExecuTorch using pytorch 3.10 on recent nightly PyTorch:

[ 52%] Built target extension_evalue_util
[ 52%] Building CXX object kernels/portable/CMakeFiles/optimized_portable_kernels.dir/cpu/op_acosh.cpp.o
[ 52%] Building CXX object kernels/portable/CMakeFiles/optimized_portable_kernels.dir/cpu/op_add.cpp.o
[ 52%] Building CXX object kernels/portable/CMakeFiles/optimized_portable_kernels.dir/cpu/op_addmm.cpp.o
Traceback (most recent call last):
  File "/path/to/miniconda3/envs/executorch/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/path/to/miniconda3/envs/executorch/lib/python3.10/runpy.py", line 86, in _run_code
Traceback (most recent call last):
  File "/path/to/miniconda3/envs/executorch/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    exec(code, run_globals)
  File "/path/to/code/executorch/test/models/export_program.py", line 418, in <module>
    return _run_code(code, main_globals, None,
  File "/path/to/miniconda3/envs/executorch/lib/python3.10/runpy.py", line 86, in _run_code
    main()
  File "/path/to/code/executorch/test/models/export_program.py", line 401, in main
    exec(code, run_globals)
  File "/path/to/code/executorch/test/models/export_program.py", line 418, in <module>
    prog = export_module_to_program(
  File "/path/to/code/executorch/test/models/export_program.py", line 346, in export_module_to_program
    main()
  File "/path/to/code/executorch/test/models/export_program.py", line 401, in main
    module = ExportedModule.export(
  File "/path/to/code/executorch/test/end2end/exported_module.py", line 193, in export
    exec_prog = to_edge(
  File "/path/to/miniconda3/envs/executorch/lib/python3.10/site-packages/executorch/exir/program/_program.py", line 116, in wrapper
    return func(*args, **kwargs)
  File "/path/to/miniconda3/envs/executorch/lib/python3.10/site-packages/executorch/exir/program/_program.py", line 1478, in to_edge
    program = program.run_decompositions(table)
  File "/path/to/miniconda3/envs/executorch/lib/python3.10/site-packages/torch/export/exported_program.py", line 124, in wrapper
    return fn(*args, **kwargs)
  File "/path/to/miniconda3/envs/executorch/lib/python3.10/site-packages/torch/export/exported_program.py", line 1530, in run_decompositions
    return _decompose_exported_program(
  File "/path/to/miniconda3/envs/executorch/lib/python3.10/site-packages/torch/export/exported_program.py", line 1005, in _decompose_exported_program
    ) = _decompose_and_get_gm_with_new_signature_constants(
  File "/path/to/miniconda3/envs/executorch/lib/python3.10/site-packages/torch/export/exported_program.py", line 400, in _decompose_and_get_gm_with_new_signature_constants
    if out_spec.type not in (list, tuple):
AttributeError: 'LeafSpec' object has no attribute 'type'

it should relate to nightly pytorch/pytorch update: pytorch/pytorch#177045

Versions

install executorch following this doc: https://docs.pytorch.org/executorch/1.1/using-executorch-building-from-source.html#configuring

cc @mergennachin @byjlw

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions