--- license: cc-by-nc-4.0 base_model: MadeAgents/Hammer2.1-1.5b pipeline_tag: text-generation tags: - chat --- # litert-community/Hammer2.1-1.5b This model provides a few variants of [MadeAgents/Hammer2.1-1.5b](https://huggingface.co/MadeAgents/Hammer2.1-1.5b) that are ready for deployment on Android using the [LiteRT (fka TFLite) stack](https://ai.google.dev/edge/litert) and [MediaPipe LLM Inference API](https://ai.google.dev/edge/mediapipe/solutions/genai/llm_inference). ## Use the models ### Colab *Disclaimer: The target deployment surface for the LiteRT models is Android/iOS/Web and the stack has been optimized for performance on these targets. Trying out the system in Colab is an easier way to familiarize yourself with the LiteRT stack, with the caveat that the performance (memory and latency) on Colab could be much worse than on a local device.* [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/#fileId=https://huggingface.co/litert-community/Hammer2.1-1.5b/blob/main/notebook.ipynb) ### Android * Download and install [the apk](https://github.com/google-ai-edge/gallery/releases/latest/download/ai-edge-gallery.apk). * Follow the instructions in the app. To build the demo app from source, please follow the [instructions](https://github.com/google-ai-edge/gallery/blob/main/README.md) from the GitHub repository. ### iOS * Clone the [MediaPipe samples](https://github.com/google-ai-edge/mediapipe-samples) repository and follow the [instructions](https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/llm_inference/ios/README.md) to build the LLM Inference iOS Sample App using XCode. * Run the app via the iOS simulator or deploy to an iOS device. ## Performance ### Android Note that all benchmark stats are from a Samsung S24 Ultra and multiple prefill signatures enabled.
Backend Quantization scheme Context length Prefill (tokens/sec) Decode (tokens/sec) Time-to-first-token (sec) CPU Memory (RSS in MB) GPU Memory (RSS in MB) Model size (MB)

CPU

fp32 (baseline)

1280

29 tk/s

7 tk/s

8.88 s

6,146 MB

5,893 MB

🔗

4096

25 tk/s

6 tk/s

10.51 s

6,364 MB

5,893 MB

🔗

dynamic_int8

1280

107 tk/s

24 tk/s

2.82 s

1,826 MB

1,523 MB

🔗

4096

60 tk/s

19 tk/s

4.60 s

2,055 MB

1,523 MB

🔗

GPU

1280

704 tk/s

23 tk/s

5.80 s

3,174 MB

1,628 MB

1,523 MB

🔗

4096

441 tk/s

21 tk/s

6.16 s

3,176 MB

1,875 MB

1,523 MB

🔗

* For the list of supported quantization schemes see [supported-schemes](https://github.com/google-ai-edge/ai-edge-torch/tree/main/ai_edge_torch/generative/quantize#supported-schemes). For these models, we are using prefill signature lengths of 32, 128, 512 and 1280. * Model Size: measured by the size of the .tflite flatbuffer (serialization format for LiteRT models) * Memory: indicator of peak RAM usage * The inference on CPU is accelerated via the LiteRT [XNNPACK](https://github.com/google/XNNPACK) delegate with 4 threads * Benchmark is run with cache enabled and initialized. During the first run, the time to first token may differ.