{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!pip3 install pandas\n", "!pip3 install numpy" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/ba-anandhus/Documents/fine tuning/fine/lib/python3.8/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "import pandas as pd\n", "import librosa\n", "from scipy.io import wavfile\n", "from transformers import Wav2Vec2ForCTC, Wav2Vec2Tokenizer, Wav2Vec2CTCTokenizer\n", "import numpy\n", "import torch\n", "import processor\n" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "The tokenizer class you load from this checkpoint is not the same type as the class this function is called from. It may result in unexpected tokenization. \n", "The tokenizer class you load from this checkpoint is 'Wav2Vec2CTCTokenizer'. \n", "The class this function is called from is 'Wav2Vec2Tokenizer'.\n", "/home/ba-anandhus/Documents/fine tuning/fine/lib/python3.8/site-packages/transformers/models/wav2vec2/tokenization_wav2vec2.py:421: FutureWarning: The class `Wav2Vec2Tokenizer` is deprecated and will be removed in version 5 of Transformers. Please use `Wav2Vec2Processor` or `Wav2Vec2CTCTokenizer` instead.\n", " warnings.warn(\n" ] } ], "source": [ "# tokenizer = Wav2Vec2CTCTokenizer(\"./vocab.json\", unk_token=\"[UNK]\", pad_token=\"[PAD]\", word_delimiter_token=\"|\")\n", "tokenizer = Wav2Vec2Tokenizer.from_pretrained(\"facebook/wav2vec2-base-960h\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "#reading the custom dataset\n", "data = pd.read_csv('Dataset_voice_to_text.csv')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Number Filename Text\n", "0 1 audiofile1.wav good morning everyone\n", "1 2 audiofile2.wav it is always nice to meet you in a fresh mood\n", "2 3 audiofile3.wav this is the custom dataset which is used to tr...\n", "3 4 audiofile4.wav this consist of test train and validation data...\n", "4 5 audiofile5.wav train data is used to train the deep learning ...\n" ] } ], "source": [ "print(data.head())" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | Filename | \n", "Text | \n", "
---|---|---|
0 | \n", "audiofile1.wav | \n", "good morning everyone | \n", "
1 | \n", "audiofile2.wav | \n", "it is always nice to meet you in a fresh mood | \n", "
2 | \n", "audiofile3.wav | \n", "this is the custom dataset which is used to tr... | \n", "
3 | \n", "audiofile4.wav | \n", "this consist of test train and validation data... | \n", "
4 | \n", "audiofile5.wav | \n", "train data is used to train the deep learning ... | \n", "