pytorch / android-demo-app

PyTorch android examples of usage in applications
1.46k stars 604 forks source link

How to add language model in ASR demo #209

Open guijuzhejiang opened 2 years ago

guijuzhejiang commented 2 years ago

The wav2vec2 used in the SpeechRecognition example does not have a language model. How to add language model in the demo app?

mictiong85 commented 2 years ago

not sure if this answer your question,

I create a new model by using "create_wav2vec2.py" by changing https://github.com/pytorch/android-demo-app/blob/master/SpeechRecognition/create_wav2vec2.py

model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")

to

other model, for example ,my own model that i retrieved from huggingface model1 = Wav2Vec2ForCTC.from_pretrained("mictiong85/wav2vec2-base-timit-demo-colab")

Nevertheless, I am facing other error