初始化项目,由ModelHub XC社区提供模型
Model: comodoro/wav2vec2-xls-r-300m-cs-250 Source: Original Platform
This commit is contained in:
28
.gitattributes
vendored
Normal file
28
.gitattributes
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.model filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.parquet 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
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
||||
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
5726
Fine_Tune_XLS_R_on_Common_Voice_cs_300m_CV8.ipynb
Normal file
5726
Fine_Tune_XLS_R_on_Common_Voice_cs_300m_CV8.ipynb
Normal file
File diff suppressed because one or more lines are too long
184
README.md
Normal file
184
README.md
Normal file
@@ -0,0 +1,184 @@
|
||||
---
|
||||
language:
|
||||
- cs
|
||||
license: apache-2.0
|
||||
tags:
|
||||
- automatic-speech-recognition
|
||||
- generated_from_trainer
|
||||
- hf-asr-leaderboard
|
||||
- mozilla-foundation/common_voice_8_0
|
||||
- robust-speech-event
|
||||
- xlsr-fine-tuning-week
|
||||
datasets:
|
||||
- mozilla-foundation/common_voice_8_0
|
||||
- ovm
|
||||
- pscr
|
||||
- vystadial2016
|
||||
base_model: facebook/wav2vec2-xls-r-300m
|
||||
model-index:
|
||||
- name: Czech comodoro Wav2Vec2 XLSR 300M 250h data
|
||||
results:
|
||||
- task:
|
||||
type: automatic-speech-recognition
|
||||
name: Automatic Speech Recognition
|
||||
dataset:
|
||||
name: Common Voice 8
|
||||
type: mozilla-foundation/common_voice_8_0
|
||||
args: cs
|
||||
metrics:
|
||||
- type: wer
|
||||
value: 7.3
|
||||
name: Test WER
|
||||
- type: cer
|
||||
value: 2.1
|
||||
name: Test CER
|
||||
- task:
|
||||
type: automatic-speech-recognition
|
||||
name: Automatic Speech Recognition
|
||||
dataset:
|
||||
name: Robust Speech Event - Dev Data
|
||||
type: speech-recognition-community-v2/dev_data
|
||||
args: cs
|
||||
metrics:
|
||||
- type: wer
|
||||
value: 43.44
|
||||
name: Test WER
|
||||
- task:
|
||||
type: automatic-speech-recognition
|
||||
name: Automatic Speech Recognition
|
||||
dataset:
|
||||
name: Robust Speech Event - Test Data
|
||||
type: speech-recognition-community-v2/eval_data
|
||||
args: cs
|
||||
metrics:
|
||||
- type: wer
|
||||
value: 38.5
|
||||
name: Test WER
|
||||
---
|
||||
|
||||
# Czech wav2vec2-xls-r-300m-cs-250
|
||||
|
||||
This model is a fine-tuned version of [facebook/wav2vec2-xls-r-300m](https://huggingface.co/facebook/wav2vec2-xls-r-300m) on the common_voice 8.0 dataset as well as other datasets listed below.
|
||||
|
||||
It achieves the following results on the evaluation set:
|
||||
- Loss: 0.1271
|
||||
- Wer: 0.1475
|
||||
- Cer: 0.0329
|
||||
|
||||
The `eval.py` script results using a LM are:
|
||||
- WER: 0.07274312090176113
|
||||
- CER: 0.021207369275558875
|
||||
|
||||
## Model description
|
||||
|
||||
Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) on Czech using the [Common Voice](https://huggingface.co/datasets/common_voice) dataset.
|
||||
When using this model, make sure that your speech input is sampled at 16kHz.
|
||||
|
||||
|
||||
The model can be used directly (without a language model) as follows:
|
||||
|
||||
```python
|
||||
import torch
|
||||
import torchaudio
|
||||
from datasets import load_dataset
|
||||
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
||||
|
||||
test_dataset = load_dataset("mozilla-foundation/common_voice_8_0", "cs", split="test[:2%]")
|
||||
|
||||
processor = Wav2Vec2Processor.from_pretrained("comodoro/wav2vec2-xls-r-300m-cs-250")
|
||||
model = Wav2Vec2ForCTC.from_pretrained("comodoro/wav2vec2-xls-r-300m-cs-250")
|
||||
|
||||
resampler = torchaudio.transforms.Resample(48_000, 16_000)
|
||||
|
||||
# Preprocessing the datasets.
|
||||
# We need to read the aduio files as arrays
|
||||
def speech_file_to_array_fn(batch):
|
||||
speech_array, sampling_rate = torchaudio.load(batch["path"])
|
||||
batch["speech"] = resampler(speech_array).squeeze().numpy()
|
||||
return batch
|
||||
|
||||
test_dataset = test_dataset.map(speech_file_to_array_fn)
|
||||
inputs = processor(test_dataset[:2]["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)
|
||||
|
||||
print("Prediction:", processor.batch_decode(predicted_ids))
|
||||
print("Reference:", test_dataset[:2]["sentence"])
|
||||
```
|
||||
|
||||
## Evaluation
|
||||
|
||||
The model can be evaluated using the attached `eval.py` script:
|
||||
```
|
||||
python eval.py --model_id comodoro/wav2vec2-xls-r-300m-cs-250 --dataset mozilla-foundation/common-voice_8_0 --split test --config cs
|
||||
```
|
||||
|
||||
## Training and evaluation data
|
||||
|
||||
The Common Voice 8.0 `train` and `validation` datasets were used for training, as well as the following datasets:
|
||||
|
||||
- Šmídl, Luboš and Pražák, Aleš, 2013, OVM – Otázky Václava Moravce, LINDAT/CLARIAH-CZ digital library at the Institute of Formal and Applied Linguistics (ÚFAL), Faculty of Mathematics and Physics, Charles University, http://hdl.handle.net/11858/00-097C-0000-000D-EC98-3.
|
||||
|
||||
- Pražák, Aleš and Šmídl, Luboš, 2012, Czech Parliament Meetings, LINDAT/CLARIAH-CZ digital library at the Institute of Formal and Applied Linguistics (ÚFAL), Faculty of Mathematics and Physics, Charles University, http://hdl.handle.net/11858/00-097C-0000-0005-CF9C-4.
|
||||
|
||||
- Plátek, Ondřej; Dušek, Ondřej and Jurčíček, Filip, 2016, Vystadial 2016 – Czech data, LINDAT/CLARIAH-CZ digital library at the Institute of Formal and Applied Linguistics (ÚFAL), Faculty of Mathematics and Physics, Charles University, http://hdl.handle.net/11234/1-1740.
|
||||
|
||||
|
||||
### Training hyperparameters
|
||||
|
||||
The following hyperparameters were used during training:
|
||||
- learning_rate: 0.0001
|
||||
- train_batch_size: 32
|
||||
- eval_batch_size: 8
|
||||
- seed: 42
|
||||
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
||||
- lr_scheduler_type: linear
|
||||
- lr_scheduler_warmup_steps: 800
|
||||
- num_epochs: 5
|
||||
- mixed_precision_training: Native AMP
|
||||
|
||||
### Training results
|
||||
|
||||
| Training Loss | Epoch | Step | Validation Loss | Wer | Cer |
|
||||
|:-------------:|:-----:|:-----:|:---------------:|:------:|:------:|
|
||||
| 3.4203 | 0.16 | 800 | 3.3148 | 1.0 | 1.0 |
|
||||
| 2.8151 | 0.32 | 1600 | 0.8508 | 0.8938 | 0.2345 |
|
||||
| 0.9411 | 0.48 | 2400 | 0.3335 | 0.3723 | 0.0847 |
|
||||
| 0.7408 | 0.64 | 3200 | 0.2573 | 0.2840 | 0.0642 |
|
||||
| 0.6516 | 0.8 | 4000 | 0.2365 | 0.2581 | 0.0595 |
|
||||
| 0.6242 | 0.96 | 4800 | 0.2039 | 0.2433 | 0.0541 |
|
||||
| 0.5754 | 1.12 | 5600 | 0.1832 | 0.2156 | 0.0482 |
|
||||
| 0.5626 | 1.28 | 6400 | 0.1827 | 0.2091 | 0.0463 |
|
||||
| 0.5342 | 1.44 | 7200 | 0.1744 | 0.2033 | 0.0468 |
|
||||
| 0.4965 | 1.6 | 8000 | 0.1705 | 0.1963 | 0.0444 |
|
||||
| 0.5047 | 1.76 | 8800 | 0.1604 | 0.1889 | 0.0422 |
|
||||
| 0.4814 | 1.92 | 9600 | 0.1604 | 0.1827 | 0.0411 |
|
||||
| 0.4471 | 2.09 | 10400 | 0.1566 | 0.1822 | 0.0406 |
|
||||
| 0.4509 | 2.25 | 11200 | 0.1619 | 0.1853 | 0.0432 |
|
||||
| 0.4415 | 2.41 | 12000 | 0.1513 | 0.1764 | 0.0397 |
|
||||
| 0.4313 | 2.57 | 12800 | 0.1515 | 0.1739 | 0.0392 |
|
||||
| 0.4163 | 2.73 | 13600 | 0.1445 | 0.1695 | 0.0377 |
|
||||
| 0.4142 | 2.89 | 14400 | 0.1478 | 0.1699 | 0.0385 |
|
||||
| 0.4184 | 3.05 | 15200 | 0.1430 | 0.1669 | 0.0376 |
|
||||
| 0.3886 | 3.21 | 16000 | 0.1433 | 0.1644 | 0.0374 |
|
||||
| 0.3795 | 3.37 | 16800 | 0.1426 | 0.1648 | 0.0373 |
|
||||
| 0.3859 | 3.53 | 17600 | 0.1357 | 0.1604 | 0.0361 |
|
||||
| 0.3762 | 3.69 | 18400 | 0.1344 | 0.1558 | 0.0349 |
|
||||
| 0.384 | 3.85 | 19200 | 0.1379 | 0.1576 | 0.0359 |
|
||||
| 0.3762 | 4.01 | 20000 | 0.1344 | 0.1539 | 0.0346 |
|
||||
| 0.3559 | 4.17 | 20800 | 0.1339 | 0.1525 | 0.0351 |
|
||||
| 0.3683 | 4.33 | 21600 | 0.1315 | 0.1518 | 0.0342 |
|
||||
| 0.3572 | 4.49 | 22400 | 0.1307 | 0.1507 | 0.0342 |
|
||||
| 0.3494 | 4.65 | 23200 | 0.1294 | 0.1491 | 0.0335 |
|
||||
| 0.3476 | 4.81 | 24000 | 0.1287 | 0.1491 | 0.0336 |
|
||||
| 0.3475 | 4.97 | 24800 | 0.1271 | 0.1475 | 0.0329 |
|
||||
|
||||
### Framework versions
|
||||
|
||||
- Transformers 4.16.2
|
||||
- Pytorch 1.10.1+cu102
|
||||
- Datasets 1.18.3
|
||||
- Tokenizers 0.11.0
|
||||
1
added_tokens.json
Normal file
1
added_tokens.json
Normal file
@@ -0,0 +1 @@
|
||||
{"<s>": 44, "</s>": 45}
|
||||
1
alphabet.json
Normal file
1
alphabet.json
Normal file
@@ -0,0 +1 @@
|
||||
{"labels": [" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "\u00e1", "\u00e9", "\u00ed", "\u00f3", "\u00fa", "\u00fd", "\u010d", "\u010f", "\u011b", "\u0148", "\u0159", "\u0161", "\u0165", "\u016f", "\u017e", "\u2047", "", "<s>", "</s>"], "is_bpe": false}
|
||||
108
config.json
Normal file
108
config.json
Normal file
@@ -0,0 +1,108 @@
|
||||
{
|
||||
"_name_or_path": "facebook/wav2vec2-xls-r-300m",
|
||||
"activation_dropout": 0.0,
|
||||
"adapter_kernel_size": 3,
|
||||
"adapter_stride": 2,
|
||||
"add_adapter": false,
|
||||
"apply_spec_augment": true,
|
||||
"architectures": [
|
||||
"Wav2Vec2ForCTC"
|
||||
],
|
||||
"attention_dropout": 0.1,
|
||||
"bos_token_id": 1,
|
||||
"classifier_proj_size": 256,
|
||||
"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": false,
|
||||
"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.0,
|
||||
"feat_quantizer_dropout": 0.0,
|
||||
"final_dropout": 0.0,
|
||||
"gradient_checkpointing": false,
|
||||
"hidden_act": "gelu",
|
||||
"hidden_dropout": 0.2,
|
||||
"hidden_size": 1024,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 4096,
|
||||
"layer_norm_eps": 1e-05,
|
||||
"layerdrop": 0.1,
|
||||
"mask_feature_length": 10,
|
||||
"mask_feature_min_masks": 0,
|
||||
"mask_feature_prob": 0.0,
|
||||
"mask_time_length": 10,
|
||||
"mask_time_min_masks": 2,
|
||||
"mask_time_prob": 0.1,
|
||||
"model_type": "wav2vec2",
|
||||
"num_adapter_layers": 3,
|
||||
"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,
|
||||
"output_hidden_size": 1024,
|
||||
"pad_token_id": 43,
|
||||
"proj_codevector_dim": 768,
|
||||
"tdnn_dilation": [
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"tdnn_dim": [
|
||||
512,
|
||||
512,
|
||||
512,
|
||||
512,
|
||||
1500
|
||||
],
|
||||
"tdnn_kernel": [
|
||||
5,
|
||||
3,
|
||||
3,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"torch_dtype": "float32",
|
||||
"transformers_version": "4.16.2",
|
||||
"use_weighted_layer_sum": false,
|
||||
"vocab_size": 46,
|
||||
"xvector_output_dim": 512
|
||||
}
|
||||
178
eval.py
Executable file
178
eval.py
Executable file
@@ -0,0 +1,178 @@
|
||||
#!/usr/bin/env python3
|
||||
from datasets import load_dataset, load_metric, Audio, Dataset
|
||||
from transformers import pipeline, AutoFeatureExtractor, AutoTokenizer, Wav2Vec2ForCTC
|
||||
import os
|
||||
import re
|
||||
import argparse
|
||||
import unicodedata
|
||||
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) -> str:
|
||||
""" DO ADAPT FOR YOUR USE CASE. this function normalizes the target text. """
|
||||
|
||||
|
||||
CHARS = {
|
||||
'ü': 'ue',
|
||||
'ö': 'oe',
|
||||
'ï': 'i',
|
||||
'ë': 'e',
|
||||
'ä': 'ae',
|
||||
'ã': 'a',
|
||||
'à': 'á',
|
||||
'ø': 'o',
|
||||
'è': 'é',
|
||||
'ê': 'é',
|
||||
'å': 'ó',
|
||||
'î': 'i',
|
||||
'ñ': 'ň',
|
||||
'ç': 's',
|
||||
'ľ': 'l',
|
||||
'ż': 'ž',
|
||||
'ł': 'w',
|
||||
'ć': 'č',
|
||||
'þ': 't',
|
||||
'ß': 'ss',
|
||||
'ę': 'en',
|
||||
'ą': 'an',
|
||||
'æ': 'ae',
|
||||
}
|
||||
|
||||
def replace_chars(sentence):
|
||||
result = ''
|
||||
for ch in sentence:
|
||||
new = CHARS[ch] if ch in CHARS else ch
|
||||
result += new
|
||||
|
||||
return result
|
||||
|
||||
chars_to_ignore_regex = '[\,\?\.\!\-\;\:\/\"\“\„\%\”\<EFBFBD>\–\'\`\«\»\—\’\…]'
|
||||
|
||||
text = text.lower()
|
||||
# normalize non-standard (stylized) unicode characters
|
||||
text = unicodedata.normalize('NFKC', text)
|
||||
# remove punctuation
|
||||
text = re.sub(chars_to_ignore_regex, "", text)
|
||||
text = replace_chars(text)
|
||||
|
||||
# Let's also make sure we split on all kinds of newlines, spaces, etc...
|
||||
text = " ".join(text.split())
|
||||
|
||||
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
|
||||
if args.limit:
|
||||
dataset = dataset.select(range(limit))
|
||||
|
||||
feature_extractor = AutoFeatureExtractor.from_pretrained(args.model_id)
|
||||
# load processor
|
||||
sampling_rate = feature_extractor.sampling_rate
|
||||
|
||||
# resample audio
|
||||
dataset = dataset.cast_column("audio", Audio(sampling_rate=sampling_rate))
|
||||
|
||||
asr = None
|
||||
|
||||
if os.path.exists(args.model_id):
|
||||
model = Wav2Vec2ForCTC.from_pretrained(args.model_id)
|
||||
tokenizer = AutoTokenizer.from_pretrained(args.model_id)
|
||||
|
||||
|
||||
# load eval pipeline
|
||||
asr = pipeline("automatic-speech-recognition", model=model, tokenizer=tokenizer, feature_extractor=feature_extractor)
|
||||
|
||||
else:
|
||||
asr = pipeline("automatic-speech-recognition", model=args.model_id)
|
||||
|
||||
# map function to decode audio
|
||||
def map_to_pred(batch):
|
||||
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"])
|
||||
return batch
|
||||
|
||||
# run inference on all examples
|
||||
result = dataset.map(map_to_pred, remove_columns=dataset.column_names)
|
||||
|
||||
# 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(
|
||||
"--limit", type=int, help="Not required. If greater than zero, select a subset of this size from the dataset.", default=0
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
main(args)
|
||||
1
language_model/attrs.json
Normal file
1
language_model/attrs.json
Normal file
@@ -0,0 +1 @@
|
||||
{"alpha": 0.9, "beta": 2.5, "unk_score_offset": -10.0, "score_boundary": true}
|
||||
3
language_model/cs-500k.bin
Normal file
3
language_model/cs-500k.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8d8d4a962c064104514b016d6250a8d45eb13c986eaa568fb9e7db7fe1dd838a
|
||||
size 1040547138
|
||||
500000
language_model/unigrams.txt
Normal file
500000
language_model/unigrams.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:99376277738caade67bf57b7dfab362b3172323b4724c0db4c51a56254340099
|
||||
size 1261996032
|
||||
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,
|
||||
"processor_class": "Wav2Vec2ProcessorWithLM",
|
||||
"return_attention_mask": true,
|
||||
"sampling_rate": 16000
|
||||
}
|
||||
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:ef2fdad28a59d6ae8772619eba69fa0ee09714a6b9c27d55717b32629b201ead
|
||||
size 1262112241
|
||||
3
rng_state.pth
Normal file
3
rng_state.pth
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:490ca80b725ae7cc84f79c45a41ad8d08cf8b31084d829c0315d48f6217697f4
|
||||
size 14567
|
||||
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]", "additional_special_tokens": [{"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}]}
|
||||
1
tokenizer_config.json
Normal file
1
tokenizer_config.json
Normal file
@@ -0,0 +1 @@
|
||||
{"unk_token": "[UNK]", "bos_token": "<s>", "eos_token": "</s>", "pad_token": "[PAD]", "do_lower_case": false, "word_delimiter_token": "|", "special_tokens_map_file": null, "tokenizer_file": null, "name_or_path": "./", "tokenizer_class": "Wav2Vec2CTCTokenizer", "processor_class": "Wav2Vec2Processor"}
|
||||
1824
train.ipynb
Normal file
1824
train.ipynb
Normal file
File diff suppressed because one or more lines are too long
112
trainer_state.json
Normal file
112
trainer_state.json
Normal file
@@ -0,0 +1,112 @@
|
||||
{
|
||||
"best_metric": null,
|
||||
"best_model_checkpoint": null,
|
||||
"epoch": 48.379746835443036,
|
||||
"global_step": 1500,
|
||||
"is_hyper_param_search": false,
|
||||
"is_local_process_zero": true,
|
||||
"is_world_process_zero": true,
|
||||
"log_history": [
|
||||
{
|
||||
"epoch": 8.06,
|
||||
"learning_rate": 0.0005,
|
||||
"loss": 0.576,
|
||||
"step": 250
|
||||
},
|
||||
{
|
||||
"epoch": 8.06,
|
||||
"eval_cer": 0.050238462365976976,
|
||||
"eval_loss": 0.24107621610164642,
|
||||
"eval_runtime": 380.2463,
|
||||
"eval_samples_per_second": 19.111,
|
||||
"eval_steps_per_second": 2.391,
|
||||
"eval_wer": 0.23400590063956597,
|
||||
"step": 250
|
||||
},
|
||||
{
|
||||
"epoch": 16.13,
|
||||
"learning_rate": 0.001,
|
||||
"loss": 0.2564,
|
||||
"step": 500
|
||||
},
|
||||
{
|
||||
"epoch": 16.13,
|
||||
"eval_cer": 0.04923441029870549,
|
||||
"eval_loss": 0.23052524030208588,
|
||||
"eval_runtime": 267.8454,
|
||||
"eval_samples_per_second": 27.131,
|
||||
"eval_steps_per_second": 3.394,
|
||||
"eval_wer": 0.20967071263093282,
|
||||
"step": 500
|
||||
},
|
||||
{
|
||||
"epoch": 24.19,
|
||||
"learning_rate": 0.0007619047619047619,
|
||||
"loss": 0.2018,
|
||||
"step": 750
|
||||
},
|
||||
{
|
||||
"epoch": 24.19,
|
||||
"eval_cer": 0.04937458639900638,
|
||||
"eval_loss": 0.23705527186393738,
|
||||
"eval_runtime": 264.0504,
|
||||
"eval_samples_per_second": 27.521,
|
||||
"eval_steps_per_second": 3.443,
|
||||
"eval_wer": 0.20590855988753143,
|
||||
"step": 750
|
||||
},
|
||||
{
|
||||
"epoch": 32.25,
|
||||
"learning_rate": 0.0005238095238095238,
|
||||
"loss": 0.1549,
|
||||
"step": 1000
|
||||
},
|
||||
{
|
||||
"epoch": 32.25,
|
||||
"eval_cer": 0.04349696991429698,
|
||||
"eval_loss": 0.22975854575634003,
|
||||
"eval_runtime": 264.3572,
|
||||
"eval_samples_per_second": 27.489,
|
||||
"eval_steps_per_second": 3.439,
|
||||
"eval_wer": 0.18440488683840564,
|
||||
"step": 1000
|
||||
},
|
||||
{
|
||||
"epoch": 40.32,
|
||||
"learning_rate": 0.0002857142857142857,
|
||||
"loss": 0.1224,
|
||||
"step": 1250
|
||||
},
|
||||
{
|
||||
"epoch": 40.32,
|
||||
"eval_cer": 0.040729306910681745,
|
||||
"eval_loss": 0.22875599563121796,
|
||||
"eval_runtime": 265.748,
|
||||
"eval_samples_per_second": 27.345,
|
||||
"eval_steps_per_second": 3.421,
|
||||
"eval_wer": 0.1724650020790844,
|
||||
"step": 1250
|
||||
},
|
||||
{
|
||||
"epoch": 48.38,
|
||||
"learning_rate": 4.761904761904762e-05,
|
||||
"loss": 0.1004,
|
||||
"step": 1500
|
||||
},
|
||||
{
|
||||
"epoch": 48.38,
|
||||
"eval_cer": 0.03763565297613421,
|
||||
"eval_loss": 0.23267094790935516,
|
||||
"eval_runtime": 266.4102,
|
||||
"eval_samples_per_second": 27.277,
|
||||
"eval_steps_per_second": 3.412,
|
||||
"eval_wer": 0.16082212937845278,
|
||||
"step": 1500
|
||||
}
|
||||
],
|
||||
"max_steps": 1550,
|
||||
"num_train_epochs": 50,
|
||||
"total_flos": 1.244071149131343e+20,
|
||||
"trial_name": null,
|
||||
"trial_params": null
|
||||
}
|
||||
1
vocab.json
Normal file
1
vocab.json
Normal file
@@ -0,0 +1 @@
|
||||
{"a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": 6, "g": 7, "h": 8, "i": 9, "j": 10, "k": 11, "l": 12, "m": 13, "n": 14, "o": 15, "p": 16, "q": 17, "r": 18, "s": 19, "t": 20, "u": 21, "v": 22, "w": 23, "x": 24, "y": 25, "z": 26, "\u00e1": 27, "\u00e9": 28, "\u00ed": 29, "\u00f3": 30, "\u00fa": 31, "\u00fd": 32, "\u010d": 33, "\u010f": 34, "\u011b": 35, "\u0148": 36, "\u0159": 37, "\u0161": 38, "\u0165": 39, "\u016f": 40, "\u017e": 41, "|": 0, "[UNK]": 42, "[PAD]": 43}
|
||||
Reference in New Issue
Block a user