Thanks to visit codestin.com
Credit goes to GitHub.com

Skip to content

Conversation

@Adel-Moumen
Copy link
Collaborator

@Adel-Moumen Adel-Moumen commented Apr 11, 2025

What does this PR do?

This PR adds support of SpeechLLM for ASR with LibriSpeech. Feats extractions, Training, Greedy search, and inference scripts are provided.

Before submitting
  • Did you read the contributor guideline?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Does your code adhere to project-specific code style and conventions?

PR review

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified
  • Confirm that the changes adhere to compatibility requirements (e.g., Python version, platform)
  • Review the self-review checklist to ensure the code is ready for review

@TParcollet TParcollet added this to the v1.1.0 milestone Oct 9, 2025
Comment on lines +78 to +83
# Capture config-only overrides to avoid passing them to from_pretrained
self._config_overrides = {}
if "output_hidden_states" in kwargs:
self._config_overrides["output_hidden_states"] = kwargs.pop(
"output_hidden_states"
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I don't remember in what scenario you want to set output_hidden_states=True

Comment on lines +422 to +427
tokens_bos = torch.LongTensor(
[start_of_audio_index]
+ [end_of_audio_index]
+ prompt_ids
+ [bos_index]
+ tokens_list
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one thing: it's really hard to know if an LM requires bos / eos (e.g. https://huggingface.co/blog/qgallouedec/gotchas-in-tokenizer-behavior) ; so, I think, ideally, we need to have a proper prompt function that will create a prompt depending on the input tokens (e.g. is eos is None, then don't append etc).

Copy link
Collaborator

@pplantinga pplantinga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks like a good addition -- it will be nice to have a starting framework for doing SpeechLLMs in SpeechBrain!

From my first read, I guess I'm wondering if we want to try to support more than one task, even a simple second task such as keyword spotting, just to show how it can be done, as it seems like the main benefit of SpeechLLMs over traditional ASR is the fact that they can support multiple tasks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a second yaml file for this? I'm legitimately curious -- its fine if the answer is yes!

Comment on lines +69 to +70
additional_special_tokens: List[str] = None,
pad_to_multiple_of: int = 8,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new parameters are not documented.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit of adding this over torch.nn.GELU? It doesn't seem to behave any differently

bos_index: !PLACEHOLDER # 0
eos_index: !PLACEHOLDER # 0
pad_token: !PLACEHOLDER # 128256
prompt: "Transcribe speech to text."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This recipe doesn't support tasks other than transcription? Couldn't we at least do keyword spotting? "Is the word {word} present in the audio?" For SpeechLLMs my understanding is that we ultimately want multi-task machines, so it would be nice if we at least had a basic concept of how multi-task would be handled.


| Release | Model | hyperparams file | Dev Clean WER | Test Clean WER | Test Other WER | HuggingFace link | Model link | GPUs |
|:-------------:|:-------------:|:-------------:|:---------------------------:| :-----:| :-----:| :-----:| :--------:|
| 29-11-25 | WavLM Large + SmolLM2 1.7B + LoRA | speechllm_ssl_feats.yaml | N/A | 3.17 | 6.83 | [HuggingFace](https://huggingface.co/speechbrain/asr-speechllm-librispeech) | - | 1xH100 40GB |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not really good numbers given the architecture imho, but ok.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had much better results (2.X%), but I need to train the models a bit longer.

#!/usr/bin/env python3
"""Script to extract SSL features from the audio waveforms.

The script uses the `speechbrain.integrations.hdf5.cached_item` module to cache the features.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tutorial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants