Views
No views yet
4-bit bitsandbytes quantization of openbmb/MiniCPM-o-4_5 with selective module skipping for audio/vision quality preservation.
weight_norm layers are explicitly skipped (they crash under bitsandbytes quantization)| Precision | VRAM (loaded) | Peak VRAM | Load Time |
|---|---|---|---|
| bf16 (baseline) | 21.0 GB | 21.3 GB | 16.3s |
| 4-bit (this repo) | 11.3 GB | 11.6 GB | 19.0s |
1from transformers import AutoModel, AutoTokenizer, BitsAndBytesConfig
2import torch
3
4model_name = "ericleigh007/MiniCPM-o-4_5-BNB-Int4"
5
6tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
7model = AutoModel.from_pretrained(
8 model_name,
9 trust_remote_code=True,
10 attn_implementation="sdpa",
11 torch_dtype=torch.bfloat16,
12 device_map="auto",
13 init_vision=True,
14 init_audio=True,
15 init_tts=True,
16)
17model.eval()
18model.init_tts()| Module | Reason |
|---|---|
lm_head | Output projection — standard practice |
apm | Whisper audio encoder — small, quality-sensitive |
tts | TTS decoder — uses weight_norm, incompatible with bitsandbytes |
vpm | SigLIP vision encoder — small, quality-sensitive |
resampler | Vision resampler — small |
audio_projection_layer | Audio-to-LLM projector — small |
audio_avg_pooler | Audio pooling layer — small |