Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create TFLite interpreter from model when passing core-ml argument #97

Open
mikecfisher opened this issue Oct 16, 2024 · 4 comments

Comments

@mikecfisher
Copy link

I have a brand new Expo project and I'm trying to load a tflite model via this library. It works fine (but my app slows down too much) without passing the core-ml argument. When I pass core-ml I get this error.

Error loading model: [Error: Failed to create TFLite interpreter from model "http://192.168.68.59:8081/assets/?unstable_path=.%2Fassets%2Fmodels/model_float32.tflite?platform=ios&hash=c85e0013ff22528c158f75ed25a51667"!]

This is running on my local machine via the iOS simulator. Any ideas why this is happening when I pass this option?

Here is my package.json for reference

{
  "name": "my app",
  "main": "expo-router/entry",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start",
    "dev": "APP_VARIANT=development npx expo start",
    "reset-project": "node ./scripts/reset-project.js",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "test": "jest --watchAll",
    "lint": "eslint .",
    "typecheck": "tsc --noEmit"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "^14.0.2",
    "@gluestack-ui/button": "^1.0.7",
    "@gluestack-ui/nativewind-utils": "^1.0.25",
    "@gluestack-ui/overlay": "^0.1.15",
    "@gluestack-ui/toast": "^1.0.7",
    "@legendapp/state": "^3.0.0-beta.8",
    "@react-navigation/native": "^6.0.2",
    "@tanstack/react-query": "^5.59.13",
    "babel-plugin-module-resolver": "^5.0.2",
    "expo": "~51.0.28",
    "expo-constants": "~16.0.2",
    "expo-dev-client": "~4.0.28",
    "expo-file-system": "~17.0.1",
    "expo-font": "~12.0.9",
    "expo-linking": "~6.3.1",
    "expo-router": "~3.5.23",
    "expo-splash-screen": "~0.27.5",
    "expo-status-bar": "~1.12.1",
    "expo-system-ui": "~3.0.7",
    "expo-updates": "~0.25.27",
    "expo-web-browser": "~13.0.3",
    "nativewind": "4.0.36",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.5",
    "react-native-fast-tflite": "^1.4.0",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-mmkv": "2.12.2",
    "react-native-reanimated": "~3.10.1",
    "react-native-safe-area-context": "4.10.5",
    "react-native-screens": "3.31.1",
    "react-native-svg": "^13.4.0",
    "react-native-web": "~0.19.10",
    "tailwindcss": "^3.4.13",
    "expo-asset": "~10.0.10",
    "expo-image-manipulator": "~12.0.5"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@eslint/js": "^9.12.0",
    "@tanstack/eslint-plugin-query": "^5.59.7",
    "@types/jest": "^29.5.12",
    "@types/react": "~18.2.45",
    "@types/react-test-renderer": "^18.0.7",
    "@typescript-eslint/eslint-plugin": "^8.9.0",
    "@typescript-eslint/parser": "^8.9.0",
    "eslint": "^8.57.1",
    "eslint-config-universe": "^13.0.0",
    "eslint-plugin-import": "^2.31.0",
    "eslint-plugin-react": "^7.37.1",
    "eslint-plugin-react-hooks": "^5.0.0",
    "globals": "^15.11.0",
    "jest": "^29.2.1",
    "jest-expo": "~51.0.3",
    "jscodeshift": "^0.15.2",
    "prettier": "^3.3.3",
    "prettier-plugin-tailwindcss": "^0.6.8",
    "react-test-renderer": "18.2.0",
    "typescript": "~5.3.3",
    "typescript-eslint": "^8.9.0"
  },
  "private": true
}

Copy link

Guten Tag, Hans here! 🍻

It looks like you are experiencing an issue when using ze core-ml argument. However, to better assist you, we need more information. Can you please provide the relevant logs from ze iOS simulator? You can find ze logs in Xcode by opening ze Console window while running your app.

Additionally, if you want quicker responses or more support, consider sponsoring the project. This shows your support for mrousavy's work!

Looking forward to your logs!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

@lucksp
Copy link

lucksp commented Nov 20, 2024

This is valid. My original issue was auto-closed by the hans bot, but it should be open. It includes Logs & example repo: #84

This was only on Android, but now iOS too

@jslok
Copy link

jslok commented Nov 20, 2024

Same issue here when setting 'android-gpu' in useTensorflowModel
const objectDetection = useTensorflowModel(
require('./src/assets/model_float32_320.tflite'),
'android-gpu'
)

Without android-gpu, it loads.

@lucksp
Copy link

lucksp commented Dec 3, 2024

I am on version 1.3.0 and core-ml works...if I update to 1.4.0 it breaks

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

No branches or pull requests

3 participants