Files
wav2vec2-xls-r-300m-cs-250/train.ipynb

1825 lines
158 KiB
Plaintext
Raw Permalink Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "8d07f027",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using custom data configuration default-8f1be135afea2a5e\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloading and preparing dataset json/default to /workspace/.cache/huggingface/datasets/json/default-8f1be135afea2a5e/0.0.0/ac0ca5f5289a6cf108e706efcf040422dbbfa8e658dee6a819f20d76bb84d26b...\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1b68f3c845a14540b7fa4feb0b78d3e9",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "54002c8dc2044b3987377cf519579109",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dataset json downloaded and prepared to /workspace/.cache/huggingface/datasets/json/default-8f1be135afea2a5e/0.0.0/ac0ca5f5289a6cf108e706efcf040422dbbfa8e658dee6a819f20d76bb84d26b. Subsequent calls will reuse this data.\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "861f78e0c3b3458faa9cc42cde173d84",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using custom data configuration default-cb03ad945d4a24ac\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloading and preparing dataset json/default to /workspace/.cache/huggingface/datasets/json/default-cb03ad945d4a24ac/0.0.0/ac0ca5f5289a6cf108e706efcf040422dbbfa8e658dee6a819f20d76bb84d26b...\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f61b1f0086c340f9a8b2d9f20a08e0c1",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "7d18344e823a4848a9b98cfdec90b2ce",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dataset json downloaded and prepared to /workspace/.cache/huggingface/datasets/json/default-cb03ad945d4a24ac/0.0.0/ac0ca5f5289a6cf108e706efcf040422dbbfa8e658dee6a819f20d76bb84d26b. Subsequent calls will reuse this data.\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "77bc9aad0b494696942e0fbd0663a29c",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using custom data configuration default-eec7a48f9eca7cd5\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloading and preparing dataset json/default to /workspace/.cache/huggingface/datasets/json/default-eec7a48f9eca7cd5/0.0.0/ac0ca5f5289a6cf108e706efcf040422dbbfa8e658dee6a819f20d76bb84d26b...\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "200634fba7454dc5a611c6a79855bc42",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d2246049976343659ce829d6c1f1e42e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dataset json downloaded and prepared to /workspace/.cache/huggingface/datasets/json/default-eec7a48f9eca7cd5/0.0.0/ac0ca5f5289a6cf108e706efcf040422dbbfa8e658dee6a819f20d76bb84d26b. Subsequent calls will reuse this data.\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "43219229d82c4e2a9d3cb916d1b56801",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/1 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"{'audio': {'path': '/workspace/data/ovm/ovm_111218-621.wav',\n",
" 'array': array([ 0.00079346, 0.00073242, 0.00012207, ..., -0.00323486,\n",
" -0.00177002, -0.00180054], dtype=float32),\n",
" 'sampling_rate': 16000},\n",
" 'sentence': 'co by novinář když václav havel byl v prezidentském úřadu a pak právě při psaní knížky prosím stručně vaše vzpomínka na václava havla'}"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import datasets\n",
"\n",
"def load_local_dataset(dsname):\n",
" d = datasets.load_dataset('json', data_files=f'/workspace/data/{dsname}.json')\n",
" d = d.cast_column('audio', datasets.features.Audio(sampling_rate=16000))\n",
" return d\n",
"\n",
"ovm = load_local_dataset('ovm')\n",
"vyst = load_local_dataset('vystadial2016')\n",
"pscr = load_local_dataset('pscr')\n",
"\n",
"ovm['train'][0]"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "890ba811",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Reusing dataset common_voice (/workspace/.cache/huggingface/datasets/mozilla-foundation___common_voice/cs/8.0.0/b8bc4d453193c06a43269b46cd87f075c70f152ac963b7f28f7a2760c45ec3e8)\n"
]
},
{
"data": {
"text/plain": [
"{'path': 'cv-corpus-8.0-2022-01-19/cs/clips/common_voice_cs_20500740.mp3',\n",
" 'audio': {'path': 'cv-corpus-8.0-2022-01-19/cs/clips/common_voice_cs_20500740.mp3',\n",
" 'array': array([0.0000000e+00, 0.0000000e+00, 0.0000000e+00, ..., 6.3757376e-05,\n",
" 4.1789750e-05, 6.2637460e-05], dtype=float32),\n",
" 'sampling_rate': 16000},\n",
" 'sentence': 'To dělá to, že se tady chodí po lukách místo po cestičkách.'}"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cv = datasets.load_dataset(\"mozilla-foundation/common_voice_8_0\", \"cs\", split=\"train+validation\", use_auth_token=True)\n",
"cv = cv.remove_columns([\"accent\", \"age\", \"client_id\", \"down_votes\", \"gender\", \"locale\", \"segment\", \"up_votes\"])\n",
"cv = cv.cast_column(\"audio\", datasets.Audio(sampling_rate=16_000))\n",
"cv[0]"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "3855ccb3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'audio': {'path': '/workspace/data/vystadial2016/train/10/62/vad-2015-09-20--12-34-27.561625.wav',\n",
" 'array': array([ 0.00564575, 0.00588989, 0.00363159, ..., -0.01358032,\n",
" -0.01220703, -0.00946045], dtype=float32),\n",
" 'sampling_rate': 16000},\n",
" 'sentence': 'olomouc hlavní nádraží',\n",
" 'path': None}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#all = datasets.interleave_datasets([ovm['train'], vyst['train'], pscr['train'], cv])\n",
"all = datasets.concatenate_datasets([ovm['train'], vyst['train'], pscr['train'], cv]).shuffle()\n",
"all[0]\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "7c896f08",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Reusing dataset common_voice (/workspace/.cache/huggingface/datasets/mozilla-foundation___common_voice/cs/8.0.0/b8bc4d453193c06a43269b46cd87f075c70f152ac963b7f28f7a2760c45ec3e8)\n"
]
},
{
"data": {
"text/plain": [
"7267"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"common_voice_test = datasets.load_dataset(\"mozilla-foundation/common_voice_8_0\", \"cs\", split=\"test\", use_auth_token=True)\n",
"common_voice_test = common_voice_test.remove_columns([\"accent\", \"age\", \"client_id\", \"down_votes\", \"gender\", \"locale\", \"segment\", \"up_votes\"])\n",
"len(common_voice_test)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2eb3eb20",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 5,
"id": "f43b8d3d",
"metadata": {
"id": "ZcVsD0ETElrR"
},
"outputs": [],
"source": [
"import re\n",
"chars_to_remove_regex = '[\\,\\?\\.\\!\\-\\;\\:\\/\\\"\\“\\„\\%\\”\\<5C>\\–\\'\\`\\«\\»\\—\\’\\…]'\n",
"\n",
"\n",
"CHARS = {\n",
" 'ü': 'ue',\n",
" 'ö': 'oe',\n",
" 'ï': 'i',\n",
" 'ë': 'e',\n",
" 'ä': 'ae',\n",
" 'ã': 'a',\n",
" 'à': 'á',\n",
" 'ø': 'o',\n",
" 'è': 'é',\n",
" 'ê': 'é',\n",
" 'å': 'ó',\n",
" 'î': 'i',\n",
" 'ñ': 'ň',\n",
" 'ç': 's',\n",
" 'ľ': 'l',\n",
" 'ż': 'ž',\n",
" 'ł': 'w',\n",
" 'ć': 'č',\n",
" 'þ': 't',\n",
" 'ß': 'ss',\n",
" 'ę': 'en',\n",
" 'ą': 'an',\n",
" 'æ': 'ae',\n",
" }\n",
"\n",
"def replace_chars(sentence):\n",
" result = ''\n",
" for ch in sentence:\n",
" new = CHARS[ch] if ch in CHARS else ch\n",
" result += new\n",
"\n",
" return result\n",
"\n",
"\n",
"def remove_special_characters(batch):\n",
" batch[\"sentence\"] = re.sub(chars_to_remove_regex, ' ', batch[\"sentence\"]).lower()\n",
" batch[\"sentence\"] = replace_chars(batch['sentence'])\n",
" batch[\"sentence\"] = \" \".join([char for char in batch[\"sentence\"].split(\" \") if char != \"\"])\n",
" return batch\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "d1fd4858",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "10a4628ef8454147a54a6d97fefe3532",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"0ex [00:00, ?ex/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Loading cached processed dataset at /workspace/.cache/huggingface/datasets/mozilla-foundation___common_voice/cs/8.0.0/b8bc4d453193c06a43269b46cd87f075c70f152ac963b7f28f7a2760c45ec3e8/cache-900ef796264993e5.arrow\n"
]
}
],
"source": [
"all = all.map(remove_special_characters)\n",
"common_voice_test = common_voice_test.map(remove_special_characters)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ffb2e6ba",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 7,
"id": "9acd28b1",
"metadata": {
"id": "LwCshNbbeRZR"
},
"outputs": [],
"source": [
"def extract_all_chars(batch):\n",
" all_text = \" \".join(batch[\"sentence\"])\n",
" vocab = list(set(all_text))\n",
" return {\"vocab\": [vocab], \"all_text\": [all_text]}"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "c009de89",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d7103c4475a9464cb7dd5c66a68ddbf7",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/1 [00:00<?, ?ba/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"{' ': 0,\n",
" 'a': 1,\n",
" 'b': 2,\n",
" 'c': 3,\n",
" 'd': 4,\n",
" 'e': 5,\n",
" 'f': 6,\n",
" 'g': 7,\n",
" 'h': 8,\n",
" 'i': 9,\n",
" 'j': 10,\n",
" 'k': 11,\n",
" 'l': 12,\n",
" 'm': 13,\n",
" 'n': 14,\n",
" 'o': 15,\n",
" 'p': 16,\n",
" 'q': 17,\n",
" 'r': 18,\n",
" 's': 19,\n",
" 't': 20,\n",
" 'u': 21,\n",
" 'v': 22,\n",
" 'w': 23,\n",
" 'x': 24,\n",
" 'y': 25,\n",
" 'z': 26,\n",
" 'á': 27,\n",
" 'é': 28,\n",
" 'í': 29,\n",
" 'ó': 30,\n",
" 'ú': 31,\n",
" 'ý': 32,\n",
" 'č': 33,\n",
" 'ď': 34,\n",
" 'ě': 35,\n",
" 'ň': 36,\n",
" 'ř': 37,\n",
" 'š': 38,\n",
" 'ť': 39,\n",
" 'ů': 40,\n",
" 'ž': 41}"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"vocab_train = all.map(extract_all_chars, batched=True, batch_size=-1, keep_in_memory=True, remove_columns=all.column_names)\n",
"vocab_list = list(set(vocab_train[\"vocab\"][0]))\n",
"vocab_dict = {v: k for k, v in enumerate(sorted(vocab_list))}\n",
"vocab_dict"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "7b237346",
"metadata": {
"id": "npbIbBoLgaFX"
},
"outputs": [
{
"data": {
"text/plain": [
"44"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"vocab_dict[\"|\"] = vocab_dict[\" \"]\n",
"del vocab_dict[\" \"]\n",
"vocab_dict[\"[UNK]\"] = len(vocab_dict)\n",
"vocab_dict[\"[PAD]\"] = len(vocab_dict)\n",
"len(vocab_dict)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "a08bda02",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/workspace/cs/cs2\n"
]
},
{
"data": {
"text/plain": [
"'/workspace/cs/cs2'"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%cd ~/cs/cs2\n",
"%pwd"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "154e541c",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 11,
"id": "411e1255",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "znF0bNunsjbl",
"outputId": "6b335aef-870c-41fc-98c9-664a357e5ab8"
},
"outputs": [
{
"data": {
"text/plain": [
"44"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"vocab_dict[\"[UNK]\"] = len(vocab_dict)\n",
"vocab_dict[\"[PAD]\"] = len(vocab_dict)\n",
"len(vocab_dict)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e3f0c2f5",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 12,
"id": "8ab39e55",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 53
},
"id": "xriFGEWQkO4M",
"outputId": "a782d2e0-723d-464e-d3f6-577454322862"
},
"outputs": [],
"source": [
"from transformers import Wav2Vec2CTCTokenizer\n",
"\n",
"tokenizer = Wav2Vec2CTCTokenizer.from_pretrained(\"./\", unk_token=\"[UNK]\", pad_token=\"[PAD]\", word_delimiter_token=\"|\")"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "5c1c8b06",
"metadata": {
"id": "A1XApZBAF2zr"
},
"outputs": [],
"source": [
"repo_name = \"wav2vec2-xls-r-300m-cs-250\""
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "b4b326f8",
"metadata": {
"id": "kAR0-2KLkopp"
},
"outputs": [],
"source": [
"from transformers import Wav2Vec2FeatureExtractor\n",
"\n",
"feature_extractor = Wav2Vec2FeatureExtractor(feature_size=1, sampling_rate=16000, padding_value=0.0, do_normalize=True, return_attention_mask=True)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "30a92bc9",
"metadata": {
"id": "KYZtoW-tlZgl"
},
"outputs": [],
"source": [
"from transformers import Wav2Vec2Processor\n",
"\n",
"processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "de95a6dc",
"metadata": {
"id": "kMv1VGCJoX8D"
},
"outputs": [],
"source": [
"# save tokenizer to folder\n",
"processor.save_pretrained(repo_name)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6369313a",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 54
},
"id": "TTCS7W6XJ9BG",
"outputId": "d6a300c2-7b44-455b-8743-cb3088cab9b3"
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 17,
"id": "d74c0b80",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 54
},
"id": "TTCS7W6XJ9BG",
"outputId": "d6a300c2-7b44-455b-8743-cb3088cab9b3"
},
"outputs": [],
"source": [
"all[0][\"path\"]"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "a8b4ce20",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "qj_z5Zc3GAs9",
"outputId": "6e80ea55-bda2-41aa-d00f-d61f4803bf0a"
},
"outputs": [
{
"data": {
"text/plain": [
"{'path': '/workspace/data/vystadial2016/train/10/62/vad-2015-09-20--12-34-27.561625.wav',\n",
" 'array': array([ 0.00564575, 0.00588989, 0.00363159, ..., -0.01358032,\n",
" -0.01220703, -0.00946045], dtype=float32),\n",
" 'sampling_rate': 16000}"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"all[0][\"audio\"]"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "8a006882",
"metadata": {
"id": "rrv65aj7G95i"
},
"outputs": [],
"source": [
"from datasets import Audio\n",
"all = all.cast_column(\"audio\", Audio(sampling_rate=16_000))\n",
"common_voice_test = common_voice_test.cast_column(\"audio\", Audio(sampling_rate=16_000))"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "fc328f00",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "aKtkc1o_HWHC",
"outputId": "3f36307e-777d-4937-884d-d4aab658bc1b"
},
"outputs": [
{
"data": {
"text/plain": [
"{'path': '/workspace/data/vystadial2016/train/10/62/vad-2015-09-20--12-34-27.561625.wav',\n",
" 'array': array([ 0.00564575, 0.00588989, 0.00363159, ..., -0.01358032,\n",
" -0.01220703, -0.00946045], dtype=float32),\n",
" 'sampling_rate': 16000}"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"all[0][\"audio\"]"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "14fc4dc7",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 93
},
"id": "dueM6U7Ev0OA",
"outputId": "3f83e83a-139b-484c-8337-5df6dbe734a4"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dobrý den chtěl bych jet\n"
]
},
{
"data": {
"text/html": [
"\n",
" <audio controls=\"controls\" autoplay=\"autoplay\">\n",
" <source src=\"data:audio/wav;base64,UklGRiQUAQBXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YQAUAQAGAAIA+P/x//P/AAAIAAoACAAIAAgACgAGAAoACAAIAAgACgAGAAgACAAKAAgACAAGAA8AHgArACsAJQAeABsAGgAQAA0ADwAYAB4AHgAeABgAEAANAA8AGAAgAB4AEwAEAPz/+v/2//P/8//4//r/9v/r/+X/4v/i/+L/5f/t//P/+v/2//P/9v8AAAYAEAAbACYAMAAxADEAKQAbAAQA9v/z//b/9v/4//z/CgAVABoAGgAeACYAKwApAB4AGAAYABUADQD6/93/xP+u/57/j/+N/5r/rP+5/73/v//E/8//2v/l//D/9v/2//b/9v/2//H/4P/S/9D/2//g/9v/0v/S/+L/8P/4//j/8//2//b/+v8KABsALgA7AEYAUQBSAE4ARgBBAD4AOwAxACYAGAAGAPz/8f/x//j/+v/2//b/9v/4//j/9v/z//j//v8IABMAGwAmAC4ANAAwACkAGAAPAAgACAAGAAgADQANAAYA+P/l/93/4v/m/+X/4P/l/+v/+P8EABsANABGAD4ALgAgABsAHgAaABAACgAIAAYABgAKABMAGgAVAAoA/P/2/+3/5f/g/+D/7f/4//j/9v/z//j/+P/2//P/9v/6//P/8//2/wIABgAKAAoACAAGAAQA9v/i/9D/wv+6/8L/z//l//b/AAAKABAAGwAeABsAGwAaABsAHgAbABoAGgAbACUALgA7AEYARwBBADEAGwAIAPb/5v/l/+v/8//4//j/+P/z/+3/5f/g/+D/7f/2/wIACAAKAAgAAAD4//P/8//6//b/8//2//b/+P/2//b/9v/6//b/9v/2//j/9v/z//r/CgAgAC4AMAAxADsAPgA8ADEAKwArADEAMQApABgABgD6/+3/4P/X/9D/0P/M/8X/v/+5/7r/wv/S/93/4P/a/9L/zP/P/9X/5f/+/xoALgAwACUAGgAYAB4AIAAaABAACgAIAAYAAgD2//H/8/8AAAgADQAIAP7/+P/8/wgADwAKAPj/4P/V/8//1//g//b/CgAaABoAEAAKAAgABgACAPb/8//z/wAACAAKAAgA/v/4//D/4v/X/9D/zP/Q/9D/z//M/8//4P/2/wQACAAGAAgAEAAaAB4AGwAaABoAGwAbABsAGgATAAoABAAIAA0ACAD+//P/+v8IABoAGgAQAAoACAAGAAAA+P/z//P/9v/4//j/8//r/+b/4P/i/+X/5v/l/+D/6P/4/wQACAD+//j/9v/z//P/9v8EABsAKwAwAC4AMAA0ADAAGwAKAPz/9v/z//j/+P/2/+3/5f/a/8//xP+9/8L/z//i//b/CAAbACkAMAAmAB4AFQAaACYAMQA0AC4ALgAwADQALgAjACAAGwAaAA0A9v/m/+L/5f/i/+L/4v/r//b/AAAKAAoACAD+//j/8//z//b/+P/+/wYADQAKAAYABgAPACAAKQAuAC4AMQA4AEEAQwBGAD4ALgATAPr/6P/i/+D/5f/t//b/+v/4//P/9v/4//j/6//g/+j/9v8EAAgACAAKAAoACAAAAPb/7f/i/9f/0P/M/9D/z//Q/9f/4v/t//j//v8IABMAGwAbABsAGwAaABoAGwAmAC4AKwAbAA8ACAAIAAgAAgD2/+v/4v/i/+X/5f/i/+D/4v/t//j/+P/4//P/9v/2//b/8//2//j/9v/2//b//v8IAA0ACAD+//j/8//2//b/+P/2//j/8P/l/9v/5f/w//j/9v/2/wIAGwA0AEMARgBDAD4ALgAaAAoABgAGAAIA+P/x//P/+P/6//P/8//2//r/9v/z//r/CgAgAC4AMQAwADEALgAlABsAIwAwADQAMAArADAANgAwABMA9v/m/+L/3f/P/7//v//F/8z/0P/Q/9D/zP/E/7//vf+5/7L/rP+u/7r/xf/Q/+D/8/8KABsAJgAxADsAQQBGAEMAQwBBADsAMQAwAC4AJgAeABgAGgAYAAgA/P/2//7/CAAVABsAHgAeABMABgD8//r/9v/z//b/+v/4//P/8P/8/wYAAgD2/+b/4v/d/9f/0v/d//P//v/4/+j/4P/i/+X/4P/l/+3/8//4//r//v8GAAgADQAPABgAHgAeABsAGAATAA0ABAAEAA8AHgArAC4AJgAeABAABgD+//j/9v/z//b/+P/4//b/7f/i/+D/4v/o/+L/3f/l//j/CAANAAgADQAbACsALgAmABsAGgAbABsAGwAbABoAGgAbAB4AGgATAAoABgAIAAoACAAAAPb/8//2//j/9v/z//P//v8KAA8ABgD+//j/+v/x/+b/0P/C/7r/uf+9/8X/z//S/9D/zP/Q/9r/4v/t//b/CAAaACAAHgAVABoAIAAbAA0A8//d/9D/z//M/8//0P/a/+D/5v/l/+X/4v/a/9L/yv/P/9r/5f/w//P//v8KABUAGAAbAB4AHgAYABgAHgAwAEEARwBGAEMAQQA7ADEAKwAuADgAQwBBADAAGgAIAAYACAANAAYA/v/2//j/8//w/+X/4P/i/+X/5v/l/+L/4P/l/+3/9v/4//b//P8GABUAGgAbABsAGwAaABoAHgAeABoAEAAKAAoABgD6/+X/0v/P/8//0P/P/8//0P/Q/8z/z//d//b/DQAbACUAMAA7AEEAQwBBAEYAQQA8ADAAJQAbABAABgAAAPb/7f/i/+D/5f/o/+L/1f/S/9f/4P/l/+b/6//z//r/+P/2//P/9v/6//7/BgATAB4AIAAaABAACAAGAAgACAAIAAgACAAKAAgABgAKAAoABgAAAPb/8//2//j/+P/2//b/9v/2//b/9v/2//j/9v/2//b/9v/2//j/9v/2//b/+P/2//b/9v/4//j/9v/z//j/AAAIAAoACgAIAAgACgAIAAgABgAIAAgACAAGAAgACAAIAAgACAAIAAgACAAIAAgACgAIAAYACAAKAAgACAAKAAgACgAIAAgADwAbACkAMAAuADAAPABXAGQAaABoAGoAbABoAFcARgAwABoAAADl/8r/p/95/0z/JP8M//X+2v6x/pb+iP6J/pD+lv6m/sL+8v40/3j/vf8KAGgAyQAWAVQBjQHOARMCTAJ+AqgCygLlAvIC6QLPAp0CXQIYAswBZwHtAGIA1f88/5T+4P03/bH8Rvzo+437PPv/+s/6t/rC+v/6Y/vU+0j8v/xX/RD+1f6W/1kAJgENAvYCyQNzBAgFnAU7BsoGNgduB3sHaAcxB88GRAaYBdUEBQQZAxYC9QDP/6b+hP1g/Db7Bvrr+AD4Vvff9oD2Kfb19RD2h/Yz9+z3qfiQ+bP6EfyW/R7/ngAYAooDCgWTBvoHGQkFCuMKxQuODAYNJw0BDZMMzwu8CoYJPQjPBiwFYwOTAcL/2/31+yn6ofhL9/L1gvQP89zxFPG48Kvwy/AJ8ZDxf/LO80T1s/Yc+LH5jfuZ/aT/eAEdA8QEngafCIEK/gsXDfQNyA6HDxEQPhAMEIkPyg77DRYN9gt+CsII6wYgBXADzAEVAD3+UfyD+gP5sfdd9u30rvPZ8k7yxPE18fXwJfGK8cLx6fFs8nbzvfTh9dn29fdl+f/6jvz7/Xj/FQHBAlcEygVNBwYJ0gpTDGYNSA5bD5cQjBHjEdgR0xH3EeEROxEEEIwODA2LC/EJHwj1BXcD3gB4/jv8+vmQ9zb1GvMn8Tvvc+0l7FLrsOoN6rbp/Om16nPrGOwS7bLunfBs8g/0+/Vq+AX7Y/2U/+cBdQT1BjwJbQufDaQPQhGYEvwTZhVkFqUWaRZGFmEWOxYwFVgTPRFbD6ENpws2CXoGtgMbAbz+i/xq+jb4/fX/82byHfHx7+HuKO7v7R/ubu7A7jbv9O/U8MTx0/Iz9OX1rfdW+QX72PzS/rQAYgL7A5gFMQeeCOsJNAt/DJwNYQ7WDiUPbQ+ZD28PxQ6fDSYMlAoeCb0HOQZyBG8CWQBn/pD8wvrl+BX
" Your browser does not support the audio element.\n",
" </audio>\n",
" "
],
"text/plain": [
"<IPython.lib.display.Audio object>"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import IPython.display as ipd\n",
"import numpy as np\n",
"import random\n",
"\n",
"rand_int = random.randint(0, len(all)-1)\n",
"\n",
"print(all[rand_int][\"sentence\"])\n",
"ipd.Audio(data=all[rand_int][\"audio\"][\"array\"], autoplay=True, rate=16000)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "5607b522",
"metadata": {
"id": "eJY7I0XAwe9p"
},
"outputs": [],
"source": [
"def prepare_dataset(batch):\n",
" audio = batch[\"audio\"]\n",
"\n",
" # batched output is \"un-batched\"\n",
" batch[\"input_values\"] = processor(audio[\"array\"], sampling_rate=audio[\"sampling_rate\"]).input_values[0]\n",
" batch[\"input_length\"] = len(batch[\"input_values\"])\n",
" \n",
" with processor.as_target_processor():\n",
" batch[\"labels\"] = processor(batch[\"sentence\"]).input_ids\n",
" return batch"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "00e34422",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 81,
"referenced_widgets": [
"c47ea368dd08403aa09b2bafdbb4b580",
"e77cf973d5824ae7b89bafd814805c2a",
"071b7647e1fe49609a48e4281a9efd0f",
"c97c00fcf2e64f18b637337f9244d748",
"9ca82fa27d1043e9ac9f10301e0b33bc",
"cc6c7e9931c140db8ba7a977c4461ce5",
"d207784bda7e4dd8858170f470ae2833",
"0800fef7de6e45d380873f974882d67e",
"926440595aa44c698588e02b86eb8c4c",
"ea2806c776384f1a90e36b72c2c17a44",
"6b72385c07134782995fcd76e675da7c",
"3653b92c9f2a408eac253e1d5153daf4",
"73ffd9b8166c4ec78ff2b62d17690327",
"6b133a1e11e44f68846ff931446559cf",
"7c98818547c84af7ba9284bc20101691",
"41b501a16b2a4f709197af5cdd5227cb",
"3b4fbe2916894e48b8f93ca63e203aca",
"c002386685c0413d8181b054d3f9d49f",
"cfb70829b5e1461abcb01872b74a194c",
"ed943db2b5274022a606ce4103d54425",
"cfb242eb549c4e66afcedefb575b4e38",
"a0313055d29f4a60837e59ac4d8a3870"
]
},
"id": "-np9xYK-wl8q",
"outputId": "573f6f67-e5b2-4977-a564-3919e7903592"
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "45634e805c76453a94ffac3f287df33f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"0ex [00:00, ?ex/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Loading cached processed dataset at /workspace/.cache/huggingface/datasets/mozilla-foundation___common_voice/cs/8.0.0/b8bc4d453193c06a43269b46cd87f075c70f152ac963b7f28f7a2760c45ec3e8/cache-fcc378c48562cf8c.arrow\n"
]
}
],
"source": [
"all = all.map(prepare_dataset, remove_columns=all.column_names)\n",
"common_voice_test = common_voice_test.map(prepare_dataset, remove_columns=common_voice_test.column_names)"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "4207ffd0",
"metadata": {
"id": "tborvC9hx88e"
},
"outputs": [],
"source": [
"import torch\n",
"\n",
"from dataclasses import dataclass, field\n",
"from typing import Any, Dict, List, Optional, Union\n",
"\n",
"@dataclass\n",
"class DataCollatorCTCWithPadding:\n",
" \"\"\"\n",
" Data collator that will dynamically pad the inputs received.\n",
" Args:\n",
" processor (:class:`~transformers.Wav2Vec2Processor`)\n",
" The processor used for proccessing the data.\n",
" padding (:obj:`bool`, :obj:`str` or :class:`~transformers.tokenization_utils_base.PaddingStrategy`, `optional`, defaults to :obj:`True`):\n",
" Select a strategy to pad the returned sequences (according to the model's padding side and padding index)\n",
" among:\n",
" * :obj:`True` or :obj:`'longest'`: Pad to the longest sequence in the batch (or no padding if only a single\n",
" sequence if provided).\n",
" * :obj:`'max_length'`: Pad to a maximum length specified with the argument :obj:`max_length` or to the\n",
" maximum acceptable input length for the model if that argument is not provided.\n",
" * :obj:`False` or :obj:`'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of\n",
" different lengths).\n",
" \"\"\"\n",
"\n",
" processor: Wav2Vec2Processor\n",
" padding: Union[bool, str] = True\n",
"\n",
" def __call__(self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> Dict[str, torch.Tensor]:\n",
" # split inputs and labels since they have to be of different lenghts and need\n",
" # different padding methods\n",
" input_features = [{\"input_values\": feature[\"input_values\"]} for feature in features]\n",
" label_features = [{\"input_ids\": feature[\"labels\"]} for feature in features]\n",
"\n",
" batch = self.processor.pad(\n",
" input_features,\n",
" padding=self.padding,\n",
" return_tensors=\"pt\",\n",
" )\n",
" with self.processor.as_target_processor():\n",
" labels_batch = self.processor.pad(\n",
" label_features,\n",
" padding=self.padding,\n",
" return_tensors=\"pt\",\n",
" )\n",
"\n",
" # replace padding with -100 to ignore loss correctly\n",
" labels = labels_batch[\"input_ids\"].masked_fill(labels_batch.attention_mask.ne(1), -100)\n",
"\n",
" batch[\"labels\"] = labels\n",
"\n",
" return batch"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "2b346d91",
"metadata": {
"id": "lbQf5GuZyQ4_"
},
"outputs": [],
"source": [
"data_collator = DataCollatorCTCWithPadding(processor=processor, padding=True)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "3afc8d2a",
"metadata": {
"id": "9Xsux2gmyXso"
},
"outputs": [],
"source": [
"from datasets import load_metric\n",
"\n",
"wer_metric = load_metric(\"wer\")\n",
"cer_metric = load_metric(\"cer\")\n",
"metrics = [wer_metric, cer_metric]"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "9119abc6",
"metadata": {
"id": "1XZ-kjweyTy_"
},
"outputs": [],
"source": [
"def compute_metrics(pred):\n",
" pred_logits = pred.predictions\n",
" pred_ids = np.argmax(pred_logits, axis=-1)\n",
"\n",
" pred.label_ids[pred.label_ids == -100] = processor.tokenizer.pad_token_id\n",
"\n",
" pred_str = processor.batch_decode(pred_ids)\n",
" # we do not want to group tokens when computing the metrics\n",
" label_str = processor.batch_decode(pred.label_ids, group_tokens=False)\n",
"\n",
" wer = wer_metric.compute(predictions=pred_str, references=label_str)\n",
" cer = cer_metric.compute(predictions=pred_str, references=label_str)\n",
"\n",
" return {\"wer\": wer, \"cer\": cer}"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "172587ca",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "e7cqAWIayn6w",
"outputId": "7a7ef020-bc8f-41e2-846c-645be598312e"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Some weights of the model checkpoint at facebook/wav2vec2-xls-r-300m were not used when initializing Wav2Vec2ForCTC: ['project_hid.bias', 'project_q.weight', 'quantizer.weight_proj.bias', 'project_hid.weight', 'quantizer.weight_proj.weight', 'project_q.bias', 'quantizer.codevectors']\n",
"- This IS expected if you are initializing Wav2Vec2ForCTC from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n",
"- This IS NOT expected if you are initializing Wav2Vec2ForCTC from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
"Some weights of Wav2Vec2ForCTC were not initialized from the model checkpoint at facebook/wav2vec2-xls-r-300m and are newly initialized: ['lm_head.weight', 'lm_head.bias']\n",
"You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n"
]
}
],
"source": [
"from transformers import Wav2Vec2ForCTC\n",
"\n",
"model = Wav2Vec2ForCTC.from_pretrained(\n",
" #\"comodoro/wav2vec2-xls-r-300m-cs-cv8\", \n",
" \"facebook/wav2vec2-xls-r-300m\", \n",
" attention_dropout=0.1,\n",
" hidden_dropout=0.2,\n",
" feat_proj_dropout=0.0,\n",
" mask_time_prob=0.1,\n",
" layerdrop=0.1,\n",
" ctc_loss_reduction=\"mean\", \n",
" pad_token_id=processor.tokenizer.pad_token_id,\n",
" vocab_size=len(processor.tokenizer),\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "94625b79",
"metadata": {
"id": "oGI8zObtZ3V0"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/workspace/.local/lib/python3.8/site-packages/transformers/models/wav2vec2/modeling_wav2vec2.py:1700: FutureWarning: The method `freeze_feature_extractor` is deprecated and will be removed in Transformers v5.Please use the equivalent `freeze_feature_encoder` method instead.\n",
" warnings.warn(\n"
]
}
],
"source": [
"model.freeze_feature_extractor()"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "9c173ad4",
"metadata": {
"id": "KbeKSV7uzGPP"
},
"outputs": [],
"source": [
"from transformers import TrainingArguments\n",
"\n",
"training_args = TrainingArguments(\n",
" output_dir=repo_name,\n",
" group_by_length=True,\n",
" per_device_train_batch_size=32,\n",
" gradient_accumulation_steps=1,\n",
" eval_accumulation_steps=1,\n",
" evaluation_strategy=\"steps\",\n",
" num_train_epochs=5,\n",
" gradient_checkpointing=True,\n",
" fp16=True,\n",
" save_steps=800,\n",
" eval_steps=800,\n",
" logging_steps=250,\n",
" learning_rate=1e-4,\n",
" warmup_steps=800,\n",
" save_total_limit=2,\n",
" report_to=\"tensorboard\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "38cc611b",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "rY7vBmFCPFgC",
"outputId": "a180bf3f-f798-4947-ff58-207d7aaab695"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using amp half precision backend\n"
]
}
],
"source": [
"from transformers import Trainer\n",
"\n",
"trainer = Trainer(\n",
" model=model,\n",
" data_collator=data_collator,\n",
" args=training_args,\n",
" compute_metrics=compute_metrics,\n",
" train_dataset=all,\n",
" eval_dataset=common_voice_test,\n",
" tokenizer=processor.feature_extractor,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "ab7b22fa",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 312
},
"id": "9fRr9TG5pGBl",
"outputId": "8bdf1d11-bca1-46af-db67-518f85586f7a"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"The following columns in the training set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"/workspace/.local/lib/python3.8/site-packages/transformers/optimization.py:306: FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use thePyTorch implementation torch.optim.AdamW instead, or set `no_deprecation_warning=True` to disable this warning\n",
" warnings.warn(\n",
"***** Running training *****\n",
" Num examples = 159605\n",
" Num Epochs = 5\n",
" Instantaneous batch size per device = 32\n",
" Total train batch size (w. parallel, distributed & accumulation) = 32\n",
" Gradient Accumulation steps = 1\n",
" Total optimization steps = 24940\n"
]
},
{
"data": {
"text/html": [
"\n",
" <div>\n",
" \n",
" <progress value='24940' max='24940' style='width:300px; height:20px; vertical-align: middle;'></progress>\n",
" [24940/24940 14:54:01, Epoch 5/5]\n",
" </div>\n",
" <table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: left;\">\n",
" <th>Step</th>\n",
" <th>Training Loss</th>\n",
" <th>Validation Loss</th>\n",
" <th>Wer</th>\n",
" <th>Cer</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>800</td>\n",
" <td>3.420300</td>\n",
" <td>3.314820</td>\n",
" <td>1.000000</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <td>1600</td>\n",
" <td>2.815100</td>\n",
" <td>0.850840</td>\n",
" <td>0.893788</td>\n",
" <td>0.234479</td>\n",
" </tr>\n",
" <tr>\n",
" <td>2400</td>\n",
" <td>0.941100</td>\n",
" <td>0.333538</td>\n",
" <td>0.372315</td>\n",
" <td>0.084735</td>\n",
" </tr>\n",
" <tr>\n",
" <td>3200</td>\n",
" <td>0.740800</td>\n",
" <td>0.257277</td>\n",
" <td>0.283963</td>\n",
" <td>0.064233</td>\n",
" </tr>\n",
" <tr>\n",
" <td>4000</td>\n",
" <td>0.651600</td>\n",
" <td>0.236474</td>\n",
" <td>0.258103</td>\n",
" <td>0.059464</td>\n",
" </tr>\n",
" <tr>\n",
" <td>4800</td>\n",
" <td>0.624200</td>\n",
" <td>0.203933</td>\n",
" <td>0.243332</td>\n",
" <td>0.054062</td>\n",
" </tr>\n",
" <tr>\n",
" <td>5600</td>\n",
" <td>0.575400</td>\n",
" <td>0.183210</td>\n",
" <td>0.215611</td>\n",
" <td>0.048234</td>\n",
" </tr>\n",
" <tr>\n",
" <td>6400</td>\n",
" <td>0.562600</td>\n",
" <td>0.182699</td>\n",
" <td>0.209116</td>\n",
" <td>0.046281</td>\n",
" </tr>\n",
" <tr>\n",
" <td>7200</td>\n",
" <td>0.534200</td>\n",
" <td>0.174398</td>\n",
" <td>0.203315</td>\n",
" <td>0.046776</td>\n",
" </tr>\n",
" <tr>\n",
" <td>8000</td>\n",
" <td>0.496500</td>\n",
" <td>0.170528</td>\n",
" <td>0.196285</td>\n",
" <td>0.044429</td>\n",
" </tr>\n",
" <tr>\n",
" <td>8800</td>\n",
" <td>0.504700</td>\n",
" <td>0.160374</td>\n",
" <td>0.188880</td>\n",
" <td>0.042167</td>\n",
" </tr>\n",
" <tr>\n",
" <td>9600</td>\n",
" <td>0.481400</td>\n",
" <td>0.160427</td>\n",
" <td>0.182742</td>\n",
" <td>0.041052</td>\n",
" </tr>\n",
" <tr>\n",
" <td>10400</td>\n",
" <td>0.447100</td>\n",
" <td>0.156585</td>\n",
" <td>0.182207</td>\n",
" <td>0.040592</td>\n",
" </tr>\n",
" <tr>\n",
" <td>11200</td>\n",
" <td>0.450900</td>\n",
" <td>0.161888</td>\n",
" <td>0.185296</td>\n",
" <td>0.043243</td>\n",
" </tr>\n",
" <tr>\n",
" <td>12000</td>\n",
" <td>0.441500</td>\n",
" <td>0.151254</td>\n",
" <td>0.176386</td>\n",
" <td>0.039725</td>\n",
" </tr>\n",
" <tr>\n",
" <td>12800</td>\n",
" <td>0.431300</td>\n",
" <td>0.151478</td>\n",
" <td>0.173930</td>\n",
" <td>0.039213</td>\n",
" </tr>\n",
" <tr>\n",
" <td>13600</td>\n",
" <td>0.416300</td>\n",
" <td>0.144519</td>\n",
" <td>0.169515</td>\n",
" <td>0.037672</td>\n",
" </tr>\n",
" <tr>\n",
" <td>14400</td>\n",
" <td>0.414200</td>\n",
" <td>0.147759</td>\n",
" <td>0.169871</td>\n",
" <td>0.038473</td>\n",
" </tr>\n",
" <tr>\n",
" <td>15200</td>\n",
" <td>0.418400</td>\n",
" <td>0.143047</td>\n",
" <td>0.166921</td>\n",
" <td>0.037583</td>\n",
" </tr>\n",
" <tr>\n",
" <td>16000</td>\n",
" <td>0.388600</td>\n",
" <td>0.143273</td>\n",
" <td>0.164426</td>\n",
" <td>0.037388</td>\n",
" </tr>\n",
" <tr>\n",
" <td>16800</td>\n",
" <td>0.379500</td>\n",
" <td>0.142606</td>\n",
" <td>0.164822</td>\n",
" <td>0.037258</td>\n",
" </tr>\n",
" <tr>\n",
" <td>17600</td>\n",
" <td>0.385900</td>\n",
" <td>0.135660</td>\n",
" <td>0.160446</td>\n",
" <td>0.036143</td>\n",
" </tr>\n",
" <tr>\n",
" <td>18400</td>\n",
" <td>0.376200</td>\n",
" <td>0.134396</td>\n",
" <td>0.155832</td>\n",
" <td>0.034930</td>\n",
" </tr>\n",
" <tr>\n",
" <td>19200</td>\n",
" <td>0.384000</td>\n",
" <td>0.137933</td>\n",
" <td>0.157595</td>\n",
" <td>0.035875</td>\n",
" </tr>\n",
" <tr>\n",
" <td>20000</td>\n",
" <td>0.376200</td>\n",
" <td>0.134363</td>\n",
" <td>0.153892</td>\n",
" <td>0.034552</td>\n",
" </tr>\n",
" <tr>\n",
" <td>20800</td>\n",
" <td>0.355900</td>\n",
" <td>0.133945</td>\n",
" <td>0.152526</td>\n",
" <td>0.035080</td>\n",
" </tr>\n",
" <tr>\n",
" <td>21600</td>\n",
" <td>0.368300</td>\n",
" <td>0.131489</td>\n",
" <td>0.151753</td>\n",
" <td>0.034226</td>\n",
" </tr>\n",
" <tr>\n",
" <td>22400</td>\n",
" <td>0.357200</td>\n",
" <td>0.130721</td>\n",
" <td>0.150664</td>\n",
" <td>0.034154</td>\n",
" </tr>\n",
" <tr>\n",
" <td>23200</td>\n",
" <td>0.349400</td>\n",
" <td>0.129449</td>\n",
" <td>0.149100</td>\n",
" <td>0.033476</td>\n",
" </tr>\n",
" <tr>\n",
" <td>24000</td>\n",
" <td>0.347600</td>\n",
" <td>0.128731</td>\n",
" <td>0.149120</td>\n",
" <td>0.033597</td>\n",
" </tr>\n",
" <tr>\n",
" <td>24800</td>\n",
" <td>0.347500</td>\n",
" <td>0.127098</td>\n",
" <td>0.147457</td>\n",
" <td>0.032896</td>\n",
" </tr>\n",
" </tbody>\n",
"</table><p>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-800\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-800/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-800/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-800/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-30400] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-1600\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-1600/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-1600/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-1600/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-31200] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-2400\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-2400/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-2400/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-2400/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-800] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-3200\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-3200/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-3200/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-3200/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-1600] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-4000\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-4000/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-4000/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-4000/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-2400] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-4800\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-4800/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-4800/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-4800/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-3200] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-5600\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-5600/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-5600/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-5600/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-4000] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-6400\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-6400/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-6400/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-6400/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-4800] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-7200\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-7200/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-7200/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-7200/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-5600] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-8000\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-8000/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-8000/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-8000/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-6400] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-8800\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-8800/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-8800/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-8800/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-7200] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-9600\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-9600/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-9600/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-9600/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-8000] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-10400\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-10400/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-10400/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-10400/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-8800] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-11200\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-11200/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-11200/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-11200/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-9600] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-12000\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-12000/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-12000/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-12000/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-10400] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-12800\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-12800/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-12800/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-12800/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-11200] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-13600\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-13600/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-13600/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-13600/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-12000] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-14400\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-14400/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-14400/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-14400/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-12800] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-15200\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-15200/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-15200/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-15200/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-13600] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-16000\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-16000/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-16000/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-16000/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-14400] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-16800\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-16800/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-16800/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-16800/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-15200] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-17600\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-17600/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-17600/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-17600/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-16000] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-18400\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-18400/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-18400/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-18400/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-16800] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-19200\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-19200/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-19200/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-19200/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-17600] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-20000\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-20000/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-20000/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-20000/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-18400] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-20800\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-20800/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-20800/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-20800/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-19200] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-21600\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-21600/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-21600/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-21600/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-20000] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-22400\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-22400/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-22400/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-22400/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-20800] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-23200\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-23200/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-23200/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-23200/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-21600] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-24000\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-24000/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-24000/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-24000/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-22400] due to args.save_total_limit\n",
"The following columns in the evaluation set don't have a corresponding argument in `Wav2Vec2ForCTC.forward` and have been ignored: input_length.\n",
"***** Running Evaluation *****\n",
" Num examples = 7267\n",
" Batch size = 8\n",
"Saving model checkpoint to wav2vec2-xls-r-300m-cs-250/checkpoint-24800\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-24800/config.json\n",
"Model weights saved in wav2vec2-xls-r-300m-cs-250/checkpoint-24800/pytorch_model.bin\n",
"Configuration saved in wav2vec2-xls-r-300m-cs-250/checkpoint-24800/preprocessor_config.json\n",
"Deleting older checkpoint [wav2vec2-xls-r-300m-cs-250/checkpoint-23200] due to args.save_total_limit\n",
"\n",
"\n",
"Training completed. Do not forget to share your model on huggingface.co/models =)\n",
"\n",
"\n"
]
},
{
"data": {
"text/plain": [
"TrainOutput(global_step=24940, training_loss=0.7262697845434511, metrics={'train_runtime': 53649.1292, 'train_samples_per_second': 14.875, 'train_steps_per_second': 0.465, 'total_flos': 1.1982083586402645e+20, 'train_loss': 0.7262697845434511, 'epoch': 5.0})"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"trainer.train()"
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "6610bd0a",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Dropping the following result as it does not have all the necessary fields:\n",
"{}\n"
]
}
],
"source": [
"trainer.create_model_card()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "ec5a5334",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Configuration saved in ./config.json\n",
"Model weights saved in ./pytorch_model.bin\n"
]
}
],
"source": [
"model.save_pretrained('.')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8d3d92c1",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}