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

Calculator::Process() Error during text embedding on MacOS #5837

Open
ZeroCho opened this issue Jan 24, 2025 · 2 comments
Open

Calculator::Process() Error during text embedding on MacOS #5837

ZeroCho opened this issue Jan 24, 2025 · 2 comments
Assignees
Labels
os:macOS Issues on MacOS os:windows MediaPipe issues on Windows platform:python MediaPipe Python issues stale stat:awaiting response Waiting for user response task:text embedding Issues related to Text Embedding: Embed texts into feature vectors

Comments

@ZeroCho
Copy link

ZeroCho commented Jan 24, 2025

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

Yes

OS Platform and Distribution

MacOS 15.1.1(M3 Apple Silicon)

MediaPipe Tasks SDK version

0.10.20

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

text_embedder.embed

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

Python3.11.6

Describe the actual behavior

error happened

Describe the expected behaviour

embedding output come out

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

  1. copy my code attached 2. run python3 text-embedder.py puppy

Other info / Complete Logs

text-embedder.py

import mediapipe as mp
import numpy as np
import sys
import json

class NumpyEncoder(json.JSONEncoder):
    def default(self, obj):
        if isinstance(obj, np.ndarray):
            return obj.tolist()
        return super().default(obj)

model_path = './universal_sentence_encoder.tflite'

input_text = sys.argv[1]

BaseOptions = mp.tasks.BaseOptions
TextEmbedder = mp.tasks.text.TextEmbedder
TextEmbedderOptions = mp.tasks.text.TextEmbedderOptions

# For creating a text embedder instance:
options = TextEmbedderOptions(
    base_options=BaseOptions(model_asset_path=model_path))
text_embedder = TextEmbedder.create_from_options(options)
embedding_result = text_embedder.embed('an image of ' + input_text)
print(json.dumps(embedding_result.embeddings[0].embedding, cls=NumpyEncoder))
sys.stdout.flush()

model_path is below file
https://storage.googleapis.com/mediapipe-tasks/text_embedder/universal_sentence_encoder.tflite

Run python3 text-embedder.py puppy

error message is

E0000 00:00:1737691331.165400 10997022 calculator_graph.cc:928] INTERNAL: CalculatorGraph::Run() failed: 
Calculator::Process() for node "mediapipe_tasks_text_text_embedder_textembeddergraph__mediapipe_tasks_core_inferencesubgraph__inferencecalculator__mediapipe_tasks_text_text_embedder_textembeddergraph__mediapipe_tasks_core_inferencesubgraph__InferenceCalculator" failed: ; RET_CHECK failure (mediapipe/calculators/tensor/inference_calculator_utils.cc:158) input_tensor_bufferChar-typed input tensor buffer is null.;  at index 0
Traceback (most recent call last):
  File "/Users/zero/WebstormProjects/alchemist-back/text-embedder.py", line 24, in <module>
    embedding_result = text_embedder.embed('an image of ' + input_text)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/zero/WebstormProjects/alchemist-back/lib/python3.11/site-packages/mediapipe/tasks/python/text/text_embedder.py", line 158, in embed
    output_packets = self._runner.process(
                     ^^^^^^^^^^^^^^^^^^^^^
RuntimeError: CalculatorGraph::Run() failed: 
Calculator::Process() for node "mediapipe_tasks_text_text_embedder_textembeddergraph__mediapipe_tasks_core_inferencesubgraph__inferencecalculator__mediapipe_tasks_text_text_embedder_textembeddergraph__mediapipe_tasks_core_inferencesubgraph__InferenceCalculator" failed: ; RET_CHECK failure (mediapipe/calculators/tensor/inference_calculator_utils.cc:158) input_tensor_bufferChar-typed input tensor buffer is null.;  at index 0
@kuaashish kuaashish added os:macOS Issues on MacOS task:text embedding Issues related to Text Embedding: Embed texts into feature vectors platform:python MediaPipe Python issues os:windows MediaPipe issues on Windows labels Jan 24, 2025
@kuaashish
Copy link
Collaborator

Hi @ZeroCho,

Please try the Python Colab examples provided here and let us know if you can run the same examples on your local environment, both on macOS and Windows. Kindly update us on the status.

Thank you!!

@kuaashish kuaashish added the stat:awaiting response Waiting for user response label Jan 24, 2025
@ZeroCho ZeroCho changed the title Calculator::Process() Error during text embedding on Windows and MacOS Calculator::Process() Error during text embedding on MacOS Jan 25, 2025
Copy link

github-actions bot commented Feb 1, 2025

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale label Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os:macOS Issues on MacOS os:windows MediaPipe issues on Windows platform:python MediaPipe Python issues stale stat:awaiting response Waiting for user response task:text embedding Issues related to Text Embedding: Embed texts into feature vectors
Projects
None yet
Development

No branches or pull requests

2 participants