Image Feature Extraction
Transformers
Safetensors
English
keural_vision
vision
vision-encoder
image-text
contrastive-learning
knowledge-distillation
adaptive-tokenization
Eval Results (legacy)
Instructions to use mkd-hika/keural-vision-encoder-mid with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mkd-hika/keural-vision-encoder-mid with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="mkd-hika/keural-vision-encoder-mid")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mkd-hika/keural-vision-encoder-mid", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Publish final checkpoint at repo root so from_pretrained() works
Browse files- config.json +131 -0
config.json
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"KeuralVisionModel"
|
| 4 |
+
],
|
| 5 |
+
"default_token_budget": 512,
|
| 6 |
+
"depth": 24,
|
| 7 |
+
"dtype": "float32",
|
| 8 |
+
"embed_dim": 768,
|
| 9 |
+
"keural_config": {
|
| 10 |
+
"data": {
|
| 11 |
+
"captions_path": "/home/work/keural-model/vision-encoder-dataset/indexes/datacomp_train.tsv",
|
| 12 |
+
"dataset_name": "cc3m",
|
| 13 |
+
"extra_sources": [],
|
| 14 |
+
"image_buckets": [
|
| 15 |
+
[
|
| 16 |
+
384,
|
| 17 |
+
384
|
| 18 |
+
],
|
| 19 |
+
[
|
| 20 |
+
448,
|
| 21 |
+
448
|
| 22 |
+
]
|
| 23 |
+
],
|
| 24 |
+
"images_root": "/home/work/keural-model/vision-encoder-dataset/datacomp_medium",
|
| 25 |
+
"max_caption_length": 77,
|
| 26 |
+
"num_workers": 6,
|
| 27 |
+
"pixel_mean": [
|
| 28 |
+
0.485,
|
| 29 |
+
0.456,
|
| 30 |
+
0.406
|
| 31 |
+
],
|
| 32 |
+
"pixel_std": [
|
| 33 |
+
0.229,
|
| 34 |
+
0.224,
|
| 35 |
+
0.225
|
| 36 |
+
],
|
| 37 |
+
"text_encoder_name": "openai/clip-vit-large-patch14"
|
| 38 |
+
},
|
| 39 |
+
"distillation": {
|
| 40 |
+
"enabled": true,
|
| 41 |
+
"internvit_embed_dim": 1024,
|
| 42 |
+
"internvit_model": "OpenGVLab/InternViT-300M-448px",
|
| 43 |
+
"lambda_internvit": 0.5,
|
| 44 |
+
"lambda_siglip": 0.5,
|
| 45 |
+
"siglip_embed_dim": 1152,
|
| 46 |
+
"siglip_model": "google/siglip-so400m-patch14-384"
|
| 47 |
+
},
|
| 48 |
+
"loss": {
|
| 49 |
+
"lambda_distill": 0.5,
|
| 50 |
+
"lambda_hct": 1.0,
|
| 51 |
+
"lambda_sal": 0.5,
|
| 52 |
+
"learnable_bias_init": -10.0,
|
| 53 |
+
"learnable_temperature_init": 2.3,
|
| 54 |
+
"primary": "sigmoid_siglip",
|
| 55 |
+
"saliency_beta": 0.005,
|
| 56 |
+
"saliency_lambda_smooth": 4.0
|
| 57 |
+
},
|
| 58 |
+
"name": "keural-mid",
|
| 59 |
+
"saliency": {
|
| 60 |
+
"hidden_channels": 192
|
| 61 |
+
},
|
| 62 |
+
"spatial": {
|
| 63 |
+
"depth": 24,
|
| 64 |
+
"embed_dim": 768,
|
| 65 |
+
"head_dim": 64,
|
| 66 |
+
"mlp_ratio": 4,
|
| 67 |
+
"norm_eps": 1e-06,
|
| 68 |
+
"num_heads": 12,
|
| 69 |
+
"rope_base": 10000.0
|
| 70 |
+
},
|
| 71 |
+
"stem": {
|
| 72 |
+
"activation": "gelu",
|
| 73 |
+
"channels": [
|
| 74 |
+
128,
|
| 75 |
+
256,
|
| 76 |
+
512,
|
| 77 |
+
768
|
| 78 |
+
],
|
| 79 |
+
"kernel_size": 3
|
| 80 |
+
},
|
| 81 |
+
"tokenizer": {
|
| 82 |
+
"budget_floors": {
|
| 83 |
+
"detail": 0,
|
| 84 |
+
"global": 8,
|
| 85 |
+
"region": 16
|
| 86 |
+
},
|
| 87 |
+
"budget_split": {
|
| 88 |
+
"detail": 0.7,
|
| 89 |
+
"global": 0.05,
|
| 90 |
+
"region": 0.25
|
| 91 |
+
},
|
| 92 |
+
"default_token_budget": 512,
|
| 93 |
+
"gumbel_temperature_end": 0.05,
|
| 94 |
+
"gumbel_temperature_start": 1.0,
|
| 95 |
+
"max_token_budget": 2048,
|
| 96 |
+
"nms_radius": {
|
| 97 |
+
"detail": 1,
|
| 98 |
+
"region": 3
|
| 99 |
+
},
|
| 100 |
+
"saliency_smooth_kernel": {
|
| 101 |
+
"detail": 3,
|
| 102 |
+
"region": 7
|
| 103 |
+
},
|
| 104 |
+
"temperature_anneal_steps": 10000,
|
| 105 |
+
"warmup_steps_fixed_grid": 4000
|
| 106 |
+
},
|
| 107 |
+
"training": {
|
| 108 |
+
"batch_size_per_device": 768,
|
| 109 |
+
"betas": [
|
| 110 |
+
0.9,
|
| 111 |
+
0.95
|
| 112 |
+
],
|
| 113 |
+
"gradient_accumulation": 2,
|
| 114 |
+
"gradient_checkpointing": true,
|
| 115 |
+
"log_every": 100,
|
| 116 |
+
"lr": 0.0005,
|
| 117 |
+
"lr_schedule": "cosine_with_warmup",
|
| 118 |
+
"max_steps": 18000,
|
| 119 |
+
"optimizer": "adamw",
|
| 120 |
+
"precision": "bfloat16",
|
| 121 |
+
"save_every": 1000,
|
| 122 |
+
"seed": 42,
|
| 123 |
+
"warmup_steps": 2000,
|
| 124 |
+
"weight_decay": 0.05
|
| 125 |
+
}
|
| 126 |
+
},
|
| 127 |
+
"max_token_budget": 2048,
|
| 128 |
+
"model_type": "keural_vision",
|
| 129 |
+
"num_heads": 12,
|
| 130 |
+
"transformers_version": "4.57.6"
|
| 131 |
+
}
|