File size: 1,449 Bytes
4ac5ccd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language:
- en
- zh
tags:
- vision
- ocr
- deepseek
- quantization
- int4
license: other
base_model: deepseek-ai/DeepSeek-OCR
---

# DeepSeek-OCR INT4 Merged Model

This is a merged version of the DeepSeek-OCR model that was quantized to INT4 and then dequantized back to full precision.

## Model Details

- **Base Model**: [deepseek-ai/DeepSeek-OCR](https://huggingface.co/deepseek-ai/DeepSeek-OCR)
- **Quantization**: INT4 (during storage)
- **Final Format**: Full precision (FP32/FP16)
- **Source**: Quantized weights from SamMikaelson/deepseekocr-randomreal

## Usage

```python
from transformers import AutoModelForCausalLM, AutoProcessor
from PIL import Image

# Load model and processor
model = AutoModelForCausalLM.from_pretrained(
    "YOUR_USERNAME/OCR-int4-merged",
    trust_remote_code=True
)
processor = AutoProcessor.from_pretrained(
    "YOUR_USERNAME/OCR-int4-merged",
    trust_remote_code=True
)

# Process image
image = Image.open("document.jpg")
inputs = processor(images=image, return_tensors="pt")

# Generate OCR output
outputs = model.generate(**inputs, max_new_tokens=512)
text = processor.decode(outputs[0], skip_special_tokens=True)
print(text)
```

## Notes

This model was created by:
1. Quantizing the original DeepSeek-OCR to INT4
2. Dequantizing back to full precision
3. Merging into a standard model format

The process allows for efficient storage and distribution while maintaining full model capabilities.