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

Whisper Fine-tuning Recipe on Aishell1 #1466

Merged
merged 34 commits into from
Jan 26, 2024
Merged

Conversation

yuekaizhang
Copy link
Collaborator

This PR supports fine-tuning whisper models using aishell1.

  • Fix code comments & lint errors
test (before fine-tuning) test (after fine-tuning) comment
medium 7.23 3.27 --epoch 10 --avg 4, ddp
large-v2 6.56 2.47 --epoch 10 --avg 6, deepspeed zero stage1
large-v3 6.06 2.84 --epoch 5 --avg 3, deepspeed zero stage1

@yuekaizhang yuekaizhang changed the title Whisper Fine-tuning Recipes on Aishell1 Whisper Fine-tuning Recipe on Aishell1 Jan 17, 2024
@yuekaizhang yuekaizhang changed the title Whisper Fine-tuning Recipe on Aishell1 [WIP] Whisper Fine-tuning Recipe on Aishell1 Jan 17, 2024
@yuekaizhang
Copy link
Collaborator Author

yuekaizhang commented Jan 17, 2024

Nice work!

Would you mind sharing how much GPU memory and how long it takes to fine-tune the Whisper model?

On a 8xA100(80GB) machine, it takes about 15 mins per epoch for large-v2/3 models. Since I am always set the max_duration as large as possible, I think people could fine-tune it on 24GB cards with deepspeed and smaller batch size.

egs/aishell/ASR/whisper/train.py Show resolved Hide resolved
egs/aishell/ASR/whisper/train.py Outdated Show resolved Hide resolved
@yuekaizhang yuekaizhang changed the title [WIP] Whisper Fine-tuning Recipe on Aishell1 Whisper Fine-tuning Recipe on Aishell1 Jan 22, 2024
Copy link
Collaborator

@JinZr JinZr left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

@JinZr JinZr merged commit 1c30847 into k2-fsa:master Jan 26, 2024
54 checks passed
csukuangfj added a commit to csukuangfj/sherpa-onnx that referenced this pull request Jan 30, 2024
csukuangfj added a commit to csukuangfj/sherpa-onnx that referenced this pull request Jan 30, 2024
csukuangfj added a commit to csukuangfj/sherpa-onnx that referenced this pull request Jan 30, 2024
csukuangfj added a commit to csukuangfj/sherpa-onnx that referenced this pull request Jan 30, 2024
csukuangfj added a commit to csukuangfj/sherpa-onnx that referenced this pull request Jan 30, 2024
@csukuangfj
Copy link
Collaborator

    model = whisper.load_model(filename)
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/whisper/__init__.py", line 147, in load_model
    dims = ModelDimensions(**checkpoint["dims"])
KeyError: 'dims'

It throws the above error while using whisper.load_model() with the checkpoint

Could you make your checkpoint compatible with whisper? For instance, you need to save dims in
the resulting checkpoint.

@yuekaizhang

@yuekaizhang
Copy link
Collaborator Author

    model = whisper.load_model(filename)
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/whisper/__init__.py", line 147, in load_model
    dims = ModelDimensions(**checkpoint["dims"])
KeyError: 'dims'

It throws the above error while using whisper.load_model() with the checkpoint

Could you make your checkpoint compatible with whisper? For instance, you need to save dims in the resulting checkpoint.

@yuekaizhang

Sorry, I added this converion script https://huggingface.co/yuekai/icefall_asr_aishell_whisper/blob/main/convert.sh. I have uploaded a converted medium model. Would you mind trying it again? https://huggingface.co/yuekai/icefall_asr_aishell_whisper/blob/main/exp_medium/whisper-medium-aishell1-epoch-10-avg-4.pt

@csukuangfj
Copy link
Collaborator

@yuekaizhang

Thanks! It works perfectly. I have converted it to sherpa-onnx with k2-fsa/sherpa-onnx#565

You can find the converted model at
https://huggingface.co/csukuangfj/sherpa-onnx-whisper-medium-aishell/tree/main

You can also try it in the following huggingface space
https://huggingface.co/spaces/k2-fsa/automatic-speech-recognition-with-whisper

Screenshot 2024-01-31 at 17 19 50

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.

5 participants