Pull Request已成功合入, 合并人@ascend-robot
(感谢 guowenna1 的贡献)Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/MindIE-SD | ✅ mazhixin00_00, weixin_44144262, LoganJane (3/2) | ✅ mazhixin00_00 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
guowenna1, thanks for your pull request. All authors of the commits have signed the CLA. 👍


问题/功能描述
本次PR旨在解决因模块初始化代码执行顺序不当导致的环境配置未生效问题。原代码中,环境变量设置函数在导入其他子模块之后才被调用,可能导致依赖特定环境变量的功能模块(如缓存、层、量化等)在加载时环境尚未准备就绪,从而引发配置错误。
修改方案描述
核心修改方案是将环境变量设置函数 set_environment_variables 的导入和调用语句,从模块末尾调整至 __all__ 列表定义之后、其他子模块导入之前。此调整确保了在加载任何业务子模块之前,必要的运行环境已经正确初始化,从而从根本上解决了环境配置的时序依赖问题。本次变更仅为代码顺序调整,不涉及新功能、新接口或核心逻辑修改。


✅ 流水线任务触发成功(流水线编号: 880),正在执行, 请稍候。 任务链接 点此跳转 ...


/lgtm


compile


✅ 流水线任务触发成功(流水线编号: 882),正在执行, 请稍候。 任务链接 点此跳转 ...


/lgtm


/approve


The following users do not have permission to comment /lgtm or /approve on any module in this PR:
wangbei2025


Review Guide
This pull-request passes review.
Committers who wrote a comment of /approve are: mazhixin00_00.
Reviewers who wrote a comment of /lgtm are: weixin_44144262, LoganJane, mazhixin00_00.


1、目标:
修复源码安装包后,执行算子时,出现libopapi.so报错找不到算子的问题,对应issue为:https://gitcode.com/Ascend/MindIE-SD/issues/62
2、原因分析:
根因是环境变量生效时机太晚。
mindiesd 在 import 过程中就已经加载自定义算子 SO 了,但在这些导入之后才调用 set_environment_variables() 去设置 ASCEND_CUSTOM_OPP_PATH,但底层库初始化时看到的仍然是旧环境,导致报错
3、测试报告: