This model is a Phoneme Level Speech Recognition network, originally a fine-tuned version of
openai/whisper-large-v3
on a
mixture of Different Japanese datasets.
it can detect, transcribe and do the following:
non-speech sounds such as gasp, erotic moans, laughter, etc.
adding punctuations more faithfully.
a Grapheme level language modelling head (i.e outputting normal Japanese) will probably be trained as well. Though going directly from audio to Phonemes will result in a
more accurate representation for Japnese.
evaluation set:
Loss: 0.2186
Wer: 21.6707
Inference and Post-proc
# this function was borrowed and modified from Aaron Yinghao Li, the Author of StyleTTS paper.from datasets import Dataset, Audio
from transformers import WhisperProcessor, WhisperForConditionalGeneration
import jaconv
kana_mapper = dict([
("ゔぁ","ba"),
.
.
.
etc. # Take a look at the Notebook for the whole code
("ぉ"," o"),
("ゎ"," ɯa"),
("ぉ"," o"),
("を","o")
])
defpost_fix(text):
orig = text
for k, v in kana_mapper.items():
text = text.replace(k, v)
return text
processor = WhisperProcessor.from_pretrained("openai/whisper-large-v3")
model = WhisperForConditionalGeneration.from_pretrained("Respair/Hibiki_ASR_Phonemizer").to("cuda:0")
forced_decoder_ids = processor.get_decoder_prompt_ids(task="transcribe", language='japanese')
import re
sample = Dataset.from_dict({"audio": ["/content/kl_chunk1987.wav"]}).cast_column("audio", Audio(16000))
sample = sample[0]['audio']
# Ensure the input features are on the same device as the model
input_features = processor(sample["array"], sampling_rate=sample["sampling_rate"], return_tensors="pt").input_features.to("cuda:0")
# generate token ids
predicted_ids = model.generate(input_features,forced_decoder_ids=forced_decoder_ids, repetition_penalty=1.2)
# decode token ids to text
transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
# You can add your final adjustments here, it's better to write a dict though, but I'm just giving you a quick demonstration here.if' neɽitai 'in transcription[0]:
transcription[0] = transcription[0].replace(' neɽitai ', "naɽitai")
if'harɯdʑisama'in transcription[0]:
transcription[0] = transcription[0].replace('harɯdʑisama', "arɯdʑisama")
if"ki ni ɕinai"in transcription[0]:
transcription[0] = re.sub(r'(?<!\s)ki ni ɕinai', r' ki ni ɕinai', transcription[0])
if'ʔt'in transcription[0]:
transcription[0] = re.sub(r'(?<!\s)ʔt', r'ʔt', transcription[0])
if'de aɽoɯ'in transcription[0]:
transcription[0] = re.sub(r'(?<!\s)de aɽoɯ', r' de aɽoɯ', transcription[0])
post_fix(jaconv.kata2hira(transcription[0].lstrip())) # Ensuring the model won't hallucinate and return kana
Whisper_JP huggingface.co is an AI model on huggingface.co that provides Whisper_JP's model effect (), which can be used instantly with this Respair Whisper_JP model. huggingface.co supports a free trial of the Whisper_JP model, and also provides paid use of the Whisper_JP. Support call Whisper_JP model through api, including Node.js, Python, http.
Whisper_JP huggingface.co is an online trial and call api platform, which integrates Whisper_JP's modeling effects, including api services, and provides a free online trial of Whisper_JP, you can try Whisper_JP online for free by clicking the link below.
Respair Whisper_JP online free url in huggingface.co:
Whisper_JP is an open source model from GitHub that offers a free installation service, and any user can find Whisper_JP on GitHub to install. At the same time, huggingface.co provides the effect of Whisper_JP install, users can directly use Whisper_JP installed effect in huggingface.co for debugging and trial. It also supports api for free installation.