miner-fixes
This guide will help you set up and test the audio processing Bittensor subnet with transcription, TTS, and summarization capabilities.
# Install minimal dependencies for transcription testing
pip install -r requirements_minimal.txt# Install all dependencies including TTS and summarization
pip install -r requirements.txt# Test the transcription pipeline with Whisper tiny
python test_transcription_simple.pyExpected output:
🎵 Testing Audio Transcription Pipeline (Simple Version)
============================================================
Initializing transcription pipeline...
Creating test audio...
Testing transcription...
✅ Transcription successful!
📝 Transcribed text: 'You'
⏱️ Processing time: 1.15s
⏱️ Total time (including model loading): 1.15s
🔧 Model used: openai/whisper-tiny
🎉 All tests passed! The transcription pipeline is working correctly.
- Python: 3.8 or higher
- GPU: Optional but recommended for faster processing
- RAM: Minimum 8GB, recommended 16GB+
- Storage: At least 5GB free space for models
git clone <repository-url>
cd bittensor-subnet-template# Using conda
conda create -n audio-subnet python=3.9
conda activate audio-subnet
# Or using venv
python -m venv audio-subnet
source audio-subnet/bin/activate # On Windows: audio-subnet\Scripts\activate# For CUDA 11.8
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
# For CPU only
pip install torch torchvision torchaudio# Core dependencies
pip install transformers>=4.30.0
pip install librosa>=0.10.0
pip install soundfile>=0.12.0
pip install numpy>=1.20.0
pip install scipy>=1.10.0pip install TTS>=0.20.0pip install bittensor>=5.0.0python test_transcription_simple.pypython -c "
from template.pipelines import TTS_AVAILABLE
if TTS_AVAILABLE:
print('✅ TTS pipeline is available')
else:
print('❌ TTS pipeline not available - install with: pip install TTS')
"python -c "
from template.pipelines import SUMMARIZATION_AVAILABLE
if SUMMARIZATION_AVAILABLE:
print('✅ Summarization pipeline is available')
else:
print('❌ Summarization pipeline not available - install with: pip install transformers')
"The transcription pipeline uses Whisper Tiny model for fast processing:
from template.pipelines.transcription_pipeline import TranscriptionPipeline
# Initialize pipeline
pipeline = TranscriptionPipeline("openai/whisper-tiny")
# Test with audio bytes
audio_bytes = create_test_audio() # Your audio data
transcribed_text, processing_time = pipeline.transcribe(audio_bytes, language="en")
print(f"Transcribed: {transcribed_text}")
print(f"Time: {processing_time:.2f}s")from template.pipelines.tts_pipeline import TTSPipeline
# Initialize pipeline
pipeline = TTSPipeline("tts_models/en/ljspeech/tacotron2-DDC")
# Test synthesis
text = "Hello, this is a test for text to speech synthesis."
audio_bytes, processing_time = pipeline.synthesize(text, language="en")
print(f"Audio generated in {processing_time:.2f}s")from template.pipelines.summarization_pipeline import SummarizationPipeline
# Initialize pipeline
pipeline = SummarizationPipeline("facebook/bart-large-cnn")
# Test summarization
text = "Your long text here..."
summary, processing_time = pipeline.summarize(text, language="en")
print(f"Summary: {summary}")
print(f"Time: {processing_time:.2f}s")# Basic miner
python neurons/miner.py
# With custom configuration
python neurons/miner.py --config path/to/config.yaml# Basic validator
python neurons/validator.py
# With custom configuration
python neurons/validator.py --config path/to/config.yamlneuron:
sample_size: 5
min_stake: 1000
# Model configurations
transcription_model: "openai/whisper-tiny"
tts_model: "tts_models/en/ljspeech/tacotron2-DDC"
summarization_model: "facebook/bart-large-cnn"neuron:
sample_size: 5 # Top 5 miners
max_acceptable_time: 10.0
# Reward weights
speed_weight: 0.4
accuracy_weight: 0.4
stake_weight: 0.2ModuleNotFoundError: No module named 'TTS'
Solution: Install TTS package
pip install TTS>=0.20.0RuntimeError: CUDA out of memory
Solution: Use smaller models or CPU
# Use CPU instead of GPU
pipeline = TranscriptionPipeline("openai/whisper-tiny")
pipeline.device = "cpu"ConnectionError: Failed to download model
Solution: Check internet connection or use offline models
# Set HuggingFace cache directory
export HF_HOME=/path/to/cachelibrosa.util.exceptions.ParameterError
Solution: Ensure audio format is supported
# Convert audio to supported format
import librosa
audio, sr = librosa.load("audio.wav", sr=16000)# Install CUDA version of PyTorch
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118# Set cache directory
export HF_HOME=/path/to/cache
export TORCH_HOME=/path/to/cache# Use smaller models for faster processing
pipeline = TranscriptionPipeline("openai/whisper-tiny") # 39MB vs 1.5GB for large- Model Size: 39MB
- Processing Speed: 1-3 seconds for 30-second audio
- Memory Usage: ~2GB RAM
- Accuracy: ~90%+ on clear speech
- Model Size: 50MB
- Processing Speed: 2-5 seconds for 100 words
- Memory Usage: ~3GB RAM
- Quality: High-quality speech synthesis
- Model Size: 400MB
- Processing Speed: 1-2 seconds for 500 words
- Memory Usage: ~4GB RAM
- Quality: High-quality summaries
| Language | Code | Transcription | TTS | Summarization |
|---|---|---|---|---|
| English | en | ✅ | ✅ | ✅ |
| Spanish | es | ✅ | ✅ | ✅ |
| French | fr | ✅ | ✅ | ✅ |
| German | de | ✅ | ✅ | ✅ |
| Italian | it | ✅ | ✅ | ✅ |
| Portuguese | pt | ✅ | ✅ | ✅ |
| Russian | ru | ✅ | ✅ | ✅ |
| Japanese | ja | ✅ | ✅ | ✅ |
| Korean | ko | ✅ | ✅ | ✅ |
| Chinese | zh | ✅ | ✅ | ✅ |
- Issues: Report bugs on GitHub
- Discord: Join Bittensor Discord for community support
- Documentation: Check AUDIO_SUBNET_README.md for detailed information