Fix unchecked Result in get_llm_metadata()#18749
Conversation
Summary: In get_llm_metadata(), module->get() returns a Result but the old code called .get() without checking if the result is ok. If the method exists in the model (checked via method_names.count()) but module->get() still fails, this indicates a serious issue with the .pte file. Use ET_UNWRAP to propagate the error instead of silently falling back to defaults, which could mask .pte corruption. Differential Revision: D99707695
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18749
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 9 PendingAs of commit 36b53a4 with merge base a3a08c1 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@kirklandsign has exported this pull request. If you are a Meta employee, you can view the originating Diff in D99707695. |
This PR needs a
|
There was a problem hiding this comment.
Pull request overview
Updates get_llm_metadata() in the LLM runner helpers to correctly handle failures when retrieving metadata values from a Module, avoiding unchecked Result access and surfacing model/.pte issues as errors.
Changes:
- Replace unchecked
Result::get()usage onmodule->get(method_name)withET_UNWRAP(...)to propagate errors. - Prevent silently continuing with default metadata when the model claims a metadata method exists but retrieval fails.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
larryliu0820
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Differential Revision: D99707695 Pull Request resolved: pytorch#18749
Summary:
In get_llm_metadata(), module->get() returns a Result but the old code called
.get() without checking if the result is ok. If the method exists in the model
(checked via method_names.count()) but module->get() still fails, this indicates
a serious issue with the .pte file.
Use ET_UNWRAP to propagate the error instead of silently falling back to
defaults, which could mask .pte corruption.
Differential Revision: D99707695