google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
27.5k stars 5.15k forks source link

Uncaught (in promise) Error: StartGraph failed: $ExternalFile must specify at least one of 'file_content', 'file_name', 'file_pointer_meta' or 'file_descriptor_meta'.; Initialize was not ok #4736

Closed lc-spxl closed 1 year ago

lc-spxl commented 1 year ago

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

No

OS Platform and Distribution

Web / SvelteKit

MediaPipe Tasks SDK version

npm package

Task name (e.g. Image classification, Gesture recognition etc.)

Audio Classifier

Programming Language and version (e.g. C++, Python, Java)

Javascript (Typescript)

Describe the actual behavior

Running the same example as here https://codepen.io/mediapipe-preview/pen/wvxYYmy?editors=1111

We do also have video tasks running correctly (pose,face,hands)

Describe the expected behaviour

It's should work

Standalone code/steps you may have used to try to get what you need

import { AudioClassifier, FilesetResolver } from '@mediapipe/tasks-audio';

export const createAudioClassifier = async () => {
  const audio = await FilesetResolver.forAudioTasks(
    "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio@0.10.0/wasm"
  );

  const audioClassifier = await AudioClassifier.createFromOptions(audio, {
    baseOptions: {
      modelAssetPath:
        "https://storage.googleapis.com/mediapipe-models/audio_classifier/yamnet/float32/1/yamnet.tflite"
    }
  });

  return audioClassifier
};

image

Other info / Complete Logs

audio_bundle.mjs:1 Uncaught (in promise) Error: StartGraph failed: $ExternalFile must specify at least one of 'file_content', 'file_name', 'file_pointer_meta' or 'file_descriptor_meta'.; Initialize was not ok
    at m.handleErrors (audio_bundle.mjs:1:411894)
    at m.setGraph (audio_bundle.mjs:1:411578)
    at m.refreshGraph (audio_bundle.mjs:1:419240)
    at audio_bundle.mjs:1:410967
    at async createTaskRunner (audio_bundle.mjs:1:409524)
    at async createAudioClassifier (AudioClassifier.ts:8:27)
    at async detectSilence (Microphone.svelte:151:27)
kuaashish commented 1 year ago

Hello @schmidt-sebastian,

Could you please look into this issue. Thank you

schmidt-sebastian commented 1 year ago

Thank you for reporting this. We will have to do some investigation here to see what the root cause is.

alessandroperetti commented 1 year ago

Hi, I don't know if it can help but disabling tasks-vision (delete the npm package and all the import inside the source code), tasks-audio starts to work again.

I am thinking, may be there is a conflict between the packages?

delta42 commented 1 year ago

I believe #4697, #4737 and this are the same as my #4729: there's a danger that MediaPipe can step on its own toes when creating more than one Task, and this can manifest itself with strange StartGraph or ValidateGraph errors, or others, depending on what Tasks are being initialized.

My solution was to simply await the completion of the first create call, or chain the Promise with then(), and then issuing the other create call.

lc-spxl commented 1 year ago

Just tried to load in series the various tasks, waiting for each Promise to fullfill.

Unfortunately this seems not to work, specifically the audio task consistently fails even if we do not actually load the vision task

As said by @alessandroperetti seems more an issue involving the presence of both packages. May it be related to overlapping types in the packages eg. FilesetResolver

An updated view of the task loading in series

image

image

delta42 commented 1 year ago

Interesting. I look forward to seeing what the MediaPipe team determines.

schmidt-sebastian commented 1 year ago

This has been fixed internally. Release is coming shortly.

google-ml-butler[bot] commented 1 year ago

Are you satisfied with the resolution of your issue? Yes No