Fix #804: [Usage]: import ucm_custom_ops报错ModuleNotFoundError: No mod...#898
Open
JiwaniZakir wants to merge 1 commit intoModelEngine-Group:developfrom
Open
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #804
Purpose
Improve the error message when
ucm_custom_opsis not installed, replacing the bareModuleNotFoundErrorwith an actionable message that tells users exactly how to resolve the issue.Modifications
ucm/sparse/gsa_on_device/gsa_on_device.py: Wrapped theimport ucm_custom_opsstatement (inside theif hasattr(torch, "npu") and torch.npu.is_available()block) in atry/except ModuleNotFoundErrorblock. When the module is missing, re-raises with a message instructing the user to build and install the custom ops viabash ucm/sparse/gsa_on_device/csrc/ascend/build.sh install.Test
Manually verified on an environment without
ucm_custom_opsinstalled: the new error message"ucm_custom_ops is not installed. Please build and install it by running: bash ucm/sparse/gsa_on_device/csrc/ascend/build.sh install"is raised instead of the uninformativeModuleNotFoundError: No module named 'ucm_custom_ops'. Verified that normal execution is unaffected whenucm_custom_opsis present.This PR was created with AI assistance (Claude). The changes were reviewed by quality gates and a critic model before submission.