Instructions to use facebook/sapiens2-seg-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sapiens2
How to use facebook/sapiens2-seg-1b with sapiens2:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- sapiens
How to use facebook/sapiens2-seg-1b with sapiens:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Transformers
How to use facebook/sapiens2-seg-1b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="facebook/sapiens2-seg-1b")# Load model directly from transformers import AutoImageProcessor, Sapiens2ForSemanticSegmentation processor = AutoImageProcessor.from_pretrained("facebook/sapiens2-seg-1b") model = Sapiens2ForSemanticSegmentation.from_pretrained("facebook/sapiens2-seg-1b") - Notebooks
- Google Colab
- Kaggle
Add HF-compatible model.safetensors, config.json, and preprocessor_config.json
#1
by guarin HF Staff - opened
- config.json +246 -0
- model.safetensors +3 -0
- preprocessor_config.json +29 -0
config.json
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"apply_layernorm": true,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"Sapiens2ForSemanticSegmentation"
|
| 5 |
+
],
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"drop_path_rate": 0.0,
|
| 8 |
+
"flip_pairs": null,
|
| 9 |
+
"head_config": {
|
| 10 |
+
"_name_or_path": "",
|
| 11 |
+
"architectures": null,
|
| 12 |
+
"chunk_size_feed_forward": 0,
|
| 13 |
+
"conv_kernel_size": 1,
|
| 14 |
+
"conv_kernel_sizes": [
|
| 15 |
+
1,
|
| 16 |
+
1
|
| 17 |
+
],
|
| 18 |
+
"conv_out_channels": [
|
| 19 |
+
64,
|
| 20 |
+
64
|
| 21 |
+
],
|
| 22 |
+
"dtype": null,
|
| 23 |
+
"id2label": {
|
| 24 |
+
"0": "LABEL_0",
|
| 25 |
+
"1": "LABEL_1"
|
| 26 |
+
},
|
| 27 |
+
"is_encoder_decoder": false,
|
| 28 |
+
"label2id": {
|
| 29 |
+
"LABEL_0": 0,
|
| 30 |
+
"LABEL_1": 1
|
| 31 |
+
},
|
| 32 |
+
"model_type": "sapiens2_head",
|
| 33 |
+
"output_attentions": false,
|
| 34 |
+
"output_hidden_states": false,
|
| 35 |
+
"problem_type": null,
|
| 36 |
+
"return_dict": true,
|
| 37 |
+
"scale_conv_kernel_size": 1,
|
| 38 |
+
"scale_conv_kernel_sizes": null,
|
| 39 |
+
"scale_conv_out_channels": null,
|
| 40 |
+
"scale_final_hidden_sizes": null,
|
| 41 |
+
"scale_final_input_size": null,
|
| 42 |
+
"upsample_kernel_size": 4,
|
| 43 |
+
"upsample_kernel_sizes": [
|
| 44 |
+
4,
|
| 45 |
+
4,
|
| 46 |
+
4,
|
| 47 |
+
4
|
| 48 |
+
],
|
| 49 |
+
"upsample_out_channels": [
|
| 50 |
+
512,
|
| 51 |
+
256,
|
| 52 |
+
128,
|
| 53 |
+
64
|
| 54 |
+
],
|
| 55 |
+
"use_pixel_shuffle": null
|
| 56 |
+
},
|
| 57 |
+
"hidden_act": "silu",
|
| 58 |
+
"hidden_size": 1536,
|
| 59 |
+
"id2label": {
|
| 60 |
+
"0": "LABEL_0",
|
| 61 |
+
"1": "LABEL_1",
|
| 62 |
+
"2": "LABEL_2",
|
| 63 |
+
"3": "LABEL_3",
|
| 64 |
+
"4": "LABEL_4",
|
| 65 |
+
"5": "LABEL_5",
|
| 66 |
+
"6": "LABEL_6",
|
| 67 |
+
"7": "LABEL_7",
|
| 68 |
+
"8": "LABEL_8",
|
| 69 |
+
"9": "LABEL_9",
|
| 70 |
+
"10": "LABEL_10",
|
| 71 |
+
"11": "LABEL_11",
|
| 72 |
+
"12": "LABEL_12",
|
| 73 |
+
"13": "LABEL_13",
|
| 74 |
+
"14": "LABEL_14",
|
| 75 |
+
"15": "LABEL_15",
|
| 76 |
+
"16": "LABEL_16",
|
| 77 |
+
"17": "LABEL_17",
|
| 78 |
+
"18": "LABEL_18",
|
| 79 |
+
"19": "LABEL_19",
|
| 80 |
+
"20": "LABEL_20",
|
| 81 |
+
"21": "LABEL_21",
|
| 82 |
+
"22": "LABEL_22",
|
| 83 |
+
"23": "LABEL_23",
|
| 84 |
+
"24": "LABEL_24",
|
| 85 |
+
"25": "LABEL_25",
|
| 86 |
+
"26": "LABEL_26",
|
| 87 |
+
"27": "LABEL_27",
|
| 88 |
+
"28": "LABEL_28"
|
| 89 |
+
},
|
| 90 |
+
"image_size": [
|
| 91 |
+
1024,
|
| 92 |
+
768
|
| 93 |
+
],
|
| 94 |
+
"initializer_range": 0.02,
|
| 95 |
+
"intermediate_size": 6144,
|
| 96 |
+
"key_bias": true,
|
| 97 |
+
"label2id": {
|
| 98 |
+
"LABEL_0": 0,
|
| 99 |
+
"LABEL_1": 1,
|
| 100 |
+
"LABEL_10": 10,
|
| 101 |
+
"LABEL_11": 11,
|
| 102 |
+
"LABEL_12": 12,
|
| 103 |
+
"LABEL_13": 13,
|
| 104 |
+
"LABEL_14": 14,
|
| 105 |
+
"LABEL_15": 15,
|
| 106 |
+
"LABEL_16": 16,
|
| 107 |
+
"LABEL_17": 17,
|
| 108 |
+
"LABEL_18": 18,
|
| 109 |
+
"LABEL_19": 19,
|
| 110 |
+
"LABEL_2": 2,
|
| 111 |
+
"LABEL_20": 20,
|
| 112 |
+
"LABEL_21": 21,
|
| 113 |
+
"LABEL_22": 22,
|
| 114 |
+
"LABEL_23": 23,
|
| 115 |
+
"LABEL_24": 24,
|
| 116 |
+
"LABEL_25": 25,
|
| 117 |
+
"LABEL_26": 26,
|
| 118 |
+
"LABEL_27": 27,
|
| 119 |
+
"LABEL_28": 28,
|
| 120 |
+
"LABEL_3": 3,
|
| 121 |
+
"LABEL_4": 4,
|
| 122 |
+
"LABEL_5": 5,
|
| 123 |
+
"LABEL_6": 6,
|
| 124 |
+
"LABEL_7": 7,
|
| 125 |
+
"LABEL_8": 8,
|
| 126 |
+
"LABEL_9": 9
|
| 127 |
+
},
|
| 128 |
+
"layer_norm_eps": 1e-05,
|
| 129 |
+
"layerscale_value": 1.0,
|
| 130 |
+
"mlp_bias": true,
|
| 131 |
+
"model_type": "sapiens2",
|
| 132 |
+
"normalize_backbone_outputs": true,
|
| 133 |
+
"num_attention_heads": 24,
|
| 134 |
+
"num_channels": 3,
|
| 135 |
+
"num_first_full_attention_layers": 8,
|
| 136 |
+
"num_hidden_layers": 40,
|
| 137 |
+
"num_key_value_attention_heads": 12,
|
| 138 |
+
"num_key_value_heads_per_layer": [
|
| 139 |
+
24,
|
| 140 |
+
24,
|
| 141 |
+
24,
|
| 142 |
+
24,
|
| 143 |
+
24,
|
| 144 |
+
24,
|
| 145 |
+
24,
|
| 146 |
+
24,
|
| 147 |
+
12,
|
| 148 |
+
12,
|
| 149 |
+
12,
|
| 150 |
+
12,
|
| 151 |
+
12,
|
| 152 |
+
12,
|
| 153 |
+
12,
|
| 154 |
+
12,
|
| 155 |
+
12,
|
| 156 |
+
12,
|
| 157 |
+
12,
|
| 158 |
+
12,
|
| 159 |
+
12,
|
| 160 |
+
12,
|
| 161 |
+
12,
|
| 162 |
+
12,
|
| 163 |
+
12,
|
| 164 |
+
12,
|
| 165 |
+
12,
|
| 166 |
+
12,
|
| 167 |
+
12,
|
| 168 |
+
12,
|
| 169 |
+
12,
|
| 170 |
+
12,
|
| 171 |
+
24,
|
| 172 |
+
24,
|
| 173 |
+
24,
|
| 174 |
+
24,
|
| 175 |
+
24,
|
| 176 |
+
24,
|
| 177 |
+
24,
|
| 178 |
+
24
|
| 179 |
+
],
|
| 180 |
+
"num_last_full_attention_layers": 8,
|
| 181 |
+
"num_register_tokens": 8,
|
| 182 |
+
"out_features": [
|
| 183 |
+
"stage40"
|
| 184 |
+
],
|
| 185 |
+
"out_indices": [
|
| 186 |
+
40
|
| 187 |
+
],
|
| 188 |
+
"patch_size": 16,
|
| 189 |
+
"pos_embed_jitter": null,
|
| 190 |
+
"pos_embed_rescale": 2.0,
|
| 191 |
+
"pos_embed_shift": null,
|
| 192 |
+
"proj_bias": true,
|
| 193 |
+
"query_bias": true,
|
| 194 |
+
"reshape_hidden_states": true,
|
| 195 |
+
"rms_norm_eps": 1e-06,
|
| 196 |
+
"rope_theta": 100.0,
|
| 197 |
+
"semantic_loss_ignore_index": 255,
|
| 198 |
+
"stage_names": [
|
| 199 |
+
"stem",
|
| 200 |
+
"stage1",
|
| 201 |
+
"stage2",
|
| 202 |
+
"stage3",
|
| 203 |
+
"stage4",
|
| 204 |
+
"stage5",
|
| 205 |
+
"stage6",
|
| 206 |
+
"stage7",
|
| 207 |
+
"stage8",
|
| 208 |
+
"stage9",
|
| 209 |
+
"stage10",
|
| 210 |
+
"stage11",
|
| 211 |
+
"stage12",
|
| 212 |
+
"stage13",
|
| 213 |
+
"stage14",
|
| 214 |
+
"stage15",
|
| 215 |
+
"stage16",
|
| 216 |
+
"stage17",
|
| 217 |
+
"stage18",
|
| 218 |
+
"stage19",
|
| 219 |
+
"stage20",
|
| 220 |
+
"stage21",
|
| 221 |
+
"stage22",
|
| 222 |
+
"stage23",
|
| 223 |
+
"stage24",
|
| 224 |
+
"stage25",
|
| 225 |
+
"stage26",
|
| 226 |
+
"stage27",
|
| 227 |
+
"stage28",
|
| 228 |
+
"stage29",
|
| 229 |
+
"stage30",
|
| 230 |
+
"stage31",
|
| 231 |
+
"stage32",
|
| 232 |
+
"stage33",
|
| 233 |
+
"stage34",
|
| 234 |
+
"stage35",
|
| 235 |
+
"stage36",
|
| 236 |
+
"stage37",
|
| 237 |
+
"stage38",
|
| 238 |
+
"stage39",
|
| 239 |
+
"stage40"
|
| 240 |
+
],
|
| 241 |
+
"transformers_version": "5.10.0.dev0",
|
| 242 |
+
"use_gated_mlp": true,
|
| 243 |
+
"use_mask_token": false,
|
| 244 |
+
"use_qk_norm": true,
|
| 245 |
+
"value_bias": true
|
| 246 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4b73c44963b377e93fcb4c4053f72a189836a22d05e12c30383046b9cd3c5bd4
|
| 3 |
+
size 5883353380
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"crop_size": {
|
| 3 |
+
"height": 224,
|
| 4 |
+
"width": 224
|
| 5 |
+
},
|
| 6 |
+
"do_center_crop": false,
|
| 7 |
+
"do_normalize": true,
|
| 8 |
+
"do_pad": false,
|
| 9 |
+
"do_reduce_labels": false,
|
| 10 |
+
"do_rescale": true,
|
| 11 |
+
"do_resize": true,
|
| 12 |
+
"image_mean": [
|
| 13 |
+
0.485,
|
| 14 |
+
0.456,
|
| 15 |
+
0.406
|
| 16 |
+
],
|
| 17 |
+
"image_processor_type": "Sapiens2ImageProcessor",
|
| 18 |
+
"image_std": [
|
| 19 |
+
0.229,
|
| 20 |
+
0.224,
|
| 21 |
+
0.225
|
| 22 |
+
],
|
| 23 |
+
"resample": 2,
|
| 24 |
+
"rescale_factor": 0.00392156862745098,
|
| 25 |
+
"size": {
|
| 26 |
+
"height": 1024,
|
| 27 |
+
"width": 768
|
| 28 |
+
}
|
| 29 |
+
}
|