AI SeedbankHelp preserve open and free AI for humanity's future

← All models

gagan3012_wav2vec2-xlsr-nepali

gagan3012 · View on Hugging Face ↗

Get this model

Download TorrentMagnet Link

Seeders: · Leechers:

Model card

The complete upstream card, rendered from this payload's README.md — the same hash-verified bytes the torrent distributes. Images and off-site links are removed; the original card on Hugging Face carries them.


language: ne datasets:

  • OpenSLR
  • common_voice metrics:
  • wer tags:
  • audio
  • automatic-speech-recognition
  • speech
  • xlsr-fine-tuning-week license: apache-2.0 model-index:
  • name: wav2vec2-xlsr-nepali results:
    • task: name: Speech Recognition type: automatic-speech-recognition dataset: name: OpenSLR ne type: OpenSLR args: ne metrics:
      • name: Test WER type: wer value: 05.97

Wav2Vec2-Large-XLSR-53-Nepali

Fine-tuned facebook/wav2vec2-large-xlsr-53 on Nepali using the Common Voice, and OpenSLR ne.

When using this model, make sure that your speech input is sampled at 16kHz.

Usage

The model can be used directly (without a language model) as follows:

import torch
import torchaudio
from datasets import load_dataset
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor

!wget https://www.openslr.org/resources/43/ne_np_female.zip
!unzip ne_np_female.zip
!ls ne_np_female

colnames=['path','sentence'] 
df  = pd.read_csv('/content/ne_np_female/line_index.tsv',sep='\\t',header=None,names = colnames)
df['path'] = '/content/ne_np_female/wavs/'+df['path'] +'.wav'

train, test = train_test_split(df, test_size=0.1)

test.to_csv('/content/ne_np_female/line_index_test.csv')

test_dataset = load_dataset('csv', data_files='/content/ne_np_female/line_index_test.csv',split = 'train')

processor = Wav2Vec2Processor.from_pretrained("gagan3012/wav2vec2-xlsr-nepali")
model = Wav2Vec2ForCTC.from_pretrained("gagan3012/wav2vec2-xlsr-nepali") 

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):
\tspeech_array, sampling_rate = torchaudio.load(batch["path"])
\tbatch["speech"] = resampler(speech_array).squeeze().numpy()
\treturn batch

test_dataset = test_dataset.map(speech_file_to_array_fn)
inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True)

with torch.no_grad():
\tlogits = 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["sentence"][:2])

Result

Prediction: ['पारानाको ब्राजिली राज्यमा रहेको राजधानी', 'देवराज जोशी त्रिभुवन विश्वविद्यालयबाट शिक्षाशास्त्रमा स्नातक हुनुहुन्छ']

Reference: ['पारानाको ब्राजिली राज्यमा रहेको राजधानी', 'देवराज जोशी त्रिभुवन विश्वविद्यालयबाट शिक्षाशास्त्रमा स्नातक हुनुहुन्छ']

Evaluation

The model can be evaluated as follows on the {language} test data of Common Voice. # TODO: replace #TODO: replace language with your {language}, e.g. French

import torch
import torchaudio
from datasets import load_dataset, load_metric
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
import re

!wget https://www.openslr.org/resources/43/ne_np_female.zip
!unzip ne_np_female.zip
!ls ne_np_female

colnames=['path','sentence'] 
df  = pd.read_csv('/content/ne_np_female/line_index.tsv',sep='\\t',header=None,names = colnames)
df['path'] = '/content/ne_np_female/wavs/'+df['path'] +'.wav'

train, test = train_test_split(df, test_size=0.1)

test.to_csv('/content/ne_np_female/line_index_test.csv')

test_dataset = load_dataset('csv', data_files='/content/ne_np_female/line_index_test.csv',split = 'train')
wer = load_metric("wer")

processor = Wav2Vec2Processor.from_pretrained("gagan3012/wav2vec2-xlsr-nepali")
model = Wav2Vec2ForCTC.from_pretrained("gagan3012/wav2vec2-xlsr-nepali") 
model.to("cuda")

chars_to_ignore_regex = '[\\,\\?\\.\\!\\-\\;\\:\\"\\“]'  
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):
\tbatch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower()
\tspeech_array, sampling_rate = torchaudio.load(batch["path"])
\tbatch["speech"] = resampler(speech_array).squeeze().numpy()
\treturn batch

test_dataset = test_dataset.map(speech_file_to_array_fn)

# Preprocessing the datasets.
# We need to read the aduio files as arrays
def evaluate(batch):
\tinputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)

\twith torch.no_grad():
\t\tlogits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits

\tpred_ids = torch.argmax(logits, dim=-1)
\tbatch["pred_strings"] = processor.batch_decode(pred_ids)
\treturn batch

result = test_dataset.map(evaluate, batched=True, batch_size=8)

print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"])))

Test Result: 05.97 %

Training

The script used for training can be found here

Magnet link

Opens the swarm directly in your torrent client — no file download needed. Copy-paste works too:

magnet:?xt=urn:btih:30a88a4704fcdcd4a6644b5c6a215407cb882447&dn=gagan3012_wav2vec2-xlsr-nepali

Open magnet in torrent client · infohash 30a88a4704fcdcd4a6644b5c6a215407cb882447

Files & hashes

PathSizesha1sha256
README.md5.3 KB (5,446 B)184de84fdd501829768b88df20b00ddd600aa834e5ec5a362b0da5a7ec2207cafae8d527e4987c9f6d9e8b53434f1cb5704de6fd
config.json1.5 KB (1,558 B)a8c8211f9134187d2e3515ad8cd36ca4739ff5210c2f9c2889645d13c75b15971ee55ebdec45e780f06db8ef2fd43be3d0cc2e30
optimizer.pt2.32 GB (2,490,610,183 B)fb06c5d36db6e8ce0da6f71d5105009f9b62e5cd635fa64b04534d3fdbfeb0eb056f666a4dc3b69da6b382d04bdebd3c6de38551
preprocessor_config.json158 B (158 B)0886a48276922a77013d8aa4681192138ae90d90c403ce09975b90dff0dd8302c42d422e9de1f166cd7772df23490069893cb0cf
pytorch_model.bin1.18 GB (1,262,200,343 B)dd7a9f4471f146fa6777da832bbf6e269290aee33c1ab6f51758354bce94b889b1117f9a4711fa401a7df791dd81f53366d065b0
scheduler.pt623 B (623 B)de36ab91baac9b7190285aded558f3fabf2a628587f9bbfc662da8015ef424c22600dffce065acb238f887c429fc16defbe58a59
special_tokens_map.json85 B (85 B)9abf71998c3e0de2f13c0fd73ed81477c9dae11850eb73d51191696209d30d42d6ede50e57e7a542ca1db12df714b2c0aa3da8e2
tokenizer_config.json138 B (138 B)a2a8340e0a162e4e223867107d9db359f5697c1d3160c256a4d10e1fc5133a2d318e63406cc382b957563198931c8a90f9b9242d
trainer_state.json3.2 KB (3,274 B)ab19d062f597af3dc05bf5c1640de47c5842430b0deff8c50baa871ace3065ea948e706cd19c97b971d7e054846706ac646697e0
training_args.bin2.2 KB (2,287 B)18250782f4a1d4f99d004c8fa991cc0c6503224897af1403a94c748408eb00b9167fb9e8bade995019b4f065370a98b26f3a6c42
vocab.json707 B (707 B)fe4fc85d84e246a705358888a127d24dde44de7fda6b3a4dd2d7bee2c4b8b85d1a3e748e008dbc8613d41ac7451d24dc7c021b3d

Cite this release

Canonical URL
https://aiseedbank.org/models/gagan3012_wav2vec2-xlsr-nepali/
Slug
gagan3012_wav2vec2-xlsr-nepali
Infohash
30a88a4704fcdcd4a6644b5c6a215407cb882447
License
apache-2.0
Signing key fingerprint
85a3b32c3712427b

Every file carries a locally computed sha256 — verify a download against the signed sums: gagan3012_wav2vec2-xlsr-nepali.SHA256SUMS (+ minisign signature).

Provenance

Upstream repositorygagan3012/wav2vec2-xlsr-nepali
Revision (pinned)d1dc1c34a3f2387d00d4bfe351e940cb7c06fb80
Fetched at2026-09-03T23:03:33Z
License at fetchapache-2.0
Snapshot toolhuggingface · seedbank 0.1.0

Trackers

✓ verified · rehash-vs-hf-metadata at 2026-09-03T23:04:11Z

apache-2.03.50 GB (3,752,824,802 bytes)transformerspytorchjaxwav2vec2automatic-speech-recognitionaudiospeechxlsr-fine-tuning-weekmodel-indexendpoints_compatible1 language (ne)