Instructions to use harpertoken/talk with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use harpertoken/talk with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("automatic-speech-recognition", model="harpertoken/talk")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq processor = AutoProcessor.from_pretrained("harpertoken/talk") model = AutoModelForSpeechSeq2Seq.from_pretrained("harpertoken/talk", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123---license: mitlanguage:- endatasets:- facebook/multilingual_librispeechmetrics:- characterbase_model:- openai/whisper-small- facebook/wav2vec2-base-960hpipeline_tag: automatic-speech-recognitionlibrary_name: transformerstags:- code- audio- speech-recognition- whisper- wav2vec2- pytorch---> **Renamed:** previously `harpertoken/harpertokenASR`. The old ID still redirects.# Speech Recognition AI: Fine-Tuned Whisper and Wav2Vec2 for Real-Time AudioThis project fine-tunes OpenAI's Whisper (`whisper-small`) and Facebook's Wav2Vec2 (`wav2vec2-base-960h`) models for real-time speech recognition using live audio recordings. It’s designed for dynamic environments where low-latency transcription is key, such as live conversations or streaming audio.## Model DescriptionFine-tuned Whisper and Wav2Vec2 models for real-time speech recognition on live audio.## Features- **Real-time audio recording**: Captures live 16kHz mono audio via microphone input.- **Continuous fine-tuning**: Updates model weights incrementally during live sessions.- **Speech-to-text transcription**: Converts audio to text with high accuracy.- **Model saving/loading**: Automatically saves fine-tuned models with timestamps.- **Dual model support**: Choose between Whisper and Wav2Vec2 architectures.## Usage### Start Fine-TuningFine-tune the model on live audio:```bash# For Whisper modelpython main.py --model_type whisper# For Wav2Vec2 modelpython main.py --model_type wav2vec2```Records audio in real-time and updates the model continuously. Press Ctrl+C to stop training and save the model automatically.### TranscriptionTest the fine-tuned model:```bash# For Whisper modelpython test_transcription.py --model_type whisper# For Wav2Vec2 modelpython test_transcription.py --model_type wav2vec2```Records 5 seconds of audio (configurable in code) and generates a transcription.### Model StorageModels are saved by default to:```models/speech_recognition_ai_fine_tune_[model_type]_[timestamp]```Example: `models/speech_recognition_ai_fine_tune_whisper_20250225`To customize the save path:```bashexport MODEL_SAVE_PATH="/your/custom/path"python main.py --model_type [whisper|wav2vec2]```## Requirements- Python 3.8+- PyTorch (torch==2.0.1 recommended)- Transformers (transformers==4.35.0 recommended)- Sounddevice (sounddevice==0.4.6)- Torchaudio (torchaudio==2.0.1)A GPU is recommended for faster fine-tuning. See `requirements.txt` for the full list.## Model Details- **Task**: Automatic Speech Recognition (ASR)- **Base Models**:- Whisper: openai/whisper-small- Wav2Vec2: facebook/wav2vec2-base-960h- **Fine-tuning**: Trained on live 16kHz mono audio recordings with a batch size of 8, using the Adam optimizer (learning rate 1e-5).- **Input**: 16kHz mono audio- **Output**: Text transcription- **Language**: English## Loading the Model (Hugging Face)To load the models from Hugging Face:```pythonfrom transformers import WhisperForConditionalGeneration, WhisperProcessormodel = WhisperForConditionalGeneration.from_pretrained("harpertoken/harpertokenASR")processor = WhisperProcessor.from_pretrained("harpertoken/harpertokenASR")```## Repository Structure```speech-model/├── dataset.py # Audio recording and preprocessing├── train.py # Training pipeline├── test_transcription.py # Transcription testing├── main.py # Main script for fine-tuning├── README.md # This file└── requirements.txt # Dependencies```## Training DataThe models are fine-tuned on live audio recordings collected during runtime. No pre-existing dataset is required—users generate their own data via microphone input.## Evaluation ResultsFuture updates will include WER (Word Error Rate) metrics compared to base models.## LicenseLicensed under the MIT License.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051---license: mitlanguage: enlibrary_name: transformerspipeline_tag: automatic-speech-recognitionbase_model: openai/whisper-smalltags:- asr- speech-recognition- whisper- audio---> Previously published as `harpertoken/harpertokenASR`. The old identifier still redirects here.# talkA `whisper-small` encoder-decoder, fine-tuned on short passages of live microphone audio, for English speech recognition at 16 kHz mono. The weights are float32 and occupy roughly 967 MB.Two corrections to the previous version of this card, both of which pointed at the wrong model. The metadata claimed a Wav2Vec2 lineage — `facebook/wav2vec2-base-960h` as a base model, and `facebook/multilingual_librispeech` as the training set. Neither is true of the published checkpoint: `config.json` records `_name_or_path: openai/whisper-small` with `WhisperForConditionalGeneration`, and the documented training signal was live recordings, not a fixed corpus. The earlier card also described `main.py`, `train.py`, `test_transcription.py` and a `requirements.txt`; none of those files have ever been in this repository, so the instructions it gave could not be followed.The repository is incomplete for standalone use. It contains no tokenizer and no `preprocessor_config.json`, both of which Whisper requires, so the `WhisperProcessor.from_pretrained` call the old card documented fails. Load the processor from `openai/whisper-small` instead, which is the same normalisation and vocabulary the checkpoint was trained against. `training_log.pt` in the repository root is 761 bytes of leftover debug state and can be ignored. `pytorch_model.bin` duplicates `model.safetensors`.## Usage```pythonimport torchfrom transformers import WhisperForConditionalGeneration, WhisperProcessor, pipelinemodel = WhisperForConditionalGeneration.from_pretrained("harpertoken/talk")processor = WhisperProcessor.from_pretrained("openai/whisper-small") # not in this repotranscriber = pipeline("automatic-speech-recognition",model=model,tokenizer=processor.tokenizer,feature_extractor=processor.feature_extractor,torch_dtype=torch.float32,)audio = (0, 16000) # replace with 16 kHz mono float32 samplesprint(transcriber(audio, return_timestamps=True))```## LimitationsThe fine-tuning corpus is a small quantity of live microphone audio — one room, one machine, likely one speaker — so this should be read as an adaptation of `whisper-small` rather than an independent model. I have no transcription accuracy measurement for it: the card this replaces listed a character error rate with no evaluation behind it, and that has been removed. Expect degradation on accents, noisy rooms, far-field audio and any language other than English. If you need a dependable transcriber, start from `openai/whisper-small`, whose published WER figures you can actually check.## AttributionWhisper follows Radford et al., *Robust Speech Recognition via Large-Scale Weak Supervision* (2022).
README.md+28-100