Automatic Speech Recognition
Transformers
Safetensors
English
asr_model
asr
speech-recognition
speech-to-text
audio
speech-llm
word-timestamps
speaker-diarization
qwen
granite-speech
lora
custom_code
Eval Results (legacy)
Instructions to use mazesmazes/tiny-audio with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mazesmazes/tiny-audio with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="mazesmazes/tiny-audio", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForSpeechSeq2Seq model = AutoModelForSpeechSeq2Seq.from_pretrained("mazesmazes/tiny-audio", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update custom model files, README, and requirements
Browse files- asr_modeling.py +14 -6
asr_modeling.py
CHANGED
|
@@ -531,12 +531,13 @@ def _assert_projector_loaded(incompatible_keys, projector_type: str) -> None:
|
|
| 531 |
)
|
| 532 |
|
| 533 |
|
| 534 |
-
def _log_linear_attention_backends() -> None:
|
| 535 |
"""Say which fast paths Qwen3.5-style hybrid layers will get on this box.
|
| 536 |
|
| 537 |
Logged rather than enforced: a missing package means the torch reference
|
| 538 |
path (same numerics, slower), and decoders without linear attention never
|
| 539 |
-
touch these functions at all.
|
|
|
|
| 540 |
"""
|
| 541 |
import importlib.util
|
| 542 |
|
|
@@ -546,7 +547,8 @@ def _log_linear_attention_backends() -> None:
|
|
| 546 |
}
|
| 547 |
missing = [pkg for pkg, ok in found.items() if not ok]
|
| 548 |
if missing:
|
| 549 |
-
logger.
|
|
|
|
| 550 |
"Linear-attention fast path incomplete: %s not installed. Qwen3.5-style "
|
| 551 |
"hybrid layers will use the torch reference path for those functions "
|
| 552 |
"(same numerics, slower). `ta runpod deploy` installs both.",
|
|
@@ -672,14 +674,18 @@ class ASRModel(PreTrainedModel, GenerationMixin):
|
|
| 672 |
"skip_logits" in inspect.signature(type(self.language_model).forward).parameters
|
| 673 |
)
|
| 674 |
if not self._lm_accepts_skip_logits:
|
| 675 |
-
# Say so once, loudly
|
|
|
|
|
|
|
|
|
|
| 676 |
# forward builds a (B, T, vocab) tensor plus its fp32 upcast and
|
| 677 |
# its gradient, which on a large-vocab decoder is the difference
|
| 678 |
# between fitting on the card and not -- and the ways to end up
|
| 679 |
# here are all quiet: no liger patcher mapped for this
|
| 680 |
# text_model_id, liger missing (it is linux-only), or a patcher
|
| 681 |
# that patched a different class than the one that got loaded.
|
| 682 |
-
logger.
|
|
|
|
| 683 |
"%s's forward does not accept `skip_logits` — liger's fused "
|
| 684 |
"linear cross-entropy is NOT active, so every training step "
|
| 685 |
"materializes a (batch, seq, %s) logits tensor. Check for an "
|
|
@@ -973,7 +979,9 @@ class ASRModel(PreTrainedModel, GenerationMixin):
|
|
| 973 |
# re-pin could not hold either, because `PreTrainedModel.train()`
|
| 974 |
# re-registers transformers' default mapping on every mode flip.
|
| 975 |
if torch.cuda.is_available():
|
| 976 |
-
_log_linear_attention_backends(
|
|
|
|
|
|
|
| 977 |
|
| 978 |
decoder = AutoModelForCausalLM.from_pretrained(config.text_model_id, **decoder_kwargs)
|
| 979 |
|
|
|
|
| 531 |
)
|
| 532 |
|
| 533 |
|
| 534 |
+
def _log_linear_attention_backends(level: int = logging.WARNING) -> None:
|
| 535 |
"""Say which fast paths Qwen3.5-style hybrid layers will get on this box.
|
| 536 |
|
| 537 |
Logged rather than enforced: a missing package means the torch reference
|
| 538 |
path (same numerics, slower), and decoders without linear attention never
|
| 539 |
+
touch these functions at all. `level` is INFO for an inference load
|
| 540 |
+
(`from_pretrained`), where the slower path is not something to act on.
|
| 541 |
"""
|
| 542 |
import importlib.util
|
| 543 |
|
|
|
|
| 547 |
}
|
| 548 |
missing = [pkg for pkg, ok in found.items() if not ok]
|
| 549 |
if missing:
|
| 550 |
+
logger.log(
|
| 551 |
+
level,
|
| 552 |
"Linear-attention fast path incomplete: %s not installed. Qwen3.5-style "
|
| 553 |
"hybrid layers will use the torch reference path for those functions "
|
| 554 |
"(same numerics, slower). `ta runpod deploy` installs both.",
|
|
|
|
| 674 |
"skip_logits" in inspect.signature(type(self.language_model).forward).parameters
|
| 675 |
)
|
| 676 |
if not self._lm_accepts_skip_logits:
|
| 677 |
+
# Say so once, loudly -- when building a model to train. A
|
| 678 |
+
# `from_pretrained` load is almost always inference, where no
|
| 679 |
+
# loss is computed and this is noise; it stays at INFO there.
|
| 680 |
+
# Without the fused path every labelled
|
| 681 |
# forward builds a (B, T, vocab) tensor plus its fp32 upcast and
|
| 682 |
# its gradient, which on a large-vocab decoder is the difference
|
| 683 |
# between fitting on the card and not -- and the ways to end up
|
| 684 |
# here are all quiet: no liger patcher mapped for this
|
| 685 |
# text_model_id, liger missing (it is linux-only), or a patcher
|
| 686 |
# that patched a different class than the one that got loaded.
|
| 687 |
+
logger.log(
|
| 688 |
+
logging.INFO if type(self)._is_loading_from_pretrained else logging.WARNING,
|
| 689 |
"%s's forward does not accept `skip_logits` — liger's fused "
|
| 690 |
"linear cross-entropy is NOT active, so every training step "
|
| 691 |
"materializes a (batch, seq, %s) logits tensor. Check for an "
|
|
|
|
| 979 |
# re-pin could not hold either, because `PreTrainedModel.train()`
|
| 980 |
# re-registers transformers' default mapping on every mode flip.
|
| 981 |
if torch.cuda.is_available():
|
| 982 |
+
_log_linear_attention_backends(
|
| 983 |
+
logging.INFO if cls._is_loading_from_pretrained else logging.WARNING
|
| 984 |
+
)
|
| 985 |
|
| 986 |
decoder = AutoModelForCausalLM.from_pretrained(config.text_model_id, **decoder_kwargs)
|
| 987 |
|