Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add experimental MPS device support for ASR inference #6289

Merged
merged 1 commit into from
Mar 24, 2023

Conversation

artbataev
Copy link
Collaborator

@artbataev artbataev commented Mar 24, 2023

What does this PR do ?

Add support for MPS device (Apple Silicon M-series GPU) for ASR inference

Collection: [ASR]

Changelog

  • allow to select MPS device in transcribe_speech.py

Usage

MPS device will be automatically selected in transcribe_speech.py or speech_to_text_eval.py if allow_mps=true flag is explicitly set, and MPS device is available.
Will work only with PyTorch >= 2.0, for now env variable PYTORCH_ENABLE_MPS_FALLBACK=1 should be set.

Tested with models:

PYTORCH_ENABLE_MPS_FALLBACK=1 python examples/asr/transcribe_speech.py \
    allow_mps=true \
    <other script params>

PYTORCH_ENABLE_MPS_FALLBACK=1 python examples/asr/speech_to_text_eval.py \
    allow_mps=true \
    <other script params>

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

@github-actions github-actions bot added the ASR label Mar 24, 2023
@artbataev artbataev requested a review from titu1994 March 24, 2023 18:25
Copy link
Collaborator

@titu1994 titu1994 left a comment

Choose a reason for hiding this comment

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

I'm surprised ASR works on MPS ! Cool finding. Any idea if its just CTC models or if even RNNT will work ?

@artbataev
Copy link
Collaborator Author

I'm surprised ASR works on MPS ! Cool finding. Any idea if its just CTC models or if even RNNT will work ?

In inference mode Conformer-L CTC and RNNT models work fine with PyTorch 2.0 (no quality degradation, significant speedup on MPS).

Training/finetuning fails, since no implementation for CTC/RNNT for now (CPU will be extremely slow). CTC is not yet planned in PyTorch: pytorch/pytorch#77764

@artbataev artbataev merged commit 10e34f9 into NVIDIA:main Mar 24, 2023
@artbataev artbataev deleted the support_asr_inference_mps branch March 24, 2023 20:01
@titu1994
Copy link
Collaborator

Well training is not important for such huge models on MPS - the slowdown from moving from cuda to MPS is pretty huge even for inference

hsiehjackson pushed a commit to hsiehjackson/NeMo that referenced this pull request Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants