fix(webgpu): stabilize qwen streaming and multimodal fallback#4
Open
fix(webgpu): stabilize qwen streaming and multimodal fallback#4
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements to the
llama_webgpu_bridge.jsandllama_webgpu_core.cppfiles, focusing on more robust handling of text output, safer CPU fallback logic for multimodal models, and better normalization of media markers. The changes enhance stability, correctness, and compatibility, especially when working with multimodal models and streaming text.Text output and streaming stability
trimUnstableUtf8Tailfunction to ensure streamed text does not end with incomplete or unstable UTF-8 sequences, improving the reliability of token emission during generation. (js/llama_webgpu_bridge.js)js/llama_webgpu_bridge.js) [1] [2] [3]Multimodal model CPU fallback and option sanitization
_createCpuSafeMultimodalLoadOptionsto sanitize model loading options for CPU fallback, limiting context size, thread count, and batch size for safer operation. (js/llama_webgpu_bridge.js)js/llama_webgpu_bridge.js) [1] [2] [3]Media marker normalization
src/llama_webgpu_core.cpp)Token handling and generation correctness
src/llama_webgpu_core.cpp)