Spaces:
Running
Running
File size: 7,086 Bytes
ab4e093 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
---
title: Multi-Modal Knowledge Distillation
emoji: ๐ง
colorFrom: blue
colorTo: purple
sdk: docker
app_file: app.py
pinned: false
license: mit
short_description: Multi-Modal Knowledge Distillation for AI models
tags:
- machine-learning
- knowledge-distillation
- multi-modal
- pytorch
- transformers
- computer-vision
- nlp
suggested_hardware: t4-small
suggested_storage: medium
---
# Multi-Modal Knowledge Distillation
Create new AI models through knowledge distillation from multiple pre-trained models across different modalities (text, vision, audio, and multimodal).
## Features
- **Multi-Modal Support**: Distill knowledge from text, vision, audio, and multimodal models
- **Multiple Input Sources**: Upload local files, use Hugging Face repositories, or direct URLs
- **Real-Time Monitoring**: Live progress tracking with WebSocket updates
- **Flexible Configuration**: Customizable student model architecture and training parameters
- **Production Ready**: Built with FastAPI, comprehensive error handling, and security measures
- **Responsive UI**: Modern, mobile-friendly web interface
- **Multiple Formats**: Support for PyTorch (.pt, .pth, .bin), Safetensors, and Hugging Face models
## ๐ New Advanced Features
### ๐ง System Optimization
- **Memory Management**: Advanced memory management for 16GB RAM systems
- **CPU Optimization**: Optimized for CPU-only training environments
- **Chunk Loading**: Progressive loading for large models
- **Performance Monitoring**: Real-time system performance tracking
### ๐ Token Management
- **Secure Storage**: Encrypted storage of Hugging Face tokens
- **Multiple Token Types**: Support for read, write, and fine-grained tokens
- **Auto Validation**: Automatic token validation and recommendations
- **Usage Tracking**: Monitor token usage and access patterns
### ๐ฅ Medical AI Support
- **Medical Datasets**: Specialized medical datasets (ROCOv2, CT-RATE, UMIE)
- **DICOM Processing**: Advanced DICOM file processing and visualization
- **Medical Preprocessing**: Specialized preprocessing for medical images
- **Modality Support**: CT, MRI, X-ray, and ultrasound image processing
### ๐ Enhanced Model Support
- **Google Models**: Direct access to Google's open-source models
- **Streaming Datasets**: Memory-efficient dataset streaming
- **Progressive Training**: Incremental model training capabilities
- **Arabic Documentation**: Full Arabic language support
## How to Use
1. **Select Teacher Models**: Choose 1-10 pre-trained models as teachers
- Upload local model files (.pt, .pth, .bin, .safetensors)
- Enter Hugging Face repository names (format: organization/model-name)
- Provide direct download URLs to model files
- For private/gated models: Add your HF token in Space settings
2. **Configure Training**: Set up training parameters
- Student model architecture (hidden size, layers)
- Training parameters (steps, learning rate, temperature)
- Distillation strategy (ensemble, weighted, sequential)
3. **Monitor Training**: Watch real-time progress
- Live progress bar and metrics
- Training console output
- Download trained model when complete
## Setup for Private/Gated Models
To access private or gated Hugging Face models:
1. **Get your Hugging Face token**:
- Go to [https://huggingface.co/settings/tokens](https://huggingface.co/settings/tokens)
- Create a new token with "Read" permissions
2. **Add token to Hugging Face Space**:
- Go to your Space settings
- Add a new secret: `HF_TOKEN` = `your_token_here`
- Restart your Space
3. **Alternative**: Enter token in the interface
- Use the "Hugging Face Token" field in the web interface
- This is temporary and only for the current session
## Supported Formats
- **PyTorch**: .pt, .pth, .bin files
- **Safetensors**: .safetensors files
- **Hugging Face**: Any public repository
- **Direct URLs**: Publicly accessible model files
## Supported Modalities
- **Text**: BERT, GPT, RoBERTa, T5, DistilBERT, etc.
- **Vision**: ViT, ResNet, EfficientNet, SigLIP, etc.
- **Multimodal**: CLIP, BLIP, ALBEF, etc.
- **Audio**: Wav2Vec2, Whisper, etc.
- **Specialized**: Background removal (RMBG), Medical imaging (MedSigLIP), etc.
## Troubleshooting Common Models
### SigLIP Models (e.g., google/siglip-base-patch16-224)
- These models may require "Trust Remote Code" to be enabled
- Use the "Test Model" button to verify compatibility before training
### Custom Architecture Models
- Some models use custom code that requires "Trust Remote Code"
- Always test models before starting training
- Check model documentation on Hugging Face for requirements
### Gemma Models (e.g., google/gemma-2b, google/gemma-3-27b-it)
- **Requires**: Hugging Face token AND access permission
- **Steps**:
1. Request access at the model page on Hugging Face
2. Add your HF token in Space settings or interface
3. Enable "Trust Remote Code" if needed
- **Note**: Gemma 3 models require latest transformers version
## Technical Details
- **Backend**: FastAPI with async support
- **ML Framework**: PyTorch with Transformers
- **Frontend**: Responsive HTML/CSS/JavaScript
- **Real-time Updates**: WebSocket communication
- **Security**: File validation, input sanitization, resource limits
## ๐ Quick Start (Optimized)
### Option 1: Standard Run
```bash
python app.py
```
### Option 2: Optimized Run (Recommended)
```bash
python run_optimized.py
```
The optimized runner provides:
- โ
Automatic CPU optimization
- โ
Memory management setup
- โ
System requirements check
- โ
Performance recommendations
- โ
Enhanced logging
### Option 3: Docker (Coming Soon)
```bash
docker run -p 8000:8000 ai-knowledge-distillation
```
## ๐ง Advanced Configuration
### Environment Variables
```bash
# Memory optimization
export OMP_NUM_THREADS=8
export MKL_NUM_THREADS=8
export PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128
# Cache directories
export HF_DATASETS_CACHE=./cache/datasets
export TRANSFORMERS_CACHE=./cache/transformers
# Token management
export HF_TOKEN=your_token_here
```
### System Requirements
#### Minimum Requirements
- Python 3.9+
- 4GB RAM
- 10GB free disk space
- CPU with 2+ cores
#### Recommended Requirements
- Python 3.10+
- 16GB RAM
- 50GB free disk space
- CPU with 8+ cores
- Intel CPU with MKL support
#### For Medical AI
- 16GB+ RAM
- 100GB+ free disk space
- Fast SSD storage
## ๐ Performance Tips
1. **Memory Optimization**:
- Use streaming datasets for large medical datasets
- Enable chunk loading for models >2GB
- Monitor memory usage in real-time
2. **CPU Optimization**:
- Install Intel Extension for PyTorch
- Use optimized BLAS libraries (MKL, OpenBLAS)
- Set appropriate thread counts
3. **Storage Optimization**:
- Use SSD for cache directories
- Regular cleanup of old datasets
- Compress model checkpoints
---
Built with โค๏ธ for the AI community | ู
ุจูู ุจู โค๏ธ ูู
ุฌุชู
ุน ุงูุฐูุงุก ุงูุงุตุทูุงุนู
<!-- Updated: 2024-12-19 - Advanced features with Arabic support -->
|