初始化项目,由ModelHub XC社区提供模型
Model: jonatasgrosman/wav2vec2-large-xlsr-53-polish Source: Original Platform
This commit is contained in:
21
.gitattributes
vendored
Normal file
21
.gitattributes
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
flax_model.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
pytorch_model.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
language_model/lm.binary filter=lfs diff=lfs merge=lfs -text
|
||||||
|
language_model/unigrams.txt filter=lfs diff=lfs merge=lfs -text
|
||||||
165
README.md
Normal file
165
README.md
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
---
|
||||||
|
language: pl
|
||||||
|
license: apache-2.0
|
||||||
|
datasets:
|
||||||
|
- common_voice
|
||||||
|
- mozilla-foundation/common_voice_6_0
|
||||||
|
metrics:
|
||||||
|
- wer
|
||||||
|
- cer
|
||||||
|
tags:
|
||||||
|
- audio
|
||||||
|
- automatic-speech-recognition
|
||||||
|
- hf-asr-leaderboard
|
||||||
|
- mozilla-foundation/common_voice_6_0
|
||||||
|
- pl
|
||||||
|
- robust-speech-event
|
||||||
|
- speech
|
||||||
|
- xlsr-fine-tuning-week
|
||||||
|
model-index:
|
||||||
|
- name: XLSR Wav2Vec2 Polish by Jonatas Grosman
|
||||||
|
results:
|
||||||
|
- task:
|
||||||
|
name: Automatic Speech Recognition
|
||||||
|
type: automatic-speech-recognition
|
||||||
|
dataset:
|
||||||
|
name: Common Voice pl
|
||||||
|
type: common_voice
|
||||||
|
args: pl
|
||||||
|
metrics:
|
||||||
|
- name: Test WER
|
||||||
|
type: wer
|
||||||
|
value: 14.21
|
||||||
|
- name: Test CER
|
||||||
|
type: cer
|
||||||
|
value: 3.49
|
||||||
|
- name: Test WER (+LM)
|
||||||
|
type: wer
|
||||||
|
value: 10.98
|
||||||
|
- name: Test CER (+LM)
|
||||||
|
type: cer
|
||||||
|
value: 2.93
|
||||||
|
- task:
|
||||||
|
name: Automatic Speech Recognition
|
||||||
|
type: automatic-speech-recognition
|
||||||
|
dataset:
|
||||||
|
name: Robust Speech Event - Dev Data
|
||||||
|
type: speech-recognition-community-v2/dev_data
|
||||||
|
args: pl
|
||||||
|
metrics:
|
||||||
|
- name: Dev WER
|
||||||
|
type: wer
|
||||||
|
value: 33.18
|
||||||
|
- name: Dev CER
|
||||||
|
type: cer
|
||||||
|
value: 15.92
|
||||||
|
- name: Dev WER (+LM)
|
||||||
|
type: wer
|
||||||
|
value: 29.31
|
||||||
|
- name: Dev CER (+LM)
|
||||||
|
type: cer
|
||||||
|
value: 15.17
|
||||||
|
---
|
||||||
|
|
||||||
|
# Fine-tuned XLSR-53 large model for speech recognition in Polish
|
||||||
|
|
||||||
|
Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) on Polish using the train and validation splits of [Common Voice 6.1](https://huggingface.co/datasets/common_voice).
|
||||||
|
When using this model, make sure that your speech input is sampled at 16kHz.
|
||||||
|
|
||||||
|
This model has been fine-tuned thanks to the GPU credits generously given by the [OVHcloud](https://www.ovhcloud.com/en/public-cloud/ai-training/) :)
|
||||||
|
|
||||||
|
The script used for training can be found here: https://github.com/jonatasgrosman/wav2vec2-sprint
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The model can be used directly (without a language model) as follows...
|
||||||
|
|
||||||
|
Using the [HuggingSound](https://github.com/jonatasgrosman/huggingsound) library:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from huggingsound import SpeechRecognitionModel
|
||||||
|
|
||||||
|
model = SpeechRecognitionModel("jonatasgrosman/wav2vec2-large-xlsr-53-polish")
|
||||||
|
audio_paths = ["/path/to/file.mp3", "/path/to/another_file.wav"]
|
||||||
|
|
||||||
|
transcriptions = model.transcribe(audio_paths)
|
||||||
|
```
|
||||||
|
|
||||||
|
Writing your own inference script:
|
||||||
|
|
||||||
|
```python
|
||||||
|
import torch
|
||||||
|
import librosa
|
||||||
|
from datasets import load_dataset
|
||||||
|
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
||||||
|
|
||||||
|
LANG_ID = "pl"
|
||||||
|
MODEL_ID = "jonatasgrosman/wav2vec2-large-xlsr-53-polish"
|
||||||
|
SAMPLES = 5
|
||||||
|
|
||||||
|
test_dataset = load_dataset("common_voice", LANG_ID, split=f"test[:{SAMPLES}]")
|
||||||
|
|
||||||
|
processor = Wav2Vec2Processor.from_pretrained(MODEL_ID)
|
||||||
|
model = Wav2Vec2ForCTC.from_pretrained(MODEL_ID)
|
||||||
|
|
||||||
|
# Preprocessing the datasets.
|
||||||
|
# We need to read the audio files as arrays
|
||||||
|
def speech_file_to_array_fn(batch):
|
||||||
|
speech_array, sampling_rate = librosa.load(batch["path"], sr=16_000)
|
||||||
|
batch["speech"] = speech_array
|
||||||
|
batch["sentence"] = batch["sentence"].upper()
|
||||||
|
return batch
|
||||||
|
|
||||||
|
test_dataset = test_dataset.map(speech_file_to_array_fn)
|
||||||
|
inputs = processor(test_dataset["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
|
||||||
|
|
||||||
|
with torch.no_grad():
|
||||||
|
logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits
|
||||||
|
|
||||||
|
predicted_ids = torch.argmax(logits, dim=-1)
|
||||||
|
predicted_sentences = processor.batch_decode(predicted_ids)
|
||||||
|
|
||||||
|
for i, predicted_sentence in enumerate(predicted_sentences):
|
||||||
|
print("-" * 100)
|
||||||
|
print("Reference:", test_dataset[i]["sentence"])
|
||||||
|
print("Prediction:", predicted_sentence)
|
||||||
|
```
|
||||||
|
|
||||||
|
| Reference | Prediction |
|
||||||
|
| ------------- | ------------- |
|
||||||
|
| """CZY DRZWI BYŁY ZAMKNIĘTE?""" | PRZY DRZWI BYŁY ZAMKNIĘTE |
|
||||||
|
| GDZIEŻ TU POWÓD DO WYRZUTÓW? | WGDZIEŻ TO POM DO WYRYDÓ |
|
||||||
|
| """O TEM JEDNAK NIE BYŁO MOWY.""" | O TEM JEDNAK NIE BYŁO MOWY |
|
||||||
|
| LUBIĘ GO. | LUBIĄ GO |
|
||||||
|
| — TO MI NIE POMAGA. | TO MNIE NIE POMAGA |
|
||||||
|
| WCIĄŻ LUDZIE WYSIADAJĄ PRZED ZAMKIEM, Z MIASTA, Z PRAGI. | WCIĄŻ LUDZIE WYSIADAJĄ PRZED ZAMKIEM Z MIASTA Z PRAGI |
|
||||||
|
| ALE ON WCALE INACZEJ NIE MYŚLAŁ. | ONY MONITCENIE PONACZUŁA NA MASU |
|
||||||
|
| A WY, CO TAK STOICIE? | A WY CO TAK STOICIE |
|
||||||
|
| A TEN PRZYRZĄD DO CZEGO SŁUŻY? | A TEN PRZYRZĄD DO CZEGO SŁUŻY |
|
||||||
|
| NA JUTRZEJSZYM KOLOKWIUM BĘDZIE PIĘĆ PYTAŃ OTWARTYCH I TEST WIELOKROTNEGO WYBORU. | NAJUTRZEJSZYM KOLOKWIUM BĘDZIE PIĘĆ PYTAŃ OTWARTYCH I TEST WIELOKROTNEGO WYBORU |
|
||||||
|
|
||||||
|
## Evaluation
|
||||||
|
|
||||||
|
1. To evaluate on `mozilla-foundation/common_voice_6_0` with split `test`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python eval.py --model_id jonatasgrosman/wav2vec2-large-xlsr-53-polish --dataset mozilla-foundation/common_voice_6_0 --config pl --split test
|
||||||
|
```
|
||||||
|
|
||||||
|
2. To evaluate on `speech-recognition-community-v2/dev_data`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python eval.py --model_id jonatasgrosman/wav2vec2-large-xlsr-53-polish --dataset speech-recognition-community-v2/dev_data --config pl --split validation --chunk_length_s 5.0 --stride_length_s 1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Citation
|
||||||
|
If you want to cite this model you can use this:
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{grosman2021xlsr53-large-polish,
|
||||||
|
title={Fine-tuned {XLSR}-53 large model for speech recognition in {P}olish},
|
||||||
|
author={Grosman, Jonatas},
|
||||||
|
howpublished={\url{https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-polish}},
|
||||||
|
year={2021}
|
||||||
|
}
|
||||||
|
```
|
||||||
1
alphabet.json
Normal file
1
alphabet.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"labels": ["", "<s>", "</s>", "⁇", " ", "-", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "r", "s", "t", "u", "v", "w", "x", "y", "z", "ó", "ą", "ć", "ę", "ł", "ń", "ś", "ź", "ż"], "is_bpe": false}
|
||||||
83
config.json
Normal file
83
config.json
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
{
|
||||||
|
"_name_or_path": "facebook/wav2vec2-large-xlsr-53",
|
||||||
|
"activation_dropout": 0.05,
|
||||||
|
"apply_spec_augment": true,
|
||||||
|
"architectures": [
|
||||||
|
"Wav2Vec2ForCTC"
|
||||||
|
],
|
||||||
|
"attention_dropout": 0.1,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"codevector_dim": 768,
|
||||||
|
"contrastive_logits_temperature": 0.1,
|
||||||
|
"conv_bias": true,
|
||||||
|
"conv_dim": [
|
||||||
|
512,
|
||||||
|
512,
|
||||||
|
512,
|
||||||
|
512,
|
||||||
|
512,
|
||||||
|
512,
|
||||||
|
512
|
||||||
|
],
|
||||||
|
"conv_kernel": [
|
||||||
|
10,
|
||||||
|
3,
|
||||||
|
3,
|
||||||
|
3,
|
||||||
|
3,
|
||||||
|
2,
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"conv_stride": [
|
||||||
|
5,
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"ctc_loss_reduction": "mean",
|
||||||
|
"ctc_zero_infinity": true,
|
||||||
|
"diversity_loss_weight": 0.1,
|
||||||
|
"do_stable_layer_norm": true,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"feat_extract_activation": "gelu",
|
||||||
|
"feat_extract_dropout": 0.0,
|
||||||
|
"feat_extract_norm": "layer",
|
||||||
|
"feat_proj_dropout": 0.05,
|
||||||
|
"feat_quantizer_dropout": 0.0,
|
||||||
|
"final_dropout": 0.0,
|
||||||
|
"hidden_act": "gelu",
|
||||||
|
"hidden_dropout": 0.05,
|
||||||
|
"hidden_size": 1024,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 4096,
|
||||||
|
"layer_norm_eps": 1e-05,
|
||||||
|
"layerdrop": 0.05,
|
||||||
|
"mask_channel_length": 10,
|
||||||
|
"mask_channel_min_space": 1,
|
||||||
|
"mask_channel_other": 0.0,
|
||||||
|
"mask_channel_prob": 0.0,
|
||||||
|
"mask_channel_selection": "static",
|
||||||
|
"mask_feature_length": 10,
|
||||||
|
"mask_feature_prob": 0.0,
|
||||||
|
"mask_time_length": 10,
|
||||||
|
"mask_time_min_space": 1,
|
||||||
|
"mask_time_other": 0.0,
|
||||||
|
"mask_time_prob": 0.05,
|
||||||
|
"mask_time_selection": "static",
|
||||||
|
"model_type": "wav2vec2",
|
||||||
|
"num_attention_heads": 16,
|
||||||
|
"num_codevector_groups": 2,
|
||||||
|
"num_codevectors_per_group": 320,
|
||||||
|
"num_conv_pos_embedding_groups": 16,
|
||||||
|
"num_conv_pos_embeddings": 128,
|
||||||
|
"num_feat_extract_layers": 7,
|
||||||
|
"num_hidden_layers": 24,
|
||||||
|
"num_negatives": 100,
|
||||||
|
"pad_token_id": 0,
|
||||||
|
"proj_codevector_dim": 768,
|
||||||
|
"transformers_version": "4.7.0.dev0",
|
||||||
|
"vocab_size": 40
|
||||||
|
}
|
||||||
1
configuration.json
Normal file
1
configuration.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"framework": "pytorch", "task": "automatic-speech-recognition", "allow_remote": true}
|
||||||
164
eval.py
Normal file
164
eval.py
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from datasets import load_dataset, load_metric, Audio, Dataset
|
||||||
|
from transformers import pipeline, AutoFeatureExtractor, AutoTokenizer, AutoConfig, AutoModelForCTC, Wav2Vec2Processor, Wav2Vec2ProcessorWithLM
|
||||||
|
import re
|
||||||
|
import torch
|
||||||
|
import argparse
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
|
def log_results(result: Dataset, args: Dict[str, str]):
|
||||||
|
""" DO NOT CHANGE. This function computes and logs the result metrics. """
|
||||||
|
|
||||||
|
log_outputs = args.log_outputs
|
||||||
|
dataset_id = "_".join(args.dataset.split("/") + [args.config, args.split])
|
||||||
|
|
||||||
|
# load metric
|
||||||
|
wer = load_metric("wer")
|
||||||
|
cer = load_metric("cer")
|
||||||
|
|
||||||
|
# compute metrics
|
||||||
|
wer_result = wer.compute(references=result["target"], predictions=result["prediction"])
|
||||||
|
cer_result = cer.compute(references=result["target"], predictions=result["prediction"])
|
||||||
|
|
||||||
|
# print & log results
|
||||||
|
result_str = (
|
||||||
|
f"WER: {wer_result}\n"
|
||||||
|
f"CER: {cer_result}"
|
||||||
|
)
|
||||||
|
print(result_str)
|
||||||
|
|
||||||
|
with open(f"{dataset_id}_eval_results.txt", "w") as f:
|
||||||
|
f.write(result_str)
|
||||||
|
|
||||||
|
# log all results in text file. Possibly interesting for analysis
|
||||||
|
if log_outputs is not None:
|
||||||
|
pred_file = f"log_{dataset_id}_predictions.txt"
|
||||||
|
target_file = f"log_{dataset_id}_targets.txt"
|
||||||
|
|
||||||
|
with open(pred_file, "w") as p, open(target_file, "w") as t:
|
||||||
|
|
||||||
|
# mapping function to write output
|
||||||
|
def write_to_file(batch, i):
|
||||||
|
p.write(f"{i}" + "\n")
|
||||||
|
p.write(batch["prediction"] + "\n")
|
||||||
|
t.write(f"{i}" + "\n")
|
||||||
|
t.write(batch["target"] + "\n")
|
||||||
|
|
||||||
|
result.map(write_to_file, with_indices=True)
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_text(text: str, invalid_chars_regex: str, to_lower: bool) -> str:
|
||||||
|
""" DO ADAPT FOR YOUR USE CASE. this function normalizes the target text. """
|
||||||
|
|
||||||
|
text = text.lower() if to_lower else text.upper()
|
||||||
|
|
||||||
|
text = re.sub(invalid_chars_regex, " ", text)
|
||||||
|
|
||||||
|
text = re.sub("\s+", " ", text).strip()
|
||||||
|
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
def main(args):
|
||||||
|
# load dataset
|
||||||
|
dataset = load_dataset(args.dataset, args.config, split=args.split, use_auth_token=True)
|
||||||
|
|
||||||
|
# for testing: only process the first two examples as a test
|
||||||
|
# dataset = dataset.select(range(10))
|
||||||
|
|
||||||
|
# load processor
|
||||||
|
if args.greedy:
|
||||||
|
processor = Wav2Vec2Processor.from_pretrained(args.model_id)
|
||||||
|
decoder = None
|
||||||
|
else:
|
||||||
|
processor = Wav2Vec2ProcessorWithLM.from_pretrained(args.model_id)
|
||||||
|
decoder = processor.decoder
|
||||||
|
|
||||||
|
feature_extractor = processor.feature_extractor
|
||||||
|
tokenizer = processor.tokenizer
|
||||||
|
|
||||||
|
# resample audio
|
||||||
|
dataset = dataset.cast_column("audio", Audio(sampling_rate=feature_extractor.sampling_rate))
|
||||||
|
|
||||||
|
# load eval pipeline
|
||||||
|
if args.device is None:
|
||||||
|
args.device = 0 if torch.cuda.is_available() else -1
|
||||||
|
|
||||||
|
config = AutoConfig.from_pretrained(args.model_id)
|
||||||
|
model = AutoModelForCTC.from_pretrained(args.model_id)
|
||||||
|
|
||||||
|
#asr = pipeline("automatic-speech-recognition", model=args.model_id, device=args.device)
|
||||||
|
asr = pipeline("automatic-speech-recognition", config=config, model=model, tokenizer=tokenizer,
|
||||||
|
feature_extractor=feature_extractor, decoder=decoder, device=args.device)
|
||||||
|
|
||||||
|
# build normalizer config
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(args.model_id)
|
||||||
|
tokens = [x for x in tokenizer.convert_ids_to_tokens(range(0, tokenizer.vocab_size))]
|
||||||
|
special_tokens = [
|
||||||
|
tokenizer.pad_token, tokenizer.word_delimiter_token,
|
||||||
|
tokenizer.unk_token, tokenizer.bos_token,
|
||||||
|
tokenizer.eos_token,
|
||||||
|
]
|
||||||
|
non_special_tokens = [x for x in tokens if x not in special_tokens]
|
||||||
|
invalid_chars_regex = f"[^\s{re.escape(''.join(set(non_special_tokens)))}]"
|
||||||
|
normalize_to_lower = False
|
||||||
|
for token in non_special_tokens:
|
||||||
|
if token.isalpha() and token.islower():
|
||||||
|
normalize_to_lower = True
|
||||||
|
break
|
||||||
|
|
||||||
|
# map function to decode audio
|
||||||
|
def map_to_pred(batch, args=args, asr=asr, invalid_chars_regex=invalid_chars_regex, normalize_to_lower=normalize_to_lower):
|
||||||
|
prediction = asr(batch["audio"]["array"], chunk_length_s=args.chunk_length_s, stride_length_s=args.stride_length_s)
|
||||||
|
|
||||||
|
batch["prediction"] = prediction["text"]
|
||||||
|
batch["target"] = normalize_text(batch["sentence"], invalid_chars_regex, normalize_to_lower)
|
||||||
|
return batch
|
||||||
|
|
||||||
|
# run inference on all examples
|
||||||
|
result = dataset.map(map_to_pred, remove_columns=dataset.column_names)
|
||||||
|
|
||||||
|
# filtering out empty targets
|
||||||
|
result = result.filter(lambda example: example["target"] != "")
|
||||||
|
|
||||||
|
# compute and log_results
|
||||||
|
# do not change function below
|
||||||
|
log_results(result, args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--model_id", type=str, required=True, help="Model identifier. Should be loadable with 🤗 Transformers"
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--dataset", type=str, required=True, help="Dataset name to evaluate the `model_id`. Should be loadable with 🤗 Datasets"
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--config", type=str, required=True, help="Config of the dataset. *E.g.* `'en'` for Common Voice"
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--split", type=str, required=True, help="Split of the dataset. *E.g.* `'test'`"
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--chunk_length_s", type=float, default=None, help="Chunk length in seconds. Defaults to None. For long audio files a good value would be 5.0 seconds."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--stride_length_s", type=float, default=None, help="Stride of the audio chunks. Defaults to None. For long audio files a good value would be 1.0 seconds."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--log_outputs", action='store_true', help="If defined, write outputs to log file for analysis."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--greedy", action='store_true', help="If defined, the LM will be ignored during inference."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--device",
|
||||||
|
type=int,
|
||||||
|
default=None,
|
||||||
|
help="The device to run the pipeline on. -1 for CPU (default), 0 for the first GPU and so on.",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
main(args)
|
||||||
3
flax_model.msgpack
Normal file
3
flax_model.msgpack
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:08be9595fb38cbe835b5ea7e923a632e03bd2d915749b6e92902d51eb48928d8
|
||||||
|
size 1261934272
|
||||||
15
full_eval.sh
Normal file
15
full_eval.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# CV - TEST
|
||||||
|
|
||||||
|
python eval.py --model_id jonatasgrosman/wav2vec2-large-xlsr-53-polish --dataset mozilla-foundation/common_voice_6_0 --config pl --split test --log_outputs --greedy
|
||||||
|
mv log_mozilla-foundation_common_voice_6_0_pl_test_predictions.txt log_mozilla-foundation_common_voice_6_0_pl_test_predictions_greedy.txt
|
||||||
|
mv mozilla-foundation_common_voice_6_0_pl_test_eval_results.txt mozilla-foundation_common_voice_6_0_pl_test_eval_results_greedy.txt
|
||||||
|
|
||||||
|
python eval.py --model_id jonatasgrosman/wav2vec2-large-xlsr-53-polish --dataset mozilla-foundation/common_voice_6_0 --config pl --split test --log_outputs
|
||||||
|
|
||||||
|
# HF EVENT - DEV
|
||||||
|
|
||||||
|
python eval.py --model_id jonatasgrosman/wav2vec2-large-xlsr-53-polish --dataset speech-recognition-community-v2/dev_data --config pl --split validation --chunk_length_s 5.0 --stride_length_s 1.0 --log_outputs --greedy
|
||||||
|
mv log_speech-recognition-community-v2_dev_data_pl_validation_predictions.txt log_speech-recognition-community-v2_dev_data_pl_validation_predictions_greedy.txt
|
||||||
|
mv speech-recognition-community-v2_dev_data_pl_validation_eval_results.txt speech-recognition-community-v2_dev_data_pl_validation_eval_results_greedy.txt
|
||||||
|
|
||||||
|
python eval.py --model_id jonatasgrosman/wav2vec2-large-xlsr-53-polish --dataset speech-recognition-community-v2/dev_data --config pl --split validation --chunk_length_s 5.0 --stride_length_s 1.0 --log_outputs
|
||||||
1
language_model/attrs.json
Normal file
1
language_model/attrs.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"alpha": 0.5, "beta": 1.5, "unk_score_offset": -10.0, "score_boundary": true}
|
||||||
3
language_model/lm.binary
Normal file
3
language_model/lm.binary
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:f1df471209afd17b6476d8ff10707e55444b77c99609ade5d75e65dd2bf464b5
|
||||||
|
size 1628858942
|
||||||
3
language_model/unigrams.txt
Normal file
3
language_model/unigrams.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:5618b3acd674a33040b05dc3f4b6d4e27971d7817b3a323a9365d38a7477b2e7
|
||||||
|
size 16663622
|
||||||
10306
log_mozilla-foundation_common_voice_6_0_pl_test_predictions.txt
Normal file
10306
log_mozilla-foundation_common_voice_6_0_pl_test_predictions.txt
Normal file
File diff suppressed because it is too large
Load Diff
10306
log_mozilla-foundation_common_voice_6_0_pl_test_predictions_greedy.txt
Normal file
10306
log_mozilla-foundation_common_voice_6_0_pl_test_predictions_greedy.txt
Normal file
File diff suppressed because it is too large
Load Diff
10306
log_mozilla-foundation_common_voice_6_0_pl_test_targets.txt
Normal file
10306
log_mozilla-foundation_common_voice_6_0_pl_test_targets.txt
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
|||||||
|
WER: 0.10980770869429375
|
||||||
|
CER: 0.029387492481781432
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
WER: 0.14213082625614223
|
||||||
|
CER: 0.03491250891695691
|
||||||
10
preprocessor_config.json
Normal file
10
preprocessor_config.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"do_normalize": true,
|
||||||
|
"feature_extractor_type": "Wav2Vec2FeatureExtractor",
|
||||||
|
"feature_size": 1,
|
||||||
|
"padding_side": "right",
|
||||||
|
"padding_value": 0.0,
|
||||||
|
"return_attention_mask": true,
|
||||||
|
"sampling_rate": 16000,
|
||||||
|
"processor_class": "Wav2Vec2ProcessorWithLM"
|
||||||
|
}
|
||||||
3
pytorch_model.bin
Normal file
3
pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:1bd2a29f3b6093cc7a0f9ad39d56b5b11ae00f588878035e117e379dd3c204a6
|
||||||
|
size 1262097815
|
||||||
1
special_tokens_map.json
Normal file
1
special_tokens_map.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "pad_token": "<pad>"}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
WER: 0.2931926751592357
|
||||||
|
CER: 0.15175189393939395
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
WER: 0.33187367303609344
|
||||||
|
CER: 0.15924530632411066
|
||||||
1
vocab.json
Normal file
1
vocab.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"<pad>": 0, "<s>": 1, "</s>": 2, "<unk>": 3, "|": 4, "-": 5, "a": 6, "b": 7, "c": 8, "d": 9, "e": 10, "f": 11, "g": 12, "h": 13, "i": 14, "j": 15, "k": 16, "l": 17, "m": 18, "n": 19, "o": 20, "p": 21, "r": 22, "s": 23, "t": 24, "u": 25, "v": 26, "w": 27, "x": 28, "y": 29, "z": 30, "ó": 31, "ą": 32, "ć": 33, "ę": 34, "ł": 35, "ń": 36, "ś": 37, "ź": 38, "ż": 39}
|
||||||
Reference in New Issue
Block a user