File size: 3,983 Bytes
122c72c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
library_name: transformers
pipeline_tag: image-text-to-text
base_model:
- openbmb/MiniCPM-V-4.7-1B
---

This is a randomly initialized tiny model based on [openbmb/MiniCPM-V-4.7-1B](https://huggingface.co/openbmb/MiniCPM-V-4.7-1B) for testing and debugging.

| Feature | Source | This repo |
|---|---|---|
| Checkpoint tensor elements | 1.55B BF16 | 11.54M BF16 |
| Safetensors weight files | 3.11 GB (model.safetensors) | 23.11 MB (model.safetensors) |
| Architecture / input | MiniCPM-V 4.7 dense; text, image, video | Same |
| Vocabulary rows / tied embeddings | 248,094 / false | Same |
| Backbone layers / layer cadence | 24 / six 3-linear + 1-full cycles | 8 / two complete cycles |
| Hidden width / MLP width | 1,024 / 3,584 | 16 / 32 |
| Q heads / KV heads / head dimension | 8 / 2 / 256 | Same |
| Linear-attention key/value heads and dimensions | 16/16, 128/128 | Same |
| Vision layers / width / insert merger | 27 / 1,152 / after layer 6 | 4 / 128 / after layer 2 |
| M-RoPE | canvas; sections 11/11/10; partial 0.25 | canvas; sections 11/11/10; partial 0.25 |
| MTP | config declares one layer; no MTP tensors | Same |
| Checkpoint precision | BF16 | Same |

Two complete linear/linear/linear/full cycles are retained. The Qwen3.5 linear-attention path requires CUDA and Triton. The exact public snippet was verified on an NVIDIA A800-SXM4-80GB.

| File path | Size |
|------|------|
| model.safetensors | 23.1MB |

### Example usage

#### Transformers (✅ verified)

The example sends one image and one predecoded video. The Qwen3.5 linear-attention path requires CUDA and Triton. Install `transformers[torch]>=5.18.0` and `Pillow`.

```python
def run_transformers(model_id: str):
    import numpy as np
    import torch
    from PIL import Image, ImageDraw
    from transformers import AutoModelForImageTextToText, AutoProcessor
    from transformers.video_utils import VideoMetadata

    model_id = str(model_id)
    processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
    model = AutoModelForImageTextToText.from_pretrained(
        model_id,
        dtype=torch.bfloat16,
        device_map="cuda",
        attn_implementation="sdpa",
    )
    image = Image.new("RGB", (448, 448), "white")
    ImageDraw.Draw(image).text((20, 20), "Hello", fill="black")
    frames = np.stack(
        [
            np.asarray(Image.new("RGB", (64, 64), color))
            for color in ((220, 30, 30), (30, 220, 30), (30, 30, 220), (220, 220, 30))
        ]
    )
    messages = [
        {
            "role": "user",
            "content": [
                {"type": "image", "image": image},
                {"type": "video", "video": frames},
                {"type": "text", "text": "Describe the image and the video."},
            ],
        }
    ]
    inputs = processor.apply_chat_template(
        messages,
        tokenize=True,
        add_generation_prompt=True,
        return_dict=True,
        return_tensors="pt",
        downsample_mode="16x",
        max_num_frames=4,
        stack_frames=1,
        max_slice_nums=1,
        use_image_id=False,
        enable_thinking=False,
        do_sample_frames=False,
        video_metadata=[VideoMetadata(total_num_frames=4, fps=2, frames_indices=[0, 1, 2, 3])],
    ).to(model.device)
    with torch.no_grad():
        logits = model(**inputs).logits
        assert torch.isfinite(logits).all()
        output = model.generate(**inputs, downsample_mode="16x", do_sample=False, max_new_tokens=10)
    print(processor.decode(output[0, inputs["input_ids"].shape[1] :], skip_special_tokens=True))


if __name__ == "__main__":
    run_transformers(model_id="tiny-random/minicpm-v-4.7")
```

### Creating this repo

- Code: [.meta/create_model.py](.meta/create_model.py)
- Model structure: [.meta/model.log](.meta/model.log)
- Environment: [.meta/env.json](.meta/env.json)

### Change log

- 2026-11-01: Initial tiny MiniCPM-V 4.7 checkpoint.

*This repo is generated by DeepSeek-V4.1-Flash.*