You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

RN 0.75裸项目(非Expo)中使用react-native-fast-tflite加载TFLite文件失败求助

RN 0.75裸项目(非Expo)中使用react-native-fast-tflite加载TFLite文件失败求助

各位好,我现在在做一个裸React Native 0.75项目(不是Expo环境),想用react-native-fast-tflite加载我的TFLite模型文件,但一直卡壳,来求助大家!

我试过两种方式放置TFLite文件:先是按照文档建议放到asset文件夹里,没效果;后来又移到ios文件夹中。放到ios文件夹后,用const path = RNFS.exists(${RNFS.MainBundlePath}/file.tflite)检测,返回结果是true,说明文件路径是能找到的,但把这个path传入await loadTensorflowModel(path, 'core-ml')时直接报错了,具体两个错误:

  • Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'Tflite' could not be found
  • Model load failed: [TypeError: Cannot read property 'loadTensorflowModel' of undefined]

我已经做过的尝试还有:

  • 在metro.config.js里添加了assetExts: [...defaultConfig.resolver.assetExts, 'tflite'],把tflite后缀加入了Metro的资源解析列表
  • 反复在assets目录和ios目录之间挪动TFLite文件,都没解决问题

有没有遇到过类似情况的朋友?或者知道哪里配置遗漏的,麻烦指点一下!

内容来源于stack exchange

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.08 09:52:58