IMvision12 commited on
Commit
44b4d9a
·
verified ·
1 Parent(s): ea42f98

Standardize README to the kerasformers structure

Browse files
Files changed (1) hide show
  1. README.md +37 -11
README.md CHANGED
@@ -25,19 +25,25 @@ tags:
25
  - tf
26
  ---
27
 
28
- # gemma-3n-e2b
29
 
30
- Pure-[Keras 3](https://keras.io/keras_3/) port of `gemma-3n-e2b`, a vision-language model in [kerasformers](https://github.com/IMvision12/KerasFormers) (backend-agnostic: JAX / TensorFlow / PyTorch). The repo carries `kf_config.json` + Keras weights; load with `from_weights("kerasformers/gemma-3n-e2b")`.
31
 
32
- ## Installation
33
 
34
- ```bash
35
- pip install kerasformers
36
- ```
 
 
 
 
 
 
37
 
38
- ## Usage
39
 
40
- ### Text generation
41
 
42
  ```python
43
  import os
@@ -53,7 +59,7 @@ outputs = model.generate(**inputs, max_new_tokens=64)
53
  print(tokenizer.decode(outputs[0]))
54
  ```
55
 
56
- ### Image + text generation
57
 
58
  ```python
59
  from kerasformers.models.gemma3n import Gemma3nConditionalGenerate, Gemma3nProcessor
@@ -72,6 +78,26 @@ outputs = model.generate(**inputs, max_new_tokens=64)
72
  print(processor.decode(outputs[0]))
73
  ```
74
 
75
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
- Generated with kerasformers. See the [documentation](https://github.com/IMvision12/KerasFormers) for the full API.
 
25
  - tf
26
  ---
27
 
28
+ *See [our collection](https://huggingface.co/kerasformers) for all Gemma 3n sizes and variants.*
29
 
30
+ # Run Gemma 3n with Keras 3: JAX, PyTorch, or TensorFlow
31
 
32
+ [![GitHub](https://img.shields.io/badge/GitHub-KerasFormers-181717?logo=github)](https://github.com/IMvision12/KerasFormers) [![Docs](https://img.shields.io/badge/Docs-Gemma_3n-1f6feb)](https://imvision12.github.io/KerasFormers/gemma3n/) [![HuggingFace](https://img.shields.io/badge/HuggingFace-Gemma_3n-ffd21e?logo=huggingface&logoColor=black)](https://huggingface.co/kerasformers)
33
 
34
+ # kerasformers/gemma-3n-e2b
35
+
36
+ Pure-**Keras 3** conversion of [`google/gemma-3n-E2B`](https://huggingface.co/google/gemma-3n-E2B) for
37
+ [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on
38
+ **TensorFlow / Torch / JAX**. This is a base (pretrained) checkpoint, served here as **image + audio + text -> text** via `Gemma3nConditionalGenerate`; weights are
39
+ stored in **bfloat16**.
40
+
41
+ For model details, license, and usage terms, see Google's
42
+ [model card](https://huggingface.co/google/gemma-3n-E2B).
43
 
44
+ ## ✨ Quick start
45
 
46
+ ### Text-only
47
 
48
  ```python
49
  import os
 
59
  print(tokenizer.decode(outputs[0]))
60
  ```
61
 
62
+ ### Image + audio + text
63
 
64
  ```python
65
  from kerasformers.models.gemma3n import Gemma3nConditionalGenerate, Gemma3nProcessor
 
78
  print(processor.decode(outputs[0]))
79
  ```
80
 
81
+ Load any Gemma 3n variant the same way with `from_weights("kerasformers/<variant>")`:
82
+
83
+ | Variant | Hub |
84
+ | --- | --- |
85
+ | `gemma-3n-e2b` | [kerasformers/gemma-3n-e2b](https://huggingface.co/kerasformers/gemma-3n-e2b) |
86
+ | `gemma-3n-e2b-it` | [kerasformers/gemma-3n-e2b-it](https://huggingface.co/kerasformers/gemma-3n-e2b-it) |
87
+ | `gemma-3n-e4b` | [kerasformers/gemma-3n-e4b](https://huggingface.co/kerasformers/gemma-3n-e4b) |
88
+ | `gemma-3n-e4b-it` | [kerasformers/gemma-3n-e4b-it](https://huggingface.co/kerasformers/gemma-3n-e4b-it) |
89
+
90
+ ## Tips
91
+
92
+ - Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
93
+ - Loads in **bfloat16** by default. Pass `load_dtype="float32"` for full precision,
94
+ or `quantization="int8"` to shrink further.
95
+ - See the [Gemma 3n docs](https://imvision12.github.io/KerasFormers/gemma3n/).
96
+ - Community / upstream weights still work via the `hf:` prefix:
97
+ `Gemma3nConditionalGenerate.from_weights("hf:google/gemma-3n-E2B")`.
98
+
99
+ ## Special Thanks
100
+
101
+ A huge thank you to the Google Gemma authors for creating and releasing these models.
102
 
103
+ License: Gemma (gated). Accept the license on the upstream Hub card before downloading.