Skip to content

Fix #804: [Usage]: import ucm_custom_ops报错ModuleNotFoundError: No mod...#898

Open
JiwaniZakir wants to merge 1 commit intoModelEngine-Group:developfrom
JiwaniZakir:fix/804-usage-import-ucm-custom-ops-modulenotfo
Open

Fix #804: [Usage]: import ucm_custom_ops报错ModuleNotFoundError: No mod...#898
JiwaniZakir wants to merge 1 commit intoModelEngine-Group:developfrom
JiwaniZakir:fix/804-usage-import-ucm-custom-ops-modulenotfo

Conversation

@JiwaniZakir
Copy link
Copy Markdown

Closes #804

Purpose

Improve the error message when ucm_custom_ops is not installed, replacing the bare ModuleNotFoundError with an actionable message that tells users exactly how to resolve the issue.

Modifications

  • ucm/sparse/gsa_on_device/gsa_on_device.py: Wrapped the import ucm_custom_ops statement (inside the if hasattr(torch, "npu") and torch.npu.is_available() block) in a try/except ModuleNotFoundError block. When the module is missing, re-raises with a message instructing the user to build and install the custom ops via bash ucm/sparse/gsa_on_device/csrc/ascend/build.sh install.

Test

Manually verified on an environment without ucm_custom_ops installed: 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 uninformative ModuleNotFoundError: No module named 'ucm_custom_ops'. Verified that normal execution is unaffected when ucm_custom_ops is present.


This PR was created with AI assistance (Claude). The changes were reviewed by quality gates and a critic model before submission.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Usage]: import ucm_custom_ops报错ModuleNotFoundError: No module named 'ucm_custom_ops'

1 participant