Skip to content

关于预编译的鸿蒙版本安装后无法加载模型以及无法解析图片的问题 #1099

Open

Description

@404error-not

是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?

  • 我已经搜索过已有的issues和讨论 | I have searched the existing issues / discussions

该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?

  • 我已经搜索过FAQ | I have searched FAQ

当前行为 | Current Behavior

尊敬的开发者你好,我在使用预编译鸿蒙hap安装到手机后出现无法加载模型的问题,具体情况是MiniCPM-V-4(4.1B)模型下载后加载失败,删除文件重试仍有问题。换用另一个模型虽然能加载成功,但是上传了图片提示解析失败,若点击重新加载模型高概率卡住和闪退的问题。手机型号:华为mate60pro,系统版本:6.1.0.117 API23。感谢开发者对鸿蒙的支持,希望可以协助排查出现的问题,早日上架华为应用商店,感谢!

期望行为 | Expected Behavior

No response

复现方法 | Steps To Reproduce

No response

运行环境 | Environment

- OS:
- Python:
- Transformers:
- PyTorch:
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`):

备注 | Anything else?

No response

Activity

  1. tc-mb commented on May 18, 2026

    @tc-mb
    Collaborator

    你好,感谢详细反馈,逐条回复:

    1. V4 (4.1B) 加载失败

    V4 量化后总内存峰值约 3.5-4 GB(含 ViT mmproj + KV cache),HarmonyOS app sandbox 对普通应用的内存配额一般只有 ~1.5-2 GB(Mate60 Pro 12GB 物理足够,但 sandbox 上限是 OS 层的限制),加载失败是预期内的。

    这不是 demo 的 bug,是 HarmonyOS NEXT 应用沙盒的设计。申请更大配额需要走 AppGallery「大内存应用」白名单,目前 demo 还没有上架 AppGallery,所以这条路暂时走不通。

    建议端侧用 V4.6 (1.2B),内存峰值 ~1.2 GB,在 Mate60 Pro 上能稳定加载。

    2. V4.6 图片解析失败

    初步怀疑是 HarmonyOS 不同小版本上同一个 API 的行为有差异——我们 demo 走的照片 URI 访问 / 解码路径在你这台 Mate60 NEXT 6.1 上中途撞墙的可能性较大。我们会继续跟进定位。

    3. 重新加载模型时卡住 / 闪退

    是已知问题,触发条件是设备运行内存吃紧——尤其是 HarmonyOS 应用沙盒配额较低的机型(Mate60 Pro 这类)。demo 在低内存场景下的内存使用还有进一步优化空间,反复重载会逐步累积压力直到触发 OOM。物理内存充裕 + 沙盒配额充足的机型上看不到。

    临时绕过:force-stop demo 然后重新打开,比反复点"重新加载"稳定。这个会在后续版本继续优化。

    4. 上架华为应用商店

    感谢期待,我们会综合 demo 成熟度和资源安排再看。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions