Code Monkey home page Code Monkey logo

gemma-on-android's Introduction

Gemma on Android

This project is an implementation of fine-tuning the Gemma 2b-it model on a custom dataset and deploy the fine-tuned model on Android

Pipeline:

Demo Output:

Steps to run:

  1. Clone the repository on your local machine.
  2. Open the project in Android Studio.
  3. Edit InferenceModel.kt file on Line 44 by replacing YOUR_MODE_NAME.bin with the actual name of your model.
  4. Build the project.
  5. Install the Android app on your phone and enjoy using SciGemma.

Resources:

  1. Follow along three blog series explaining the code in detail:

    Part 1: Step-by-Step Dataset Creation- Unstructured to Structured

    Part 2: Fine Tune - Gemma 2b-it model

    Part 3: Deploying SciGemma on Android

  2. Fine-tuned model on 🤗: https://huggingface.co/NSTiwari/fine_tuned_science_gemma2b-it

  3. Try our model on HFSpaces: https://huggingface.co/spaces/Aashi/NSTiwari-fine_tuned_science_gemma2b-it?logs=container

  4. Checkout demo video on YouTube: https://www.youtube.com/watch?v=T_HDsVHTrwg

Acknowledgment:

This project was developed during Google's ML Developer Programs Gemma sprint. We thank the MLDP team for the opportunity.

gemma-on-android's People

Contributors

nstiwari avatar aashidutt avatar

Stargazers

 avatar Jaemin Noh avatar SANJEEV KUMAR THAKUR avatar Jorge Jordão avatar Ali Ahmad avatar Jiang avatar ailichao avatar Lucas avatar Gurnoor Singh Saini avatar 太白几 avatar Annapurna avatar kw avatar  avatar Isabella Bicalho Frazeto avatar Mahmoud Alaa avatar Demet avatar

Watchers

 avatar

gemma-on-android's Issues

An error occurs when APP running

Question :
I am impressed with your project and find it very interesting.
However, after pushing the model(scigemma.bin) and build to Android Studio(modify InferenceModel.kt), upon running the app, it exits with the following log indicating it can't find the NDK library. Do you have any idea of the issues?

Error Log :
com.example.scigemma E FATAL EXCEPTION: main Process: com.example.scigemma, PID: 6624 java.lang.UnsatisfiedLinkError: dlopen failed: library "libllm_inference_engine_jni.so" not found at java.lang.Runtime.loadLibrary0(Runtime.java:1087) at java.lang.Runtime.loadLibrary0(Runtime.java:1008) at java.lang.System.loadLibrary(System.java:1664) at com.google.mediapipe.tasks.genai.llminference.LlmInference.<clinit>(LlmInference.java:27) at com.google.mediapipe.tasks.genai.llminference.LlmInference.createFromOptions(LlmInference.java:33) at com.example.scigemma.InferenceModel.<init>(InferenceModel.kt:36) at com.example.scigemma.InferenceModel.<init>(Unknown Source:0) at com.example.scigemma.InferenceModel$Companion.getInstance(InferenceModel.kt:51) at com.example.scigemma.LoadingScreenKt$LoadingRoute$2$1.invokeSuspend(LoadingScreen.kt:43) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:100) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684) Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@a282039, androidx.compose.runtime.BroadcastFrameClock@1fd467e, StandaloneCoroutine{Cancelling}@7c597df, AndroidUiDispatcher@8e1cc2c]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.