Add fine-tuned whisper model on aishell (#565)
See also https://github.com/k2-fsa/icefall/pull/1466
This commit is contained in:
@@ -44,7 +44,9 @@ def get_args():
|
||||
"tiny", "tiny.en", "base", "base.en",
|
||||
"small", "small.en", "medium", "medium.en",
|
||||
"large", "large-v1", "large-v2",
|
||||
"distil-medium.en", "distil-small.en", "distil-large-v2"
|
||||
"distil-medium.en", "distil-small.en", "distil-large-v2",
|
||||
# for fine-tuned models from icefall
|
||||
"medium-aishell",
|
||||
],
|
||||
# fmt: on
|
||||
)
|
||||
@@ -340,6 +342,19 @@ def main():
|
||||
"""
|
||||
)
|
||||
model = whisper.load_model(filename)
|
||||
elif name == "medium-aishell":
|
||||
filename = "./medium-aishell.pt"
|
||||
if not Path(filename).is_file():
|
||||
raise ValueError(
|
||||
"""
|
||||
Please go to https://huggingface.co/yuekai/icefall_asr_aishell_whisper/tree/main/exp_medium
|
||||
to download whisper-medium-aishell1-epoch-10-avg-4.pt
|
||||
You can use the following command to do that:
|
||||
|
||||
wget -O medium-aishell.pt https://huggingface.co/yuekai/icefall_asr_aishell_whisper/resolve/main/exp_medium/whisper-medium-aishell1-epoch-10-avg-4.pt
|
||||
"""
|
||||
)
|
||||
model = whisper.load_model(filename)
|
||||
else:
|
||||
model = whisper.load_model(name)
|
||||
print(model.dims)
|
||||
|
||||
@@ -257,9 +257,9 @@ def compute_features(filename: str) -> torch.Tensor:
|
||||
mel = (log_spec + 4.0) / 4.0
|
||||
# mel (T, 80)
|
||||
|
||||
# We pad 50 frames at the end so that it is able to detect eot
|
||||
# You can use another value instead of 50.
|
||||
mel = torch.nn.functional.pad(mel, (0, 0, 0, 1000), "constant", 0)
|
||||
# We pad 1500 frames at the end so that it is able to detect eot
|
||||
# You can use another value instead of 1500.
|
||||
mel = torch.nn.functional.pad(mel, (0, 0, 0, 1500), "constant", 0)
|
||||
# Note that if it throws for a multilingual model,
|
||||
# please use a larger value, say 300
|
||||
|
||||
|
||||
Reference in New Issue
Block a user