IMvision12 commited on
Commit
fc4d32d
·
verified ·
1 Parent(s): c667742

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

Browse files
README.md CHANGED
@@ -2,10 +2,10 @@
2
  pipeline_tag: automatic-speech-recognition
3
  license: mit
4
  base_model: UsefulSensors/moonshine-tiny
5
- library_name: kerasformers
6
  tags:
7
  - keras
8
- - kerasformers
9
  - moonshine
10
  - automatic-speech-recognition
11
  - audio
@@ -15,13 +15,13 @@ tags:
15
  - tf
16
  ---
17
 
18
- ## ***See [our collection](https://huggingface.co/collections/kerasformers/moonshine-6a6acc6dae5ff619b873d6c9) for all versions of Moonshine.***
19
 
20
  # Run Moonshine with Keras 3: JAX, PyTorch, or TensorFlow
21
 
22
- [![GitHub](https://img.shields.io/badge/GitHub-KerasFormers-black?logo=github)](https://github.com/IMvision12/KerasFormers) [![Docs](https://img.shields.io/badge/Docs-Moonshine-blue)](https://imvision12.github.io/KerasFormers/moonshine/) [![Collection](https://img.shields.io/badge/HF-Moonshine%20collection-yellow)](https://huggingface.co/collections/kerasformers/moonshine-6a6acc6dae5ff619b873d6c9)
23
 
24
- # kerasformers/moonshine_tiny
25
 
26
  Paper: [Moonshine: Speech Recognition for Live Transcription and Voice Commands (arXiv:2410.15608)](https://arxiv.org/abs/2410.15608) · [HF Papers](https://huggingface.co/papers/2410.15608)
27
 
@@ -29,7 +29,7 @@ Moonshine is an English ASR encoder-decoder built for **short / live** audio: th
29
 
30
  For more details on the model, please go to the upstream [model card](https://huggingface.co/UsefulSensors/moonshine-tiny).
31
 
32
- Pure-**Keras 3** conversion of [`UsefulSensors/moonshine-tiny`](https://huggingface.co/UsefulSensors/moonshine-tiny) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
33
 
34
  This is an **ASR** checkpoint (`MoonshineConditionalGenerate`).
35
 
@@ -40,13 +40,13 @@ import os
40
  os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
41
 
42
  import soundfile as sf
43
- from kerasformers.models.moonshine import (
44
  MoonshineProcessor,
45
  MoonshineConditionalGenerate,
46
  )
47
 
48
- model = MoonshineConditionalGenerate.from_weights("kerasformers/moonshine_tiny")
49
- processor = MoonshineProcessor.from_weights("kerasformers/moonshine_tiny")
50
 
51
  audio, sr = sf.read("your_audio.wav", dtype="float32") # 16 kHz mono
52
  # Cost scales with clip length: no fixed 30 s pad like Whisper.
@@ -54,19 +54,19 @@ text = model.generate(audio, processor)
54
  print(repr(text[0]))
55
  ```
56
 
57
- Load any Moonshine variant the same way with `from_weights("kerasformers/<variant>")`:
58
 
59
  | Variant | Hub |
60
  |---|---|
61
- | `moonshine_tiny` | [`kerasformers/moonshine_tiny`](https://huggingface.co/kerasformers/moonshine_tiny) |
62
- | `moonshine_base` | [`kerasformers/moonshine_base`](https://huggingface.co/kerasformers/moonshine_base) |
63
 
64
  ## Tips
65
 
66
- - Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
67
  - Prefer `MoonshineProcessor.from_weights(...)` so feature extraction matches.
68
  - English-only; pass a list of waveforms to batch.
69
- - See [Moonshine docs](https://imvision12.github.io/KerasFormers/moonshine/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
70
  - Community / upstream safetensors still work via the `hf:` prefix, e.g. `MoonshineConditionalGenerate.from_weights("hf:UsefulSensors/moonshine-tiny")`.
71
 
72
  ## Special Thanks
 
2
  pipeline_tag: automatic-speech-recognition
3
  license: mit
4
  base_model: UsefulSensors/moonshine-tiny
5
+ library_name: zeromodels
6
  tags:
7
  - keras
8
+ - zeromodels
9
  - moonshine
10
  - automatic-speech-recognition
11
  - audio
 
15
  - tf
16
  ---
17
 
18
+ ## ***See [our collection](https://huggingface.co/collections/zeromodels/moonshine-6a6acc6dae5ff619b873d6c9) for all versions of Moonshine.***
19
 
20
  # Run Moonshine with Keras 3: JAX, PyTorch, or TensorFlow
21
 
22
+ [![GitHub](https://img.shields.io/badge/GitHub-ZeroModels-black?logo=github)](https://github.com/IMvision12/ZeroModels) [![Docs](https://img.shields.io/badge/Docs-Moonshine-blue)](https://imvision12.github.io/ZeroModels/moonshine/) [![Collection](https://img.shields.io/badge/HF-Moonshine%20collection-yellow)](https://huggingface.co/collections/zeromodels/moonshine-6a6acc6dae5ff619b873d6c9)
23
 
24
+ # zeromodels/moonshine_tiny
25
 
26
  Paper: [Moonshine: Speech Recognition for Live Transcription and Voice Commands (arXiv:2410.15608)](https://arxiv.org/abs/2410.15608) · [HF Papers](https://huggingface.co/papers/2410.15608)
27
 
 
29
 
30
  For more details on the model, please go to the upstream [model card](https://huggingface.co/UsefulSensors/moonshine-tiny).
31
 
32
+ Pure-**Keras 3** conversion of [`UsefulSensors/moonshine-tiny`](https://huggingface.co/UsefulSensors/moonshine-tiny) for [zeromodels](https://github.com/IMvision12/ZeroModels). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
33
 
34
  This is an **ASR** checkpoint (`MoonshineConditionalGenerate`).
35
 
 
40
  os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
41
 
42
  import soundfile as sf
43
+ from zeromodels.models.moonshine import (
44
  MoonshineProcessor,
45
  MoonshineConditionalGenerate,
46
  )
47
 
48
+ model = MoonshineConditionalGenerate.from_weights("zeromodels/moonshine_tiny")
49
+ processor = MoonshineProcessor.from_weights("zeromodels/moonshine_tiny")
50
 
51
  audio, sr = sf.read("your_audio.wav", dtype="float32") # 16 kHz mono
52
  # Cost scales with clip length: no fixed 30 s pad like Whisper.
 
54
  print(repr(text[0]))
55
  ```
56
 
57
+ Load any Moonshine variant the same way with `from_weights("zeromodels/<variant>")`:
58
 
59
  | Variant | Hub |
60
  |---|---|
61
+ | `moonshine_tiny` | [`zeromodels/moonshine_tiny`](https://huggingface.co/zeromodels/moonshine_tiny) |
62
+ | `moonshine_base` | [`zeromodels/moonshine_base`](https://huggingface.co/zeromodels/moonshine_base) |
63
 
64
  ## Tips
65
 
66
+ - Set `KERAS_BACKEND` **before** importing Keras / zeromodels.
67
  - Prefer `MoonshineProcessor.from_weights(...)` so feature extraction matches.
68
  - English-only; pass a list of waveforms to batch.
69
+ - See [Moonshine docs](https://imvision12.github.io/ZeroModels/moonshine/) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/).
70
  - Community / upstream safetensors still work via the `hf:` prefix, e.g. `MoonshineConditionalGenerate.from_weights("hf:UsefulSensors/moonshine-tiny")`.
71
 
72
  ## Special Thanks
kf_config.json → zm_config.json RENAMED
@@ -1,38 +1,38 @@
1
- {
2
- "library_name": "kerasformers",
3
- "kerasformers_version": "1.2.1",
4
- "model_module": "kerasformers.models.moonshine",
5
- "model_class": "MoonshineModel",
6
- "variant": "moonshine_tiny",
7
- "weights": "model.weights.h5",
8
- "schema_version": 2,
9
- "weight_dtype": "float32",
10
- "model_type": "moonshine",
11
- "audio_config": {
12
- "num_layers": 6,
13
- "attention_heads": 8,
14
- "num_kv_heads": null,
15
- "ffn_dim": 1152,
16
- "activation": "gelu"
17
- },
18
- "text_config": {
19
- "num_layers": 6,
20
- "attention_heads": 8,
21
- "num_kv_heads": null,
22
- "ffn_dim": 1152,
23
- "activation": "silu",
24
- "vocab_size": 32768,
25
- "max_position_embeddings": 194,
26
- "partial_rotary_factor": 0.9,
27
- "rope_theta": 10000.0
28
- },
29
- "hidden_dim": 288,
30
- "layer_norm_eps": 1e-05,
31
- "generate_args": {
32
- "bos_token_id": 1,
33
- "pad_token_id": 2,
34
- "decoder_start_token_id": 1,
35
- "eos_token_id": 2,
36
- "max_length": 194
37
- }
38
  }
 
1
+ {
2
+ "library_name": "zeromodels",
3
+ "zeromodels_version": "1.2.1",
4
+ "model_module": "zeromodels.models.moonshine",
5
+ "model_class": "MoonshineModel",
6
+ "variant": "moonshine_tiny",
7
+ "weights": "model.weights.h5",
8
+ "schema_version": 2,
9
+ "weight_dtype": "float32",
10
+ "model_type": "moonshine",
11
+ "audio_config": {
12
+ "num_layers": 6,
13
+ "attention_heads": 8,
14
+ "num_kv_heads": null,
15
+ "ffn_dim": 1152,
16
+ "activation": "gelu"
17
+ },
18
+ "text_config": {
19
+ "num_layers": 6,
20
+ "attention_heads": 8,
21
+ "num_kv_heads": null,
22
+ "ffn_dim": 1152,
23
+ "activation": "silu",
24
+ "vocab_size": 32768,
25
+ "max_position_embeddings": 194,
26
+ "partial_rotary_factor": 0.9,
27
+ "rope_theta": 10000.0
28
+ },
29
+ "hidden_dim": 288,
30
+ "layer_norm_eps": 1e-05,
31
+ "generate_args": {
32
+ "bos_token_id": 1,
33
+ "pad_token_id": 2,
34
+ "decoder_start_token_id": 1,
35
+ "eos_token_id": 2,
36
+ "max_length": 194
37
+ }
38
  }
kf_preprocessor.json → zm_preprocessor.json RENAMED
@@ -1,9 +1,9 @@
1
- {
2
- "library_name": "kerasformers",
3
- "kerasformers_version": "1.1.3",
4
- "preprocessor_module": "kerasformers.models.moonshine",
5
- "preprocessor_class": "MoonshineFeatureExtractor",
6
- "variant": "moonshine_tiny",
7
- "sampling_rate": 16000,
8
- "padding_value": 0.0
9
  }
 
1
+ {
2
+ "library_name": "zeromodels",
3
+ "zeromodels_version": "1.1.3",
4
+ "preprocessor_module": "zeromodels.models.moonshine",
5
+ "preprocessor_class": "MoonshineFeatureExtractor",
6
+ "variant": "moonshine_tiny",
7
+ "sampling_rate": 16000,
8
+ "padding_value": 0.0
9
  }