patrickamadeus commited on
Commit
8ef7b32
·
verified ·
1 Parent(s): beb906a

Upload nanoVLM using push_to_hub

Browse files
Files changed (3) hide show
  1. README.md +27 -0
  2. config.json +117 -0
  3. model.safetensors +3 -0
README.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+ # For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
4
+ # Doc / guide: https://huggingface.co/docs/hub/model-cards
5
+ library_name: nanovlm
6
+ license: mit
7
+ pipeline_tag: image-text-to-text
8
+ tags:
9
+ - vision-language
10
+ - multimodal
11
+ - research
12
+ ---
13
+
14
+ **nanoVLM** is a minimal and lightweight Vision-Language Model (VLM) designed for efficient training and experimentation. Built using pure PyTorch, the entire model architecture and training logic fits within ~750 lines of code. It combines a ViT-based image encoder (SigLIP-B/16-224-85M) with a lightweight causal language model (SmolLM2-135M), resulting in a compact 222M parameter model.
15
+
16
+ For more information, check out the base model on https://huggingface.co/lusxvr/nanoVLM-222M.
17
+
18
+ **Usage:**
19
+
20
+ Clone the nanoVLM repository: https://github.com/huggingface/nanoVLM.
21
+ Follow the install instructions and run the following code:
22
+
23
+ ```python
24
+ from models.vision_language_model import VisionLanguageModel
25
+
26
+ model = VisionLanguageModel.from_pretrained("patrickamadeus/vanilla-finevisionmax-4500")
27
+ ```
config.json ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "vit_hidden_dim": 768,
3
+ "vit_inter_dim": 3072,
4
+ "vit_patch_size": 16,
5
+ "vit_img_size": 512,
6
+ "vit_n_heads": 12,
7
+ "vit_dropout": 0.0,
8
+ "vit_n_blocks": 12,
9
+ "vit_ln_eps": 1e-06,
10
+ "vit_cls_flag": false,
11
+ "vit_model_type": "google/siglip2-base-patch16-512",
12
+ "lm_hidden_dim": 576,
13
+ "lm_inter_dim": 1536,
14
+ "lm_rms_eps": 1e-05,
15
+ "lm_re_base": 100000,
16
+ "lm_max_position_embeddings": 2048,
17
+ "lm_base_vocab_size": 49152,
18
+ "extra_token_amount": 66,
19
+ "lm_vocab_size": 49218,
20
+ "lm_n_heads": 9,
21
+ "lm_n_kv_heads": 3,
22
+ "lm_dropout": 0.0,
23
+ "lm_n_blocks": 30,
24
+ "lm_attn_scaling": 1.0,
25
+ "lm_max_length": 2048,
26
+ "lm_use_tokens": false,
27
+ "lm_tie_weights": true,
28
+ "lm_model_type": "HuggingFaceTB/SmolLM2-135M",
29
+ "lm_tokenizer": "HuggingFaceTB/SmolLM2-360M-Instruct",
30
+ "lm_chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
31
+ "mp_pixel_shuffle_factor": 4,
32
+ "mp_image_token_length": 64,
33
+ "momh_enabled": false,
34
+ "momh_kv_groups_vision": null,
35
+ "momh_kv_groups_text": null,
36
+ "momh_soft_gating": false,
37
+ "momh_soft_gating_init": "zero",
38
+ "momh_soft_gating_pairs": "all",
39
+ "momh_structural_mask_only": false,
40
+ "momh_causal_gating": false,
41
+ "activation_checkpointing": false,
42
+ "activation_checkpointing_mode": "selective",
43
+ "max_img_size": 2048,
44
+ "resize_to_max_side_len": false,
45
+ "vlm_extra_tokens": {
46
+ "image_token": "<|image|>",
47
+ "global_image_token": "<|global_image|>",
48
+ "r1c1": "<row_1_col_1>",
49
+ "r1c2": "<row_1_col_2>",
50
+ "r1c3": "<row_1_col_3>",
51
+ "r1c4": "<row_1_col_4>",
52
+ "r1c5": "<row_1_col_5>",
53
+ "r1c6": "<row_1_col_6>",
54
+ "r1c7": "<row_1_col_7>",
55
+ "r1c8": "<row_1_col_8>",
56
+ "r2c1": "<row_2_col_1>",
57
+ "r2c2": "<row_2_col_2>",
58
+ "r2c3": "<row_2_col_3>",
59
+ "r2c4": "<row_2_col_4>",
60
+ "r2c5": "<row_2_col_5>",
61
+ "r2c6": "<row_2_col_6>",
62
+ "r2c7": "<row_2_col_7>",
63
+ "r2c8": "<row_2_col_8>",
64
+ "r3c1": "<row_3_col_1>",
65
+ "r3c2": "<row_3_col_2>",
66
+ "r3c3": "<row_3_col_3>",
67
+ "r3c4": "<row_3_col_4>",
68
+ "r3c5": "<row_3_col_5>",
69
+ "r3c6": "<row_3_col_6>",
70
+ "r3c7": "<row_3_col_7>",
71
+ "r3c8": "<row_3_col_8>",
72
+ "r4c1": "<row_4_col_1>",
73
+ "r4c2": "<row_4_col_2>",
74
+ "r4c3": "<row_4_col_3>",
75
+ "r4c4": "<row_4_col_4>",
76
+ "r4c5": "<row_4_col_5>",
77
+ "r4c6": "<row_4_col_6>",
78
+ "r4c7": "<row_4_col_7>",
79
+ "r4c8": "<row_4_col_8>",
80
+ "r5c1": "<row_5_col_1>",
81
+ "r5c2": "<row_5_col_2>",
82
+ "r5c3": "<row_5_col_3>",
83
+ "r5c4": "<row_5_col_4>",
84
+ "r5c5": "<row_5_col_5>",
85
+ "r5c6": "<row_5_col_6>",
86
+ "r5c7": "<row_5_col_7>",
87
+ "r5c8": "<row_5_col_8>",
88
+ "r6c1": "<row_6_col_1>",
89
+ "r6c2": "<row_6_col_2>",
90
+ "r6c3": "<row_6_col_3>",
91
+ "r6c4": "<row_6_col_4>",
92
+ "r6c5": "<row_6_col_5>",
93
+ "r6c6": "<row_6_col_6>",
94
+ "r6c7": "<row_6_col_7>",
95
+ "r6c8": "<row_6_col_8>",
96
+ "r7c1": "<row_7_col_1>",
97
+ "r7c2": "<row_7_col_2>",
98
+ "r7c3": "<row_7_col_3>",
99
+ "r7c4": "<row_7_col_4>",
100
+ "r7c5": "<row_7_col_5>",
101
+ "r7c6": "<row_7_col_6>",
102
+ "r7c7": "<row_7_col_7>",
103
+ "r7c8": "<row_7_col_8>",
104
+ "r8c1": "<row_8_col_1>",
105
+ "r8c2": "<row_8_col_2>",
106
+ "r8c3": "<row_8_col_3>",
107
+ "r8c4": "<row_8_col_4>",
108
+ "r8c5": "<row_8_col_5>",
109
+ "r8c6": "<row_8_col_6>",
110
+ "r8c7": "<row_8_col_7>",
111
+ "r8c8": "<row_8_col_8>"
112
+ },
113
+ "vlm_load_backbone_weights": true,
114
+ "vlm_checkpoint_path": "checkpoints",
115
+ "hf_repo_name": "nanoVLM",
116
+ "left_tower_mask_mode": "visual_only"
117
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2cd41ba7eb412324dab5cb37a319900029d86621e3f6757ddb93d78fc371deb
3
+ size 912304544