Views
No views yet
| Metric | Value |
|---|---|
| Original Size | 6363.12 MB (6.21 GB) |
| Quantized Size | 2199.39 MB (2.15 GB) |
| Size Reduction | 4165.03 MB (65.46%) |
| Compression Ratio | 2.89x |
| Format | SafeTensors |
1import torch
2from transformers import AutoModel, AutoTokenizer
3from safetensors.torch import load_file
4
5# Load tokenizer
6tokenizer = AutoTokenizer.from_pretrained(
7 "SamMikaelson/deepseek-ocr-qvlm-4bit",
8 trust_remote_code=True
9)
10
11# Load quantized model (weights only)
12quantized_state_dict = load_file("model.safetensors")
13
14# Note: You'll need to implement dequantization logic for inference
15# The quantization metadata is stored in the safetensors metadata1from safetensors.torch import load_file, safe_open
2import json
3
4# Load model with metadata
5model_path = "model.safetensors"
6
7# Read metadata
8with safe_open(model_path, framework="pt", device="cpu") as f:
9 metadata = f.metadata()
10 quantization_metadata = json.loads(metadata.get("quantization_metadata", "{}"))
11
12# Load state dict
13state_dict = load_file(model_path)
14
15# Implement dequantization here based on metadata
16# See QVLM repository for full implementationmodel.safetensors - Quantized weights in SafeTensors format (2199.39 MB)config.json - Model configuration with quantization settingsquantization_config.json - Detailed quantization configurationquantization_results.json - Compression statisticstokenizer.json - Tokenizer vocabularytokenizer_config.json - Tokenizer configuration1@article{deepseek-ocr,
2 title={DeepSeek-OCR: Optical Character Recognition Model},
3 author={DeepSeek-AI},
4 year={2024}
5}
6
7@article{qvlm,
8 title={QVLM: Quantized Vision Language Models},
9 author={Wang, Changyuan},
10 year={2024},
11 url={https://github.com/ChangyuanWang17/QVLM}
12}