Skip to content

Should executorch accept path for load_for_executorch() ? #3682

@mikekgfb

Description

@mikekgfb

x-ref:
https://github.com/pytorch/torchchat/actions/runs/9162567537/job/25189812777?pr=809

Easy mitigation:

 exec_lib._load_for_executorch(builder_args.pte_path),
 =>
 exec_lib._load_for_executorch(str(builder_args.pte_path)),

but should users have to mitigate?

Exporting model using ExecuTorch to /Users/runner/work/torchchat/torchchat/stories15M.pte
The methods are:  {'forward'}
Traceback (most recent call last):
Warning: checkpoint path ignored because an exported DSO or PTE path specified
  File "/Users/runner/work/torchchat/torchchat/build/builder.py", line 424, in _initialize_model
    exec_lib._load_for_executorch(builder_args.pte_path),
TypeError: _load_for_executorch(): incompatible function arguments. The following argument types are supported:
    1. (path: str, enable_etdump: bool = False) -> torch::executor::(anonymous namespace)::PyModule

Invoked with: PosixPath('/Users/runner/work/torchchat/torchchat/stories15M.pte')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/runner/work/torchchat/torchchat/torchchat.py", line 107, in <module>
Warning: checkpoint path ignored because an exported DSO or PTE path specified
Using device=cpu Apple M1 (Virtual)
Loading model...
Time to load model: 0.03 seconds
    generate_main(args)
  File "/Users/runner/work/torchchat/torchchat/generate.py", line 791, in main
    _main(
  File "/Users/runner/work/torchchat/torchchat/generate.py", line 533, in _main
    model = _initialize_model(builder_args, quantize, tokenizer)
  File "/Users/runner/work/torchchat/torchchat/build/builder.py", line 437, in _initialize_model
    raise RuntimeError(f"Failed to load ET compiled {builder_args.pte_path}")
RuntimeError: Failed to load ET compiled /Users/runner/work/torchchat/torchchat/stories15M.pte
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions