mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

ANR Triggered when processing a large prompt.

Open alexcontor opened this issue 1 year ago • 0 comments

Both com/google/mediapipe/tasks/genai/llminference/LlmInference#generateResponse and com/google/mediapipe/tasks/genai/llminference/LlmInference#generateResponseAsync methods freeze the Main Thread if the prompt provided is very long (1000 Tokens).

Wrapping the call in a async thread doesn't seem to work:

ExecutorService executor = Executors.newSingleThreadExecutor();
executor.execute(() -> {
       llmInference.generateResponseAsync(LARGE_PROMPT);
 });

alexcontor avatar Apr 04 '24 09:04 alexcontor