IMvision12 commited on
Commit
8e676e0
·
verified ·
1 Parent(s): 78eeb27

fix readme.md

Browse files
Files changed (1) hide show
  1. README.md +61 -7
README.md CHANGED
@@ -1,22 +1,76 @@
1
  ---
2
  pipeline_tag: automatic-speech-recognition
3
  license: mit
 
4
  library_name: kerasformers
5
  tags:
6
  - keras
7
  - kerasformers
8
  - moonshine
9
- - tf
10
- - jax
 
11
  - pytorch
 
 
12
  ---
13
 
14
- # moonshine_tiny (Keras 3)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- Pure-Keras 3 weights for [kerasformers](https://github.com/IMvision12/KerasFormers), mirrored from the GitHub release. License: `mit`.
 
 
17
 
18
  ```python
19
- from kerasformers.models.moonshine import MoonshineSpeechToText, MoonshineProcessor
20
- model = MoonshineSpeechToText.from_weights("moonshine_tiny")
21
- processor = MoonshineProcessor.from_weights("moonshine_tiny")
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
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
12
+ - arxiv:2410.15608
13
  - pytorch
14
+ - jax
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
+
28
+ Moonshine is an English ASR encoder-decoder built for **short / live** audio: the encoder sees the raw waveform length you pass in (no Whisper-style 30 s pad), so short commands stay cheap. Output is cased and punctuated.
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 (`MoonshineSpeechToText`).
35
+
36
+ ## ✨ Quick start
37
 
38
  ```python
39
+ 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
+ MoonshineSpeechToText,
46
+ )
47
+
48
+ model = MoonshineSpeechToText.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.
53
+ 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. `MoonshineSpeechToText.from_weights("hf:UsefulSensors/moonshine-tiny")`.
71
+
72
+ ## Special Thanks
73
+
74
+ A huge thank you to the Useful Sensors Moonshine authors for creating and releasing these models.
75
+
76
+ License: MIT.