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

无法安装tflite-model-maker及.tflite模型适配Android问题求助

文本情感分类.tflite模型获取及环境配置问题

需求

需要一个文本情感分类的.tflite格式模型,用于Android Studio开发——这是安卓系统通用的兼容格式。作为神经网络和Python新手,我了解到两种实现途径:

  • 训练模型后转换为.tflite格式
  • 直接使用tflite-model-maker生成模型

尝试过程及遇到的问题

途径一:训练模型后转换格式

仅成功转换了一个测试模型,但Android Studio提示该文件不是有效的.tflite模型,尽管文件后缀正确。

途径二:使用tflite-model-maker生成模型

  • 在Google Colab中安装tflite-model-maker模块时出现无限加载,推测是因为该模块要求Python 3.9版本
  • 下载VS Code并安装Python 3.9后,尝试在该环境下安装模块,却遇到numpy、pandas、protobuff、tensorflow_datasets等依赖冲突,还缺失array_record和"resource";修复部分问题后,又不断出现新的依赖问题
  • 尝试通过Jupyter Notebook安装模块,却找不到tflite-model-maker模块

所需依赖代码

import tensorflow as tf
import numpy as np
import os

from tflite_model_maker import configs
from tflite_model_maker import ExportFormat
from tflite_model_maker import model_spec
from tflite_model_maker import text_classifier
from tflite_model_maker.text_classifier import DataLoader

assert tf.__version__.startswith('2')
tf.get_logger().setLevel('ERROR')

补充说明

上述依赖在TensorFlow官方文档中未被提及,且文档提供的Google Colab链接也无法正常使用。

内容的提问来源于stack exchange,提问作者Skyain

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 00:05:01