Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
tags:
|
| 5 |
+
- vision
|
| 6 |
+
- multimodal
|
| 7 |
+
- tiny-model
|
| 8 |
+
- minicpm
|
| 9 |
+
pipeline_tag: image-to-text
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Tiny MiniCPM-o-2_6 Model
|
| 13 |
+
|
| 14 |
+
A minimal, optimized version of MiniCPM-o-2_6 for testing and development purposes.
|
| 15 |
+
|
| 16 |
+
## Model Details
|
| 17 |
+
|
| 18 |
+
- **Model Size**: ~54 MB (PyTorch safetensors format)
|
| 19 |
+
- **Format**: PyTorch safetensors (not OpenVINO IR)
|
| 20 |
+
- **Vocabulary Size**: 50,000 tokens (reduced from 151,700)
|
| 21 |
+
- **Architecture**: MiniCPM-o-2_6 with optimized dimensions
|
| 22 |
+
|
| 23 |
+
## Model Configuration
|
| 24 |
+
|
| 25 |
+
- **hidden_size**: 128 (reduced from 168)
|
| 26 |
+
- **intermediate_size**: 8 (reduced from 16)
|
| 27 |
+
- **num_hidden_layers**: 2
|
| 28 |
+
- **num_attention_heads**: 2 (reduced from 28)
|
| 29 |
+
- **query_num**: 64
|
| 30 |
+
|
| 31 |
+
## Usage
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
from transformers import AutoProcessor, AutoModelForCausalLM
|
| 35 |
+
from PIL import Image
|
| 36 |
+
|
| 37 |
+
# Load processor and model
|
| 38 |
+
processor = AutoProcessor.from_pretrained("M-Ziyo/tiny-random-MiniCPM-o-2_6-mini", trust_remote_code=True)
|
| 39 |
+
model = AutoModelForCausalLM.from_pretrained("M-Ziyo/tiny-random-MiniCPM-o-2_6-mini", trust_remote_code=True)
|
| 40 |
+
|
| 41 |
+
# Prepare inputs
|
| 42 |
+
prompt = "<|im_start|>user\n(<image>./</image>)\nWhat is in the image?<|im_end|>\n<|im_start|>assistant\n"
|
| 43 |
+
image = Image.open("your_image.jpg")
|
| 44 |
+
|
| 45 |
+
inputs = processor([prompt], [image], return_tensors="pt")
|
| 46 |
+
|
| 47 |
+
# Generate
|
| 48 |
+
result = model.generate(**inputs, max_new_tokens=50)
|
| 49 |
+
decoded = processor.tokenizer.batch_decode(result[:, inputs["input_ids"].shape[1]:])
|
| 50 |
+
print(decoded)
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Model Features
|
| 54 |
+
|
| 55 |
+
- ✅ **PyTorch format** with safetensors (not OpenVINO IR)
|
| 56 |
+
- ✅ **Optimized size** (~54 MB vs original)
|
| 57 |
+
- ✅ **Weight copying** from original model for better output quality
|
| 58 |
+
- ✅ **Diverse output** (not just repetitive characters)
|
| 59 |
+
|
| 60 |
+
## Notes
|
| 61 |
+
|
| 62 |
+
- This is a minimal test model for development purposes
|
| 63 |
+
- Model weights are copied from the original model for better initialization
|
| 64 |
+
- Designed for testing Optimum-Intel integration
|
| 65 |
+
|
| 66 |
+
## Citation
|
| 67 |
+
|
| 68 |
+
Based on MiniCPM-o-2_6 from OpenBMB.
|
| 69 |
+
|