IMvision12 commited on
Commit
a62652f
·
verified ·
1 Parent(s): c40f4de

Migrate to zeromodels (rename kf_*.json -> zm_*.json, fix refs in config + README, ensure tag + badge)

Browse files
Files changed (2) hide show
  1. README.md +18 -18
  2. kf_config.json → zm_config.json +3 -3
README.md CHANGED
@@ -2,13 +2,13 @@
2
  pipeline_tag: text-generation
3
  license: gemma
4
  base_model: google/gemma-2b-it
5
- library_name: kerasformers
6
  extra_gated_heading: Access Gemma on Hugging Face
7
  language:
8
  - en
9
  tags:
10
  - keras
11
- - kerasformers
12
  - gemma
13
  - gemma-2b
14
  - text-generation
@@ -18,16 +18,16 @@ tags:
18
  - tf
19
  ---
20
 
21
- *See [our collection](https://huggingface.co/kerasformers) for all Gemma sizes and variants.*
22
 
23
  # Run Gemma with Keras 3: JAX, PyTorch, or TensorFlow
24
 
25
- [![GitHub](https://img.shields.io/badge/GitHub-KerasFormers-181717?logo=github)](https://github.com/IMvision12/KerasFormers) [![Docs](https://img.shields.io/badge/Docs-Gemma-1f6feb)](https://imvision12.github.io/KerasFormers/gemma/) [![HuggingFace](https://img.shields.io/badge/HuggingFace-Gemma-ffd21e?logo=huggingface&logoColor=black)](https://huggingface.co/kerasformers)
26
 
27
- # kerasformers/gemma-2b-it
28
 
29
  Pure-**Keras 3** conversion of [`google/gemma-2b-it`](https://huggingface.co/google/gemma-2b-it) for
30
- [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on
31
  **TensorFlow / Torch / JAX**. This is the instruction-tuned checkpoint, served here as **text -> text** via `GemmaTextGenerate`; weights are
32
  stored in **bfloat16**.
33
 
@@ -40,33 +40,33 @@ For model details, license, and usage terms, see Google's
40
  import os
41
  os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
42
 
43
- from kerasformers.models.gemma import GemmaTextGenerate, GemmaTokenizer
44
 
45
- model = GemmaTextGenerate.from_weights("kerasformers/gemma-2b-it")
46
- tokenizer = GemmaTokenizer.from_weights("kerasformers/gemma-2b-it")
47
 
48
  inputs = tokenizer([{"role": "user", "content": "Hello, who are you?"}])
49
  outputs = model.generate(**inputs, max_new_tokens=64)
50
  print(tokenizer.decode(outputs[0]))
51
  ```
52
 
53
- Load any Gemma variant the same way with `from_weights("kerasformers/<variant>")`:
54
 
55
  | Variant | Hub |
56
  | --- | --- |
57
- | `gemma-1.1-2b-it` | [kerasformers/gemma-1.1-2b-it](https://huggingface.co/kerasformers/gemma-1.1-2b-it) |
58
- | `gemma-1.1-7b-it` | [kerasformers/gemma-1.1-7b-it](https://huggingface.co/kerasformers/gemma-1.1-7b-it) |
59
- | `gemma-2b` | [kerasformers/gemma-2b](https://huggingface.co/kerasformers/gemma-2b) |
60
- | `gemma-2b-it` | [kerasformers/gemma-2b-it](https://huggingface.co/kerasformers/gemma-2b-it) |
61
- | `gemma-7b` | [kerasformers/gemma-7b](https://huggingface.co/kerasformers/gemma-7b) |
62
- | `gemma-7b-it` | [kerasformers/gemma-7b-it](https://huggingface.co/kerasformers/gemma-7b-it) |
63
 
64
  ## Tips
65
 
66
- - Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
67
  - Loads in **bfloat16** by default. Pass `load_dtype="float32"` for full precision,
68
  or `quantization="int8"` to shrink further.
69
- - See the [Gemma docs](https://imvision12.github.io/KerasFormers/gemma/).
70
  - Community / upstream weights still work via the `hf:` prefix:
71
  `GemmaTextGenerate.from_weights("hf:google/gemma-2b-it")`.
72
 
 
2
  pipeline_tag: text-generation
3
  license: gemma
4
  base_model: google/gemma-2b-it
5
+ library_name: zeromodels
6
  extra_gated_heading: Access Gemma on Hugging Face
7
  language:
8
  - en
9
  tags:
10
  - keras
11
+ - zeromodels
12
  - gemma
13
  - gemma-2b
14
  - text-generation
 
18
  - tf
19
  ---
20
 
21
+ *See [our collection](https://huggingface.co/zeromodels) for all Gemma sizes and variants.*
22
 
23
  # Run Gemma with Keras 3: JAX, PyTorch, or TensorFlow
24
 
25
+ [![GitHub](https://img.shields.io/badge/GitHub-ZeroModels-181717?logo=github)](https://github.com/IMvision12/ZeroModels) [![Docs](https://img.shields.io/badge/Docs-Gemma-1f6feb)](https://imvision12.github.io/ZeroModels/gemma/) [![HuggingFace](https://img.shields.io/badge/HuggingFace-Gemma-ffd21e?logo=huggingface&logoColor=black)](https://huggingface.co/zeromodels)
26
 
27
+ # zeromodels/gemma-2b-it
28
 
29
  Pure-**Keras 3** conversion of [`google/gemma-2b-it`](https://huggingface.co/google/gemma-2b-it) for
30
+ [zeromodels](https://github.com/IMvision12/ZeroModels). One implementation runs unmodified on
31
  **TensorFlow / Torch / JAX**. This is the instruction-tuned checkpoint, served here as **text -> text** via `GemmaTextGenerate`; weights are
32
  stored in **bfloat16**.
33
 
 
40
  import os
41
  os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
42
 
43
+ from zeromodels.models.gemma import GemmaTextGenerate, GemmaTokenizer
44
 
45
+ model = GemmaTextGenerate.from_weights("zeromodels/gemma-2b-it")
46
+ tokenizer = GemmaTokenizer.from_weights("zeromodels/gemma-2b-it")
47
 
48
  inputs = tokenizer([{"role": "user", "content": "Hello, who are you?"}])
49
  outputs = model.generate(**inputs, max_new_tokens=64)
50
  print(tokenizer.decode(outputs[0]))
51
  ```
52
 
53
+ Load any Gemma variant the same way with `from_weights("zeromodels/<variant>")`:
54
 
55
  | Variant | Hub |
56
  | --- | --- |
57
+ | `gemma-1.1-2b-it` | [zeromodels/gemma-1.1-2b-it](https://huggingface.co/zeromodels/gemma-1.1-2b-it) |
58
+ | `gemma-1.1-7b-it` | [zeromodels/gemma-1.1-7b-it](https://huggingface.co/zeromodels/gemma-1.1-7b-it) |
59
+ | `gemma-2b` | [zeromodels/gemma-2b](https://huggingface.co/zeromodels/gemma-2b) |
60
+ | `gemma-2b-it` | [zeromodels/gemma-2b-it](https://huggingface.co/zeromodels/gemma-2b-it) |
61
+ | `gemma-7b` | [zeromodels/gemma-7b](https://huggingface.co/zeromodels/gemma-7b) |
62
+ | `gemma-7b-it` | [zeromodels/gemma-7b-it](https://huggingface.co/zeromodels/gemma-7b-it) |
63
 
64
  ## Tips
65
 
66
+ - Set `KERAS_BACKEND` **before** importing Keras / zeromodels.
67
  - Loads in **bfloat16** by default. Pass `load_dtype="float32"` for full precision,
68
  or `quantization="int8"` to shrink further.
69
+ - See the [Gemma docs](https://imvision12.github.io/ZeroModels/gemma/).
70
  - Community / upstream weights still work via the `hf:` prefix:
71
  `GemmaTextGenerate.from_weights("hf:google/gemma-2b-it")`.
72
 
kf_config.json → zm_config.json RENAMED
@@ -1,7 +1,7 @@
1
  {
2
- "library_name": "kerasformers",
3
- "kerasformers_version": "1.2.1",
4
- "model_module": "kerasformers.models.gemma",
5
  "model_class": "GemmaTextGenerate",
6
  "variant": "gemma-2b-it",
7
  "weights": "model.weights.h5",
 
1
  {
2
+ "library_name": "zeromodels",
3
+ "zeromodels_version": "1.2.1",
4
+ "model_module": "zeromodels.models.gemma",
5
  "model_class": "GemmaTextGenerate",
6
  "variant": "gemma-2b-it",
7
  "weights": "model.weights.h5",