jaehyeono commited on
Commit
c5d142b
·
verified ·
1 Parent(s): bdfbe5f

Upload nanoVLM using push_to_hub

Browse files
Files changed (3) hide show
  1. README.md +27 -27
  2. config.json +38 -39
  3. model.safetensors +1 -1
README.md CHANGED
@@ -1,27 +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("jaehyeono/nanoVLM")
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("jaehyeono/nanoVLM")
27
+ ```
config.json CHANGED
@@ -1,40 +1,39 @@
1
- {
2
- "vit_hidden_dim": 768,
3
- "vit_inter_dim": 3072,
4
- "vit_patch_size": 16,
5
- "vit_img_size": 224,
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/siglip-base-patch16-224",
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": 8192,
17
- "lm_base_vocab_size": 49152,
18
- "extra_token_amount": 1,
19
- "lm_vocab_size": 49153,
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_eos_token_id": 0,
26
- "lm_max_length": 128,
27
- "lm_use_tokens": false,
28
- "lm_tie_weights": true,
29
- "lm_model_type": "HuggingFaceTB/SmolLM2-135M",
30
- "lm_tokenizer": "HuggingFaceTB/cosmo2-tokenizer",
31
- "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 %}",
32
- "mp_pixel_shuffle_factor": 2,
33
- "mp_image_token_length": 49,
34
- "vlm_extra_tokens": {
35
- "image_token": "<|image|>"
36
- },
37
- "vlm_load_backbone_weights": true,
38
- "vlm_checkpoint_path": "checkpoints",
39
- "hf_repo_name": "nanoVLM"
40
  }
 
1
+ {
2
+ "vit_hidden_dim": 768,
3
+ "vit_inter_dim": 3072,
4
+ "vit_patch_size": 16,
5
+ "vit_img_size": 224,
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/siglip-base-patch16-224",
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": 8192,
17
+ "lm_base_vocab_size": 49152,
18
+ "extra_token_amount": 1,
19
+ "lm_vocab_size": 49153,
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": 128,
26
+ "lm_use_tokens": false,
27
+ "lm_tie_weights": true,
28
+ "lm_model_type": "HuggingFaceTB/SmolLM2-135M",
29
+ "lm_tokenizer": "HuggingFaceTB/cosmo2-tokenizer",
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": 2,
32
+ "mp_image_token_length": 49,
33
+ "vlm_extra_tokens": {
34
+ "image_token": "<|image|>"
35
+ },
36
+ "vlm_load_backbone_weights": true,
37
+ "vlm_checkpoint_path": "checkpoints",
38
+ "hf_repo_name": "nanoVLM"
 
39
  }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9738e1c261723567a2981eeb028f84507c03693332f6928df3c8e3fc77dcdb0a
3
  size 888374768
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb46182a5cc4a0e4dd7187fc77554b2a9928efa6b62ef4ac529c2306af209f51
3
  size 888374768