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

Merge LoRA weights to LLM at initialization time on-device (Gemma) #5255

Open
sitatec opened this issue Mar 24, 2024 · 2 comments
Open

Merge LoRA weights to LLM at initialization time on-device (Gemma) #5255

sitatec opened this issue Mar 24, 2024 · 2 comments
Assignees
Labels
platform:android Issues with Android as Platform platform:ios MediaPipe IOS issues platform:javascript MediaPipe Javascript issues stat:awaiting googler Waiting for Google Engineer's Response task:LLM inference Issues related to MediaPipe LLM Inference Gen AI setup type:feature Enhancement in the New Functionality or Request for a New Solution

Comments

@sitatec
Copy link

sitatec commented Mar 24, 2024

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

No

OS Platform and Distribution

Web, Android, IOS

MediaPipe Tasks SDK version

No response

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

GenAI

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

TypeScript, Java, Swift

Describe the actual behavior

Couldn't find a way to merge lora weights to Gemma

Describe the expected behaviour

I want to be able to add a LoRA adapter to Gemma locally (on-device)

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

I'm experimenting something on Web with mediapipe that require having multiple LoRA files, each file trained for a different task. I want to select a LoRA file and merge it to Gemma at initialization time locally on web. I went through the code, I saw some .proto file with lora_path or lora_rank fields but I haven't seen any exposed parameter from the LlmInference class or its options that can help me specify a LoRA file.

One option could be (Maybe) to use the LlmGPUCalculatorOptions.lora_path. However, the current API doesn't expose anything that make this possible, I don't even know if it could work e.i: if that field is meant for this purpose. Will this option work? If so, I can open a PR for it. If not, how can I achieve this?

Other info / Complete Logs

No response

@kuaashish kuaashish assigned kuaashish and unassigned ayushgdev Mar 26, 2024
@kuaashish kuaashish added task:LLM inference Issues related to MediaPipe LLM Inference Gen AI setup type:support General questions platform:javascript MediaPipe Javascript issues platform:android Issues with Android as Platform platform:ios MediaPipe IOS issues labels Mar 26, 2024
@kevin36524
Copy link

This will be a very useful feature in reducing the app size. Loading the Lora at run-time is also something google is trying to do with Gemini nano on high end devices.

@schmidt-sebastian schmidt-sebastian added type:feature Enhancement in the New Functionality or Request for a New Solution and removed type:support General questions labels Apr 19, 2024
@schmidt-sebastian
Copy link
Collaborator

Thank you. We are logging this as a feature request.

@kuaashish kuaashish added the stat:awaiting googler Waiting for Google Engineer's Response label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:android Issues with Android as Platform platform:ios MediaPipe IOS issues platform:javascript MediaPipe Javascript issues stat:awaiting googler Waiting for Google Engineer's Response task:LLM inference Issues related to MediaPipe LLM Inference Gen AI setup type:feature Enhancement in the New Functionality or Request for a New Solution
Projects
None yet
Development

No branches or pull requests

5 participants