Automatic Speech Recognition
Transformers
Safetensors
prosody_to_text
feature-extraction
prosody
speech-recognition
custom_code
Instructions to use Daporte/prosody2text-weights with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Daporte/prosody2text-weights with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="Daporte/prosody2text-weights", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Daporte/prosody2text-weights", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Filter the max_length warning by message, since unsetting it does not work
Browse filesgeneration_config.max_length is already None after load -- checked at
runtime -- so the previous commit's assignment changed nothing. Whisper's
generate() reconstructs max_length from config.max_target_positions (448)
internally, which is why the warned value is exactly 448 and why nothing on
this side can unset it. max_new_tokens takes precedence either way.
So filter that one message on the transformers logger instead of implying
the cause was fixed.
- whisper_decoder.py +22 -8
whisper_decoder.py
CHANGED
|
@@ -164,14 +164,28 @@ class Whisper:
|
|
| 164 |
self.model.eval().to(self.device)
|
| 165 |
self.mel_bins: int = self.model.config.num_mel_bins
|
| 166 |
|
| 167 |
-
#
|
| 168 |
-
#
|
| 169 |
-
#
|
| 170 |
-
#
|
| 171 |
-
#
|
| 172 |
-
#
|
| 173 |
-
#
|
| 174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
|
| 176 |
# The checkpoint carries no tokenizer of its own; it is the stock
|
| 177 |
# whisper-medium one. Loading it from a local directory keeps first
|
|
|
|
| 164 |
self.model.eval().to(self.device)
|
| 165 |
self.mel_bins: int = self.model.config.num_mel_bins
|
| 166 |
|
| 167 |
+
# Silence one warning, per process, by message.
|
| 168 |
+
#
|
| 169 |
+
# Every call here passes max_new_tokens, and Whisper's generate()
|
| 170 |
+
# fills max_length in from config.max_target_positions (448) on its
|
| 171 |
+
# way through, so transformers reports them both set -- once per
|
| 172 |
+
# utterance, which over a few thousand buries the running WER.
|
| 173 |
+
#
|
| 174 |
+
# Clearing generation_config.max_length does not stop it: it is
|
| 175 |
+
# already None after load (checked), because the value is
|
| 176 |
+
# reconstructed inside generate() rather than read from the
|
| 177 |
+
# checkpoint. Nothing on this side can unset it, and max_new_tokens
|
| 178 |
+
# takes precedence regardless -- the warning says so itself. So drop
|
| 179 |
+
# the record rather than pretend to fix the cause.
|
| 180 |
+
import logging
|
| 181 |
+
|
| 182 |
+
class _NoMaxLengthClash(logging.Filter):
|
| 183 |
+
def filter(self, record: logging.LogRecord) -> bool:
|
| 184 |
+
return "seem to have been set" not in record.getMessage()
|
| 185 |
+
|
| 186 |
+
logging.getLogger("transformers.generation.utils").addFilter(
|
| 187 |
+
_NoMaxLengthClash()
|
| 188 |
+
)
|
| 189 |
|
| 190 |
# The checkpoint carries no tokenizer of its own; it is the stock
|
| 191 |
# whisper-medium one. Loading it from a local directory keeps first
|