Skip to content

SpeechLLM LibriSpeech recipe#2885

Merged
Adel-Moumen merged 89 commits intodevelopfrom
speechllm_librispeech
Feb 7, 2026
Merged

SpeechLLM LibriSpeech recipe#2885
Adel-Moumen merged 89 commits intodevelopfrom
speechllm_librispeech

Conversation

@Adel-Moumen
Copy link
Copy Markdown
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
@Adel-Moumen
Copy link
Copy Markdown
Collaborator Author

Hi guys @pplantinga @TParcollet @mravanelli , I think the PR is now ready. I went through the comments, and added a tutorial for the caching feature. Also, I improved the ASR SpeechLLM baseline and now gets more competitive results (2.72% on LS test-clean and 5.34% on test-other).

I also created the model card and will upload the required files so that we can display this example for the community. This is based on Llama 3.2 1B with LORA adapters and WavLM-Large.

Happy to consider other remarks/requests.

:)

Copy link
Copy Markdown
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.

Looks like its getting close, thanks Adel! Just a few small comments before merge.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I get that sometimes a class may be needed and sometimes a function, but torch has both a class torch.nn.GELU and a function torch.nn.functional.gelu so this shouldn't be needed here right?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If you need the default argument changed you can always use "name" to change it, e.g.

activation: !name:torch.nn.GELU {approximate: tanh}

Which returns a constructor that will use tanh by default.

Comment on lines +460 to +465
self.raw_modules = (
self.modules.module
if hasattr(self.modules, "module")
else self.modules
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure about this... is this handling the extra layer from DDP? I'm wondering if this should just be handled by the recipe or if we do need a more general solution whether we need something more robust here somehow, like a function you can call to get the modules appropriately.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The point is to exactly remove the DDP extra layering (similar to here: https://github.com/karpathy/nanoGPT/blob/3adf61e154c3fe3fca428ad6bc3818b27a3b8291/train.py#L253). That way, we can systematically access to methods e.g. get_input_embedding which wouldn't be accessible easily (e.g. here: self.raw_modules.get_input_embedding) while before we would have to do something like x = self.modules.module.get_input_embedding if 'module' in self.modules else ... so you would still need to unwrap the DDP container to get target module for calling the function. Here, we just have a pointer that does that instead of doing it manually. I have seen some recipes that had to do a ugly 'if' and I think this would solve the problem.

having a function that unwrap would work but I think this is simpler and more modular. Happy to consider something else if you think this is not the way to go.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Well, I'm happy to go with this for now if needed, but maybe the longer term solution is to actually store the DDP module in a separate container. I mean for this part (simplified):

for name, module in self.modules.items():
    if any(p.requires_grad for p in module.parameters()):
        module = SyncBatchNorm.convert_sync_batchnorm(module)
        ddp_module = DDP( 
            module,
            device_ids=[self.device],
            find_unused_parameters=self.find_unused_parameters,
        )
        self.modules[name] = ddp_module

change the last line to self.ddp_modules[name] = ddp_module so we don't overwrite the old one.

@Adel-Moumen
Copy link
Copy Markdown
Collaborator Author

Looks like its getting close, thanks Adel! Just a few small comments before merge.

I think I addressed all the comments! Fixed the notebook and HDF5 (we were never passing the compression arg to the constructor) + removed the activations + added back authors.

Copy link
Copy Markdown
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.

LGTM!

@Adel-Moumen Adel-Moumen merged commit 39ef358 into develop Feb 7, 2026
5 checks passed
@Adel-Moumen Adel-Moumen deleted the speechllm_librispeech branch February 7, 2026 15:08
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