README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model:
|
| 4 |
+
- google/embeddinggemma-2
|
| 5 |
+
pipeline_tag: feature-extraction
|
| 6 |
+
tags:
|
| 7 |
+
- radiance
|
| 8 |
+
- rocm
|
| 9 |
+
- amd
|
| 10 |
+
- rdna4
|
| 11 |
+
- bf16
|
| 12 |
+
- embedding
|
| 13 |
+
- multimodal-embedding
|
| 14 |
+
- sentence-similarity
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# EmbeddingGemma 2 BF16 — radiance container
|
| 18 |
+
|
| 19 |
+
[google/embeddinggemma-2](https://huggingface.co/google/embeddinggemma-2) in bf16, exactly as the
|
| 20 |
+
checkpoint ships it, as a single `.rad` container for the
|
| 21 |
+
[radiance](https://codeberg.org/StillDeadcode/radiance) inference engine. It embeds text, images, video
|
| 22 |
+
and audio on an AMD card (RDNA4, ROCm) or on the CPU.
|
| 23 |
+
|
| 24 |
+
| | |
|
| 25 |
+
|---|---|
|
| 26 |
+
| File | `embeddinggemma2-bf16.rad` — 1.40 GiB |
|
| 27 |
+
| Weights | every weight of the model, the vision and audio towers included, bf16 as the checkpoint ships it |
|
| 28 |
+
| Output | 768-dimensional vectors, mean-pooled and normalised as the model's sentence-transformers configuration states |
|
| 29 |
+
| Modalities | text, image, video, audio |
|
| 30 |
+
| Needs | radiance 1.5.0 or newer |
|
| 31 |
+
|
| 32 |
+
## Serve
|
| 33 |
+
|
| 34 |
+
```sh
|
| 35 |
+
radiance --model embeddinggemma2-bf16.rad --host 0.0.0.0 --port 8000
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
With no card visible, radiance serves it on the CPU. The Docker image is `stilldeadcode/radiance`.
|
| 39 |
+
Requests go to `/v1/embeddings`. `input` is a string, a list of strings, or content parts:
|
| 40 |
+
|
| 41 |
+
```json
|
| 42 |
+
{"input": [{"type": "image_url", "image_url": {"url": "data:image/png;base64,..."}},
|
| 43 |
+
{"type": "text", "text": "a red square"}]}
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
Video is a `video_url` part, and audio an `input_audio` part (`{"data": <base64 wav>, "format": "wav"}`).
|
| 47 |
+
`prompt_name` applies one of the model's named prompts (`query`, `document`, `Retrieval-query`, ...),
|
| 48 |
+
`dimensions` truncates the vector and normalises it again, and `image_tokens` (70, 140, 280, 560 or 1120) sets an image's
|
| 49 |
+
token budget.
|
| 50 |
+
|
| 51 |
+
## Accuracy
|
| 52 |
+
|
| 53 |
+
Cosine similarity against the Hugging Face transformers reference in bf16, served by radiance 1.5.0:
|
| 54 |
+
|
| 55 |
+
| input | R9700 | CPU |
|
| 56 |
+
|---|---|---|
|
| 57 |
+
| text, 4 to 6,704 tokens | 0.99992 – 0.99997 | 0.99990 – 0.99998 |
|
| 58 |
+
| images | 0.99998 – 0.99999 | 0.99998 – 0.99999 |
|
| 59 |
+
| video | 0.99997 | 0.99997 |
|
| 60 |
+
| audio (7 s, 30 s) | 0.99992 – 0.99993 | 0.99974 (7 s) |
|
| 61 |
+
| text + image | 0.99997 | 0.99996 |
|
| 62 |
+
|
| 63 |
+
A text that itself begins with the literal string `<bos>` scores 0.998: radiance does not add a second
|
| 64 |
+
`<bos>` in front of it, where the reference does.
|
| 65 |
+
|
| 66 |
+
## Speed
|
| 67 |
+
|
| 68 |
+
On one Radeon AI PRO R9700 (gfx1201): about 148,000 text tokens a second in batches; 27 images a second
|
| 69 |
+
one at a time and 52 at eight in parallel; a 7 s audio clip in 20 ms and a 30 s clip in 49 ms. On a
|
| 70 |
+
Ryzen 9 9950X3D: about 12,000 text tokens a second, 2.3 images a second, and a 30 s audio clip in
|
| 71 |
+
265 ms.
|
| 72 |
+
|
| 73 |
+
## How this file was made
|
| 74 |
+
|
| 75 |
+
```sh
|
| 76 |
+
rad-convert google/embeddinggemma-2 -o embeddinggemma2-bf16.rad
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
No recipe: every weight is the checkpoint's own.
|