Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions optimum/exporters/executorch/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ def main_export(
discover_tasks()

# Load the model for specific task
try:
task_func = task_registry.get(task)
except KeyError as e:
raise RuntimeError(f"The task '{task}' isn't registered. Detailed error: {e}")
if task not in task_registry:
raise RuntimeError(
f"The task '{task}' isn't registered. Available tasks: {list(task_registry.keys())}"
)
task_func = task_registry[task]

kwargs["cache_dir"] = cache_dir
kwargs["trust_remote_code"] = trust_remote_code
Expand Down
9 changes: 5 additions & 4 deletions optimum/exporters/executorch/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ def export_to_executorch(
discover_recipes()

# Export and lower the model to ExecuTorch with the recipe
try:
recipe_func = recipe_registry.get(recipe)
except KeyError as e:
raise RuntimeError(f"The recipe '{recipe}' isn't registered. Detailed error: {e}")
if recipe not in recipe_registry:
raise RuntimeError(
f"The recipe '{recipe}' isn't registered. Available recipes: {list(recipe_registry.keys())}"
)
recipe_func = recipe_registry[recipe]

executorch_progs = recipe_func(model, **kwargs)

Expand Down