Add/Update backbone checkpoints (count=6)
Browse files- manifest_20260210_113951.json +42 -0
- models/google__efficientnet-b0/config.json +4 -2
- models/google__efficientnet-b0/ds_proc.py +36 -4
- models/google__efficientnet-b0/model.safetensors +1 -1
- models/google__efficientnet-b0/preprocessor_config.json +2 -1
- models/google__vit-base-patch16-224/config.json +4 -2
- models/google__vit-base-patch16-224/ds_proc.py +36 -4
- models/google__vit-base-patch16-224/model.safetensors +1 -1
- models/google__vit-base-patch16-224/preprocessor_config.json +2 -1
- models/microsoft__resnet-50/config.json +4 -2
- models/microsoft__resnet-50/ds_proc.py +36 -4
- models/microsoft__resnet-50/model.safetensors +1 -1
- models/microsoft__resnet-50/preprocessor_config.json +2 -1
- models/microsoft__swin-tiny-patch4-window7-224/config.json +4 -2
- models/microsoft__swin-tiny-patch4-window7-224/ds_proc.py +36 -4
- models/microsoft__swin-tiny-patch4-window7-224/model.safetensors +1 -1
- models/microsoft__swin-tiny-patch4-window7-224/preprocessor_config.json +2 -1
- models/timm__densenet121.tv_in1k/config.json +4 -2
- models/timm__densenet121.tv_in1k/ds_proc.py +36 -4
- models/timm__densenet121.tv_in1k/model.safetensors +1 -1
- models/timm__densenet121.tv_in1k/preprocessor_config.json +2 -1
- models/torchvision__densenet121/config.json +4 -2
- models/torchvision__densenet121/ds_proc.py +36 -4
- models/torchvision__densenet121/model.safetensors +1 -1
- models/torchvision__densenet121/preprocessor_config.json +2 -1
manifest_20260210_113951.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"timestamp": "20260210_113951",
|
| 3 |
+
"device": "mps",
|
| 4 |
+
"repo_id": "dsaint31/bb_mlp_224",
|
| 5 |
+
"revision": "main",
|
| 6 |
+
"tag": null,
|
| 7 |
+
"num_labels": 3,
|
| 8 |
+
"count": 6,
|
| 9 |
+
"items": [
|
| 10 |
+
{
|
| 11 |
+
"backbone": "google/vit-base-patch16-224",
|
| 12 |
+
"subdir": "models/google__vit-base-patch16-224",
|
| 13 |
+
"dirname": "google__vit-base-patch16-224"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"backbone": "microsoft/swin-tiny-patch4-window7-224",
|
| 17 |
+
"subdir": "models/microsoft__swin-tiny-patch4-window7-224",
|
| 18 |
+
"dirname": "microsoft__swin-tiny-patch4-window7-224"
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"backbone": "microsoft/resnet-50",
|
| 22 |
+
"subdir": "models/microsoft__resnet-50",
|
| 23 |
+
"dirname": "microsoft__resnet-50"
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"backbone": "google/efficientnet-b0",
|
| 27 |
+
"subdir": "models/google__efficientnet-b0",
|
| 28 |
+
"dirname": "google__efficientnet-b0"
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"backbone": "timm/densenet121.tv_in1k",
|
| 32 |
+
"subdir": "models/timm__densenet121.tv_in1k",
|
| 33 |
+
"dirname": "timm__densenet121.tv_in1k"
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"backbone": "torchvision/densenet121",
|
| 37 |
+
"subdir": "models/torchvision__densenet121",
|
| 38 |
+
"dirname": "torchvision__densenet121"
|
| 39 |
+
}
|
| 40 |
+
],
|
| 41 |
+
"processor_use_fast": false
|
| 42 |
+
}
|
models/google__efficientnet-b0/config.json
CHANGED
|
@@ -24,16 +24,18 @@
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
-
"created_at": "
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/google__efficientnet-b0",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "google/efficientnet-b0",
|
|
|
|
| 33 |
"pretrained_injected": true,
|
| 34 |
"policy_init_pretrained_forbidden": true,
|
| 35 |
"policy_reload_no_pretrained_injection": true,
|
| 36 |
"num_labels": 3,
|
| 37 |
-
"device": "mps"
|
|
|
|
| 38 |
}
|
| 39 |
}
|
|
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
+
"created_at": "20260210_113951",
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/google__efficientnet-b0",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "google/efficientnet-b0",
|
| 33 |
+
"meta_type": "efficientnet",
|
| 34 |
"pretrained_injected": true,
|
| 35 |
"policy_init_pretrained_forbidden": true,
|
| 36 |
"policy_reload_no_pretrained_injection": true,
|
| 37 |
"num_labels": 3,
|
| 38 |
+
"device": "mps",
|
| 39 |
+
"processor_use_fast": false
|
| 40 |
}
|
| 41 |
}
|
models/google__efficientnet-b0/ds_proc.py
CHANGED
|
@@ -35,13 +35,22 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
|
|
|
|
|
|
|
|
|
| 38 |
"""
|
| 39 |
|
| 40 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 41 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 42 |
model_input_names = ["pixel_values"]
|
| 43 |
|
| 44 |
-
def __init__(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 46 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 47 |
super().__init__(**kwargs)
|
|
@@ -59,6 +68,10 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 59 |
self.backbone_name_or_path = backbone_name_or_path
|
| 60 |
self.is_training = bool(is_training)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
# Runtime-only fields: must never be serialized.
|
| 63 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 64 |
self._meta = None
|
|
@@ -109,7 +122,13 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 109 |
|
| 110 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 111 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
@staticmethod
|
| 115 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
@@ -197,6 +216,7 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 197 |
d["image_processor_type"] = self.__class__.__name__
|
| 198 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 199 |
d["is_training"] = self.is_training
|
|
|
|
| 200 |
|
| 201 |
# Remove any runtime-only fields defensively.
|
| 202 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
@@ -216,7 +236,14 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 216 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 217 |
|
| 218 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
@classmethod
|
| 222 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
@@ -237,7 +264,12 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 237 |
|
| 238 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 239 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
# ============================================================
|
| 243 |
# Call interface
|
|
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
| 38 |
+
|
| 39 |
+
4) For reproducibility, use_fast must be explicitly persisted and honored on load.
|
| 40 |
+
์ฌํ์ฑ์ ์ํด use_fast๋ ๋ช
์์ ์ผ๋ก ์ ์ฅ๋๊ณ , ๋ก๋์ ๋ฐ๋์ ๋ฐ์๋์ด์ผ ํฉ๋๋ค.
|
| 41 |
"""
|
| 42 |
|
| 43 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 44 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 45 |
model_input_names = ["pixel_values"]
|
| 46 |
|
| 47 |
+
def __init__(
|
| 48 |
+
self,
|
| 49 |
+
backbone_name_or_path: BackboneID,
|
| 50 |
+
is_training: bool = False,
|
| 51 |
+
use_fast: bool = False,
|
| 52 |
+
**kwargs,
|
| 53 |
+
):
|
| 54 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 55 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 56 |
super().__init__(**kwargs)
|
|
|
|
| 68 |
self.backbone_name_or_path = backbone_name_or_path
|
| 69 |
self.is_training = bool(is_training)
|
| 70 |
|
| 71 |
+
# Reproducibility switch for transformers processors.
|
| 72 |
+
# transformers processor์ fast/slow ์ ํ์ ์ฌํ ๊ฐ๋ฅํ๊ฒ ๊ณ ์ ํฉ๋๋ค.
|
| 73 |
+
self.use_fast = bool(use_fast)
|
| 74 |
+
|
| 75 |
# Runtime-only fields: must never be serialized.
|
| 76 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 77 |
self._meta = None
|
|
|
|
| 122 |
|
| 123 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 124 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 125 |
+
#
|
| 126 |
+
# IMPORTANT:
|
| 127 |
+
# - use_fast๋ transformers ๊ธฐ๋ณธ๊ฐ ๋ณ๊ฒฝ์ ํ๋ค๋ฆฌ์ง ์๋๋ก ๋ฐ๋์ ๋ช
์์ ์ผ๋ก ์ ๋ฌํฉ๋๋ค.
|
| 128 |
+
self._delegate = AutoImageProcessor.from_pretrained(
|
| 129 |
+
self.backbone_name_or_path,
|
| 130 |
+
use_fast=self.use_fast,
|
| 131 |
+
)
|
| 132 |
|
| 133 |
@staticmethod
|
| 134 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
|
|
| 216 |
d["image_processor_type"] = self.__class__.__name__
|
| 217 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 218 |
d["is_training"] = self.is_training
|
| 219 |
+
d["use_fast"] = self.use_fast
|
| 220 |
|
| 221 |
# Remove any runtime-only fields defensively.
|
| 222 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
|
|
| 236 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 237 |
|
| 238 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 239 |
+
use_fast = bool(image_processor_dict.get("use_fast", False))
|
| 240 |
+
|
| 241 |
+
return cls(
|
| 242 |
+
backbone_name_or_path=backbone,
|
| 243 |
+
is_training=is_training,
|
| 244 |
+
use_fast=use_fast,
|
| 245 |
+
**kwargs,
|
| 246 |
+
)
|
| 247 |
|
| 248 |
@classmethod
|
| 249 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
|
|
| 264 |
|
| 265 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 266 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 267 |
+
#
|
| 268 |
+
# IMPORTANT:
|
| 269 |
+
# - use_fast๋ kwargs๋ก ์ ๋ฌ๋ ์ ์์ผ๋ฏ๋ก, ์์ผ๋ฉด ๋ฐ์ํฉ๋๋ค.
|
| 270 |
+
use_fast = bool(kwargs.pop("use_fast", False))
|
| 271 |
+
|
| 272 |
+
return cls(backbone_name_or_path=backbone, is_training=False, use_fast=use_fast)
|
| 273 |
|
| 274 |
# ============================================================
|
| 275 |
# Call interface
|
models/google__efficientnet-b0/model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 17558436
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6b89c592a265df3c45219f864a9f40156e1d72c043aa284abccadd56a7ec41d2
|
| 3 |
size 17558436
|
models/google__efficientnet-b0/preprocessor_config.json
CHANGED
|
@@ -4,5 +4,6 @@
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "google/efficientnet-b0",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
-
"is_training": false
|
|
|
|
| 8 |
}
|
|
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "google/efficientnet-b0",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
+
"is_training": false,
|
| 8 |
+
"use_fast": false
|
| 9 |
}
|
models/google__vit-base-patch16-224/config.json
CHANGED
|
@@ -24,16 +24,18 @@
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
-
"created_at": "
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/google__vit-base-patch16-224",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "google/vit-base-patch16-224",
|
|
|
|
| 33 |
"pretrained_injected": true,
|
| 34 |
"policy_init_pretrained_forbidden": true,
|
| 35 |
"policy_reload_no_pretrained_injection": true,
|
| 36 |
"num_labels": 3,
|
| 37 |
-
"device": "mps"
|
|
|
|
| 38 |
}
|
| 39 |
}
|
|
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
+
"created_at": "20260210_113951",
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/google__vit-base-patch16-224",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "google/vit-base-patch16-224",
|
| 33 |
+
"meta_type": "vit",
|
| 34 |
"pretrained_injected": true,
|
| 35 |
"policy_init_pretrained_forbidden": true,
|
| 36 |
"policy_reload_no_pretrained_injection": true,
|
| 37 |
"num_labels": 3,
|
| 38 |
+
"device": "mps",
|
| 39 |
+
"processor_use_fast": false
|
| 40 |
}
|
| 41 |
}
|
models/google__vit-base-patch16-224/ds_proc.py
CHANGED
|
@@ -35,13 +35,22 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
|
|
|
|
|
|
|
|
|
| 38 |
"""
|
| 39 |
|
| 40 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 41 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 42 |
model_input_names = ["pixel_values"]
|
| 43 |
|
| 44 |
-
def __init__(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 46 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 47 |
super().__init__(**kwargs)
|
|
@@ -59,6 +68,10 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 59 |
self.backbone_name_or_path = backbone_name_or_path
|
| 60 |
self.is_training = bool(is_training)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
# Runtime-only fields: must never be serialized.
|
| 63 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 64 |
self._meta = None
|
|
@@ -109,7 +122,13 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 109 |
|
| 110 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 111 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
@staticmethod
|
| 115 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
@@ -197,6 +216,7 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 197 |
d["image_processor_type"] = self.__class__.__name__
|
| 198 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 199 |
d["is_training"] = self.is_training
|
|
|
|
| 200 |
|
| 201 |
# Remove any runtime-only fields defensively.
|
| 202 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
@@ -216,7 +236,14 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 216 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 217 |
|
| 218 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
@classmethod
|
| 222 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
@@ -237,7 +264,12 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 237 |
|
| 238 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 239 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
# ============================================================
|
| 243 |
# Call interface
|
|
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
| 38 |
+
|
| 39 |
+
4) For reproducibility, use_fast must be explicitly persisted and honored on load.
|
| 40 |
+
์ฌํ์ฑ์ ์ํด use_fast๋ ๋ช
์์ ์ผ๋ก ์ ์ฅ๋๊ณ , ๋ก๋์ ๋ฐ๋์ ๋ฐ์๋์ด์ผ ํฉ๋๋ค.
|
| 41 |
"""
|
| 42 |
|
| 43 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 44 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 45 |
model_input_names = ["pixel_values"]
|
| 46 |
|
| 47 |
+
def __init__(
|
| 48 |
+
self,
|
| 49 |
+
backbone_name_or_path: BackboneID,
|
| 50 |
+
is_training: bool = False,
|
| 51 |
+
use_fast: bool = False,
|
| 52 |
+
**kwargs,
|
| 53 |
+
):
|
| 54 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 55 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 56 |
super().__init__(**kwargs)
|
|
|
|
| 68 |
self.backbone_name_or_path = backbone_name_or_path
|
| 69 |
self.is_training = bool(is_training)
|
| 70 |
|
| 71 |
+
# Reproducibility switch for transformers processors.
|
| 72 |
+
# transformers processor์ fast/slow ์ ํ์ ์ฌํ ๊ฐ๋ฅํ๊ฒ ๊ณ ์ ํฉ๋๋ค.
|
| 73 |
+
self.use_fast = bool(use_fast)
|
| 74 |
+
|
| 75 |
# Runtime-only fields: must never be serialized.
|
| 76 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 77 |
self._meta = None
|
|
|
|
| 122 |
|
| 123 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 124 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 125 |
+
#
|
| 126 |
+
# IMPORTANT:
|
| 127 |
+
# - use_fast๋ transformers ๊ธฐ๋ณธ๊ฐ ๋ณ๊ฒฝ์ ํ๋ค๋ฆฌ์ง ์๋๋ก ๋ฐ๋์ ๋ช
์์ ์ผ๋ก ์ ๋ฌํฉ๋๋ค.
|
| 128 |
+
self._delegate = AutoImageProcessor.from_pretrained(
|
| 129 |
+
self.backbone_name_or_path,
|
| 130 |
+
use_fast=self.use_fast,
|
| 131 |
+
)
|
| 132 |
|
| 133 |
@staticmethod
|
| 134 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
|
|
| 216 |
d["image_processor_type"] = self.__class__.__name__
|
| 217 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 218 |
d["is_training"] = self.is_training
|
| 219 |
+
d["use_fast"] = self.use_fast
|
| 220 |
|
| 221 |
# Remove any runtime-only fields defensively.
|
| 222 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
|
|
| 236 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 237 |
|
| 238 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 239 |
+
use_fast = bool(image_processor_dict.get("use_fast", False))
|
| 240 |
+
|
| 241 |
+
return cls(
|
| 242 |
+
backbone_name_or_path=backbone,
|
| 243 |
+
is_training=is_training,
|
| 244 |
+
use_fast=use_fast,
|
| 245 |
+
**kwargs,
|
| 246 |
+
)
|
| 247 |
|
| 248 |
@classmethod
|
| 249 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
|
|
| 264 |
|
| 265 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 266 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 267 |
+
#
|
| 268 |
+
# IMPORTANT:
|
| 269 |
+
# - use_fast๋ kwargs๋ก ์ ๋ฌ๋ ์ ์์ผ๋ฏ๋ก, ์์ผ๋ฉด ๋ฐ์ํฉ๋๋ค.
|
| 270 |
+
use_fast = bool(kwargs.pop("use_fast", False))
|
| 271 |
+
|
| 272 |
+
return cls(backbone_name_or_path=backbone, is_training=False, use_fast=use_fast)
|
| 273 |
|
| 274 |
# ============================================================
|
| 275 |
# Call interface
|
models/google__vit-base-patch16-224/model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 346372132
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0ca9d22f81f9858ff4c0734428a65604dd178d6ceb937d5759fcef7e15aba8bc
|
| 3 |
size 346372132
|
models/google__vit-base-patch16-224/preprocessor_config.json
CHANGED
|
@@ -4,5 +4,6 @@
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "google/vit-base-patch16-224",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
-
"is_training": false
|
|
|
|
| 8 |
}
|
|
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "google/vit-base-patch16-224",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
+
"is_training": false,
|
| 8 |
+
"use_fast": false
|
| 9 |
}
|
models/microsoft__resnet-50/config.json
CHANGED
|
@@ -24,16 +24,18 @@
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
-
"created_at": "
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/microsoft__resnet-50",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "microsoft/resnet-50",
|
|
|
|
| 33 |
"pretrained_injected": true,
|
| 34 |
"policy_init_pretrained_forbidden": true,
|
| 35 |
"policy_reload_no_pretrained_injection": true,
|
| 36 |
"num_labels": 3,
|
| 37 |
-
"device": "mps"
|
|
|
|
| 38 |
}
|
| 39 |
}
|
|
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
+
"created_at": "20260210_113951",
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/microsoft__resnet-50",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "microsoft/resnet-50",
|
| 33 |
+
"meta_type": "resnet",
|
| 34 |
"pretrained_injected": true,
|
| 35 |
"policy_init_pretrained_forbidden": true,
|
| 36 |
"policy_reload_no_pretrained_injection": true,
|
| 37 |
"num_labels": 3,
|
| 38 |
+
"device": "mps",
|
| 39 |
+
"processor_use_fast": false
|
| 40 |
}
|
| 41 |
}
|
models/microsoft__resnet-50/ds_proc.py
CHANGED
|
@@ -35,13 +35,22 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
|
|
|
|
|
|
|
|
|
| 38 |
"""
|
| 39 |
|
| 40 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 41 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 42 |
model_input_names = ["pixel_values"]
|
| 43 |
|
| 44 |
-
def __init__(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 46 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 47 |
super().__init__(**kwargs)
|
|
@@ -59,6 +68,10 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 59 |
self.backbone_name_or_path = backbone_name_or_path
|
| 60 |
self.is_training = bool(is_training)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
# Runtime-only fields: must never be serialized.
|
| 63 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 64 |
self._meta = None
|
|
@@ -109,7 +122,13 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 109 |
|
| 110 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 111 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
@staticmethod
|
| 115 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
@@ -197,6 +216,7 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 197 |
d["image_processor_type"] = self.__class__.__name__
|
| 198 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 199 |
d["is_training"] = self.is_training
|
|
|
|
| 200 |
|
| 201 |
# Remove any runtime-only fields defensively.
|
| 202 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
@@ -216,7 +236,14 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 216 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 217 |
|
| 218 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
@classmethod
|
| 222 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
@@ -237,7 +264,12 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 237 |
|
| 238 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 239 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
# ============================================================
|
| 243 |
# Call interface
|
|
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
| 38 |
+
|
| 39 |
+
4) For reproducibility, use_fast must be explicitly persisted and honored on load.
|
| 40 |
+
์ฌํ์ฑ์ ์ํด use_fast๋ ๋ช
์์ ์ผ๋ก ์ ์ฅ๋๊ณ , ๋ก๋์ ๋ฐ๋์ ๋ฐ์๋์ด์ผ ํฉ๋๋ค.
|
| 41 |
"""
|
| 42 |
|
| 43 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 44 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 45 |
model_input_names = ["pixel_values"]
|
| 46 |
|
| 47 |
+
def __init__(
|
| 48 |
+
self,
|
| 49 |
+
backbone_name_or_path: BackboneID,
|
| 50 |
+
is_training: bool = False,
|
| 51 |
+
use_fast: bool = False,
|
| 52 |
+
**kwargs,
|
| 53 |
+
):
|
| 54 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 55 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 56 |
super().__init__(**kwargs)
|
|
|
|
| 68 |
self.backbone_name_or_path = backbone_name_or_path
|
| 69 |
self.is_training = bool(is_training)
|
| 70 |
|
| 71 |
+
# Reproducibility switch for transformers processors.
|
| 72 |
+
# transformers processor์ fast/slow ์ ํ์ ์ฌํ ๊ฐ๋ฅํ๊ฒ ๊ณ ์ ํฉ๋๋ค.
|
| 73 |
+
self.use_fast = bool(use_fast)
|
| 74 |
+
|
| 75 |
# Runtime-only fields: must never be serialized.
|
| 76 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 77 |
self._meta = None
|
|
|
|
| 122 |
|
| 123 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 124 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 125 |
+
#
|
| 126 |
+
# IMPORTANT:
|
| 127 |
+
# - use_fast๋ transformers ๊ธฐ๋ณธ๊ฐ ๋ณ๊ฒฝ์ ํ๋ค๋ฆฌ์ง ์๋๋ก ๋ฐ๋์ ๋ช
์์ ์ผ๋ก ์ ๋ฌํฉ๋๋ค.
|
| 128 |
+
self._delegate = AutoImageProcessor.from_pretrained(
|
| 129 |
+
self.backbone_name_or_path,
|
| 130 |
+
use_fast=self.use_fast,
|
| 131 |
+
)
|
| 132 |
|
| 133 |
@staticmethod
|
| 134 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
|
|
| 216 |
d["image_processor_type"] = self.__class__.__name__
|
| 217 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 218 |
d["is_training"] = self.is_training
|
| 219 |
+
d["use_fast"] = self.use_fast
|
| 220 |
|
| 221 |
# Remove any runtime-only fields defensively.
|
| 222 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
|
|
| 236 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 237 |
|
| 238 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 239 |
+
use_fast = bool(image_processor_dict.get("use_fast", False))
|
| 240 |
+
|
| 241 |
+
return cls(
|
| 242 |
+
backbone_name_or_path=backbone,
|
| 243 |
+
is_training=is_training,
|
| 244 |
+
use_fast=use_fast,
|
| 245 |
+
**kwargs,
|
| 246 |
+
)
|
| 247 |
|
| 248 |
@classmethod
|
| 249 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
|
|
| 264 |
|
| 265 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 266 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 267 |
+
#
|
| 268 |
+
# IMPORTANT:
|
| 269 |
+
# - use_fast๋ kwargs๋ก ์ ๋ฌ๋ ์ ์์ผ๋ฏ๋ก, ์์ผ๋ฉด ๋ฐ์ํฉ๋๋ค.
|
| 270 |
+
use_fast = bool(kwargs.pop("use_fast", False))
|
| 271 |
+
|
| 272 |
+
return cls(backbone_name_or_path=backbone, is_training=False, use_fast=use_fast)
|
| 273 |
|
| 274 |
# ============================================================
|
| 275 |
# Call interface
|
models/microsoft__resnet-50/model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 96388660
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5ee43d5448edadf03eb7a01e7ef9248ebf4713d31babfb6f59985b0401b5d1f2
|
| 3 |
size 96388660
|
models/microsoft__resnet-50/preprocessor_config.json
CHANGED
|
@@ -4,5 +4,6 @@
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "microsoft/resnet-50",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
-
"is_training": false
|
|
|
|
| 8 |
}
|
|
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "microsoft/resnet-50",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
+
"is_training": false,
|
| 8 |
+
"use_fast": false
|
| 9 |
}
|
models/microsoft__swin-tiny-patch4-window7-224/config.json
CHANGED
|
@@ -24,16 +24,18 @@
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
-
"created_at": "
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/microsoft__swin-tiny-patch4-window7-224",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "microsoft/swin-tiny-patch4-window7-224",
|
|
|
|
| 33 |
"pretrained_injected": true,
|
| 34 |
"policy_init_pretrained_forbidden": true,
|
| 35 |
"policy_reload_no_pretrained_injection": true,
|
| 36 |
"num_labels": 3,
|
| 37 |
-
"device": "mps"
|
|
|
|
| 38 |
}
|
| 39 |
}
|
|
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
+
"created_at": "20260210_113951",
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/microsoft__swin-tiny-patch4-window7-224",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "microsoft/swin-tiny-patch4-window7-224",
|
| 33 |
+
"meta_type": "swin",
|
| 34 |
"pretrained_injected": true,
|
| 35 |
"policy_init_pretrained_forbidden": true,
|
| 36 |
"policy_reload_no_pretrained_injection": true,
|
| 37 |
"num_labels": 3,
|
| 38 |
+
"device": "mps",
|
| 39 |
+
"processor_use_fast": false
|
| 40 |
}
|
| 41 |
}
|
models/microsoft__swin-tiny-patch4-window7-224/ds_proc.py
CHANGED
|
@@ -35,13 +35,22 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
|
|
|
|
|
|
|
|
|
| 38 |
"""
|
| 39 |
|
| 40 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 41 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 42 |
model_input_names = ["pixel_values"]
|
| 43 |
|
| 44 |
-
def __init__(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 46 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 47 |
super().__init__(**kwargs)
|
|
@@ -59,6 +68,10 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 59 |
self.backbone_name_or_path = backbone_name_or_path
|
| 60 |
self.is_training = bool(is_training)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
# Runtime-only fields: must never be serialized.
|
| 63 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 64 |
self._meta = None
|
|
@@ -109,7 +122,13 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 109 |
|
| 110 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 111 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
@staticmethod
|
| 115 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
@@ -197,6 +216,7 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 197 |
d["image_processor_type"] = self.__class__.__name__
|
| 198 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 199 |
d["is_training"] = self.is_training
|
|
|
|
| 200 |
|
| 201 |
# Remove any runtime-only fields defensively.
|
| 202 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
@@ -216,7 +236,14 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 216 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 217 |
|
| 218 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
@classmethod
|
| 222 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
@@ -237,7 +264,12 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 237 |
|
| 238 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 239 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
# ============================================================
|
| 243 |
# Call interface
|
|
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
| 38 |
+
|
| 39 |
+
4) For reproducibility, use_fast must be explicitly persisted and honored on load.
|
| 40 |
+
์ฌํ์ฑ์ ์ํด use_fast๋ ๋ช
์์ ์ผ๋ก ์ ์ฅ๋๊ณ , ๋ก๋์ ๋ฐ๋์ ๋ฐ์๋์ด์ผ ํฉ๋๋ค.
|
| 41 |
"""
|
| 42 |
|
| 43 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 44 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 45 |
model_input_names = ["pixel_values"]
|
| 46 |
|
| 47 |
+
def __init__(
|
| 48 |
+
self,
|
| 49 |
+
backbone_name_or_path: BackboneID,
|
| 50 |
+
is_training: bool = False,
|
| 51 |
+
use_fast: bool = False,
|
| 52 |
+
**kwargs,
|
| 53 |
+
):
|
| 54 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 55 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 56 |
super().__init__(**kwargs)
|
|
|
|
| 68 |
self.backbone_name_or_path = backbone_name_or_path
|
| 69 |
self.is_training = bool(is_training)
|
| 70 |
|
| 71 |
+
# Reproducibility switch for transformers processors.
|
| 72 |
+
# transformers processor์ fast/slow ์ ํ์ ์ฌํ ๊ฐ๋ฅํ๊ฒ ๊ณ ์ ํฉ๋๋ค.
|
| 73 |
+
self.use_fast = bool(use_fast)
|
| 74 |
+
|
| 75 |
# Runtime-only fields: must never be serialized.
|
| 76 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 77 |
self._meta = None
|
|
|
|
| 122 |
|
| 123 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 124 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 125 |
+
#
|
| 126 |
+
# IMPORTANT:
|
| 127 |
+
# - use_fast๋ transformers ๊ธฐ๋ณธ๊ฐ ๋ณ๊ฒฝ์ ํ๋ค๋ฆฌ์ง ์๋๋ก ๋ฐ๋์ ๋ช
์์ ์ผ๋ก ์ ๋ฌํฉ๋๋ค.
|
| 128 |
+
self._delegate = AutoImageProcessor.from_pretrained(
|
| 129 |
+
self.backbone_name_or_path,
|
| 130 |
+
use_fast=self.use_fast,
|
| 131 |
+
)
|
| 132 |
|
| 133 |
@staticmethod
|
| 134 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
|
|
| 216 |
d["image_processor_type"] = self.__class__.__name__
|
| 217 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 218 |
d["is_training"] = self.is_training
|
| 219 |
+
d["use_fast"] = self.use_fast
|
| 220 |
|
| 221 |
# Remove any runtime-only fields defensively.
|
| 222 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
|
|
| 236 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 237 |
|
| 238 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 239 |
+
use_fast = bool(image_processor_dict.get("use_fast", False))
|
| 240 |
+
|
| 241 |
+
return cls(
|
| 242 |
+
backbone_name_or_path=backbone,
|
| 243 |
+
is_training=is_training,
|
| 244 |
+
use_fast=use_fast,
|
| 245 |
+
**kwargs,
|
| 246 |
+
)
|
| 247 |
|
| 248 |
@classmethod
|
| 249 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
|
|
| 264 |
|
| 265 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 266 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 267 |
+
#
|
| 268 |
+
# IMPORTANT:
|
| 269 |
+
# - use_fast๋ kwargs๋ก ์ ๋ฌ๋ ์ ์์ผ๋ฏ๋ก, ์์ผ๋ฉด ๋ฐ์ํฉ๋๋ค.
|
| 270 |
+
use_fast = bool(kwargs.pop("use_fast", False))
|
| 271 |
+
|
| 272 |
+
return cls(backbone_name_or_path=backbone, is_training=False, use_fast=use_fast)
|
| 273 |
|
| 274 |
# ============================================================
|
| 275 |
# Call interface
|
models/microsoft__swin-tiny-patch4-window7-224/model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 111128348
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:52509f874cadf1f0a3889ff8bd4e6de809877596a215138307c1c66ba6e8055e
|
| 3 |
size 111128348
|
models/microsoft__swin-tiny-patch4-window7-224/preprocessor_config.json
CHANGED
|
@@ -4,5 +4,6 @@
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "microsoft/swin-tiny-patch4-window7-224",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
-
"is_training": false
|
|
|
|
| 8 |
}
|
|
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "microsoft/swin-tiny-patch4-window7-224",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
+
"is_training": false,
|
| 8 |
+
"use_fast": false
|
| 9 |
}
|
models/timm__densenet121.tv_in1k/config.json
CHANGED
|
@@ -24,16 +24,18 @@
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
-
"created_at": "
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/timm__densenet121.tv_in1k",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "timm/densenet121.tv_in1k",
|
|
|
|
| 33 |
"pretrained_injected": true,
|
| 34 |
"policy_init_pretrained_forbidden": true,
|
| 35 |
"policy_reload_no_pretrained_injection": true,
|
| 36 |
"num_labels": 3,
|
| 37 |
-
"device": "mps"
|
|
|
|
| 38 |
}
|
| 39 |
}
|
|
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
+
"created_at": "20260210_113951",
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/timm__densenet121.tv_in1k",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "timm/densenet121.tv_in1k",
|
| 33 |
+
"meta_type": "timm_densenet",
|
| 34 |
"pretrained_injected": true,
|
| 35 |
"policy_init_pretrained_forbidden": true,
|
| 36 |
"policy_reload_no_pretrained_injection": true,
|
| 37 |
"num_labels": 3,
|
| 38 |
+
"device": "mps",
|
| 39 |
+
"processor_use_fast": false
|
| 40 |
}
|
| 41 |
}
|
models/timm__densenet121.tv_in1k/ds_proc.py
CHANGED
|
@@ -35,13 +35,22 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
|
|
|
|
|
|
|
|
|
| 38 |
"""
|
| 39 |
|
| 40 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 41 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 42 |
model_input_names = ["pixel_values"]
|
| 43 |
|
| 44 |
-
def __init__(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 46 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 47 |
super().__init__(**kwargs)
|
|
@@ -59,6 +68,10 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 59 |
self.backbone_name_or_path = backbone_name_or_path
|
| 60 |
self.is_training = bool(is_training)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
# Runtime-only fields: must never be serialized.
|
| 63 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 64 |
self._meta = None
|
|
@@ -109,7 +122,13 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 109 |
|
| 110 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 111 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
@staticmethod
|
| 115 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
@@ -197,6 +216,7 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 197 |
d["image_processor_type"] = self.__class__.__name__
|
| 198 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 199 |
d["is_training"] = self.is_training
|
|
|
|
| 200 |
|
| 201 |
# Remove any runtime-only fields defensively.
|
| 202 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
@@ -216,7 +236,14 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 216 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 217 |
|
| 218 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
@classmethod
|
| 222 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
@@ -237,7 +264,12 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 237 |
|
| 238 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 239 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
# ============================================================
|
| 243 |
# Call interface
|
|
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
| 38 |
+
|
| 39 |
+
4) For reproducibility, use_fast must be explicitly persisted and honored on load.
|
| 40 |
+
์ฌํ์ฑ์ ์ํด use_fast๋ ๋ช
์์ ์ผ๋ก ์ ์ฅ๋๊ณ , ๋ก๋์ ๋ฐ๋์ ๋ฐ์๋์ด์ผ ํฉ๋๋ค.
|
| 41 |
"""
|
| 42 |
|
| 43 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 44 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 45 |
model_input_names = ["pixel_values"]
|
| 46 |
|
| 47 |
+
def __init__(
|
| 48 |
+
self,
|
| 49 |
+
backbone_name_or_path: BackboneID,
|
| 50 |
+
is_training: bool = False,
|
| 51 |
+
use_fast: bool = False,
|
| 52 |
+
**kwargs,
|
| 53 |
+
):
|
| 54 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 55 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 56 |
super().__init__(**kwargs)
|
|
|
|
| 68 |
self.backbone_name_or_path = backbone_name_or_path
|
| 69 |
self.is_training = bool(is_training)
|
| 70 |
|
| 71 |
+
# Reproducibility switch for transformers processors.
|
| 72 |
+
# transformers processor์ fast/slow ์ ํ์ ์ฌํ ๊ฐ๋ฅํ๊ฒ ๊ณ ์ ํฉ๋๋ค.
|
| 73 |
+
self.use_fast = bool(use_fast)
|
| 74 |
+
|
| 75 |
# Runtime-only fields: must never be serialized.
|
| 76 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 77 |
self._meta = None
|
|
|
|
| 122 |
|
| 123 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 124 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 125 |
+
#
|
| 126 |
+
# IMPORTANT:
|
| 127 |
+
# - use_fast๋ transformers ๊ธฐ๋ณธ๊ฐ ๋ณ๊ฒฝ์ ํ๋ค๋ฆฌ์ง ์๋๋ก ๋ฐ๋์ ๋ช
์์ ์ผ๋ก ์ ๋ฌํฉ๋๋ค.
|
| 128 |
+
self._delegate = AutoImageProcessor.from_pretrained(
|
| 129 |
+
self.backbone_name_or_path,
|
| 130 |
+
use_fast=self.use_fast,
|
| 131 |
+
)
|
| 132 |
|
| 133 |
@staticmethod
|
| 134 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
|
|
| 216 |
d["image_processor_type"] = self.__class__.__name__
|
| 217 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 218 |
d["is_training"] = self.is_training
|
| 219 |
+
d["use_fast"] = self.use_fast
|
| 220 |
|
| 221 |
# Remove any runtime-only fields defensively.
|
| 222 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
|
|
| 236 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 237 |
|
| 238 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 239 |
+
use_fast = bool(image_processor_dict.get("use_fast", False))
|
| 240 |
+
|
| 241 |
+
return cls(
|
| 242 |
+
backbone_name_or_path=backbone,
|
| 243 |
+
is_training=is_training,
|
| 244 |
+
use_fast=use_fast,
|
| 245 |
+
**kwargs,
|
| 246 |
+
)
|
| 247 |
|
| 248 |
@classmethod
|
| 249 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
|
|
| 264 |
|
| 265 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 266 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 267 |
+
#
|
| 268 |
+
# IMPORTANT:
|
| 269 |
+
# - use_fast๋ kwargs๋ก ์ ๋ฌ๋ ์ ์์ผ๋ฏ๋ก, ์์ผ๋ฉด ๋ฐ์ํฉ๋๋ค.
|
| 270 |
+
use_fast = bool(kwargs.pop("use_fast", False))
|
| 271 |
+
|
| 272 |
+
return cls(backbone_name_or_path=backbone, is_training=False, use_fast=use_fast)
|
| 273 |
|
| 274 |
# ============================================================
|
| 275 |
# Call interface
|
models/timm__densenet121.tv_in1k/model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 29293620
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cbb8c09fbf696346234b700625e6649405512e1c8e6abbc22c15f5edf4da6212
|
| 3 |
size 29293620
|
models/timm__densenet121.tv_in1k/preprocessor_config.json
CHANGED
|
@@ -4,5 +4,6 @@
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "timm/densenet121.tv_in1k",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
-
"is_training": false
|
|
|
|
| 8 |
}
|
|
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "timm/densenet121.tv_in1k",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
+
"is_training": false,
|
| 8 |
+
"use_fast": false
|
| 9 |
}
|
models/torchvision__densenet121/config.json
CHANGED
|
@@ -24,16 +24,18 @@
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
-
"created_at": "
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/torchvision__densenet121",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "torchvision/densenet121",
|
|
|
|
| 33 |
"pretrained_injected": true,
|
| 34 |
"policy_init_pretrained_forbidden": true,
|
| 35 |
"policy_reload_no_pretrained_injection": true,
|
| 36 |
"num_labels": 3,
|
| 37 |
-
"device": "mps"
|
|
|
|
| 38 |
}
|
| 39 |
}
|
|
|
|
| 24 |
"num_labels": 3,
|
| 25 |
"transformers_version": "5.1.0",
|
| 26 |
"ds_provenance": {
|
| 27 |
+
"created_at": "20260210_113951",
|
| 28 |
"repo_id": "dsaint31/bb_mlp_224",
|
| 29 |
"subdir": "models/torchvision__densenet121",
|
| 30 |
"wrapper_class": "BackboneWithMLPHeadForImageClassification",
|
| 31 |
"processor_class": "BackboneMLPHead224ImageProcessor",
|
| 32 |
"backbone_id": "torchvision/densenet121",
|
| 33 |
+
"meta_type": "torchvision_densenet",
|
| 34 |
"pretrained_injected": true,
|
| 35 |
"policy_init_pretrained_forbidden": true,
|
| 36 |
"policy_reload_no_pretrained_injection": true,
|
| 37 |
"num_labels": 3,
|
| 38 |
+
"device": "mps",
|
| 39 |
+
"processor_use_fast": false
|
| 40 |
}
|
| 41 |
}
|
models/torchvision__densenet121/ds_proc.py
CHANGED
|
@@ -35,13 +35,22 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
|
|
|
|
|
|
|
|
|
| 38 |
"""
|
| 39 |
|
| 40 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 41 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 42 |
model_input_names = ["pixel_values"]
|
| 43 |
|
| 44 |
-
def __init__(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 46 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 47 |
super().__init__(**kwargs)
|
|
@@ -59,6 +68,10 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 59 |
self.backbone_name_or_path = backbone_name_or_path
|
| 60 |
self.is_training = bool(is_training)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
# Runtime-only fields: must never be serialized.
|
| 63 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 64 |
self._meta = None
|
|
@@ -109,7 +122,13 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 109 |
|
| 110 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 111 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
@staticmethod
|
| 115 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
@@ -197,6 +216,7 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 197 |
d["image_processor_type"] = self.__class__.__name__
|
| 198 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 199 |
d["is_training"] = self.is_training
|
|
|
|
| 200 |
|
| 201 |
# Remove any runtime-only fields defensively.
|
| 202 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
@@ -216,7 +236,14 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 216 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 217 |
|
| 218 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
|
| 221 |
@classmethod
|
| 222 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
@@ -237,7 +264,12 @@ class BackboneMLPHead224ImageProcessor(ImageProcessingMixin):
|
|
| 237 |
|
| 238 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 239 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
# ============================================================
|
| 243 |
# Call interface
|
|
|
|
| 35 |
|
| 36 |
3) Runtime objects are rebuilt at init/load time based on backbone meta.
|
| 37 |
๋ฐํ์ ๊ฐ์ฒด๋ backbone meta์ ๋ฐ๋ผ init/load ์์ ์ ์ฌ๊ตฌ์ฑ๋ฉ๋๋ค.
|
| 38 |
+
|
| 39 |
+
4) For reproducibility, use_fast must be explicitly persisted and honored on load.
|
| 40 |
+
์ฌํ์ฑ์ ์ํด use_fast๋ ๋ช
์์ ์ผ๋ก ์ ์ฅ๋๊ณ , ๋ก๋์ ๋ฐ๋์ ๋ฐ์๋์ด์ผ ํฉ๋๋ค.
|
| 41 |
"""
|
| 42 |
|
| 43 |
# HF vision models conventionally expect "pixel_values" as the primary input key.
|
| 44 |
# HF vision ๋ชจ๋ธ์ ๊ด๋ก์ ์ผ๋ก ์
๋ ฅ ํค๋ก "pixel_values"๋ฅผ ๊ธฐ๋ํฉ๋๋ค.
|
| 45 |
model_input_names = ["pixel_values"]
|
| 46 |
|
| 47 |
+
def __init__(
|
| 48 |
+
self,
|
| 49 |
+
backbone_name_or_path: BackboneID,
|
| 50 |
+
is_training: bool = False,
|
| 51 |
+
use_fast: bool = False,
|
| 52 |
+
**kwargs,
|
| 53 |
+
):
|
| 54 |
# ImageProcessingMixin stores extra kwargs and manages auto_map metadata.
|
| 55 |
# ImageProcessingMixin์ ์ถ๊ฐ kwargs๋ฅผ ์ ์ฅํ๊ณ auto_map ๋ฉํ๋ฅผ ๊ด๋ฆฌํฉ๋๋ค.
|
| 56 |
super().__init__(**kwargs)
|
|
|
|
| 68 |
self.backbone_name_or_path = backbone_name_or_path
|
| 69 |
self.is_training = bool(is_training)
|
| 70 |
|
| 71 |
+
# Reproducibility switch for transformers processors.
|
| 72 |
+
# transformers processor์ fast/slow ์ ํ์ ์ฌํ ๊ฐ๋ฅํ๊ฒ ๊ณ ์ ํฉ๋๋ค.
|
| 73 |
+
self.use_fast = bool(use_fast)
|
| 74 |
+
|
| 75 |
# Runtime-only fields: must never be serialized.
|
| 76 |
# ๋ฐํ์ ์ ์ฉ ํ๋: ์ ๋ ์ง๋ ฌํ๋๋ฉด ์ ๋ฉ๋๋ค.
|
| 77 |
self._meta = None
|
|
|
|
| 122 |
|
| 123 |
# Default: transformers backbone delegates to its official AutoImageProcessor.
|
| 124 |
# ๊ธฐ๋ณธ: transformers ๋ฐฑ๋ณธ์ ๊ณต์ AutoImageProcessor์ ์์ํฉ๋๋ค.
|
| 125 |
+
#
|
| 126 |
+
# IMPORTANT:
|
| 127 |
+
# - use_fast๋ transformers ๊ธฐ๋ณธ๊ฐ ๋ณ๊ฒฝ์ ํ๋ค๋ฆฌ์ง ์๋๋ก ๋ฐ๋์ ๋ช
์์ ์ผ๋ก ์ ๋ฌํฉ๋๋ค.
|
| 128 |
+
self._delegate = AutoImageProcessor.from_pretrained(
|
| 129 |
+
self.backbone_name_or_path,
|
| 130 |
+
use_fast=self.use_fast,
|
| 131 |
+
)
|
| 132 |
|
| 133 |
@staticmethod
|
| 134 |
def _build_timm_transform(*, backbone_id: str, is_training: bool):
|
|
|
|
| 216 |
d["image_processor_type"] = self.__class__.__name__
|
| 217 |
d["backbone_name_or_path"] = self.backbone_name_or_path
|
| 218 |
d["is_training"] = self.is_training
|
| 219 |
+
d["use_fast"] = self.use_fast
|
| 220 |
|
| 221 |
# Remove any runtime-only fields defensively.
|
| 222 |
# ๋ฐํ์ ์ ์ฉ ํ๋๋ ๋ณด์์ ์ผ๋ก ์ ๊ฑฐํฉ๋๋ค.
|
|
|
|
| 236 |
raise ValueError("preprocessor_config.json missing key: backbone_name_or_path")
|
| 237 |
|
| 238 |
is_training = bool(image_processor_dict.get("is_training", False))
|
| 239 |
+
use_fast = bool(image_processor_dict.get("use_fast", False))
|
| 240 |
+
|
| 241 |
+
return cls(
|
| 242 |
+
backbone_name_or_path=backbone,
|
| 243 |
+
is_training=is_training,
|
| 244 |
+
use_fast=use_fast,
|
| 245 |
+
**kwargs,
|
| 246 |
+
)
|
| 247 |
|
| 248 |
@classmethod
|
| 249 |
def from_pretrained(cls, pretrained_model_name_or_path: str, **kwargs):
|
|
|
|
| 264 |
|
| 265 |
# is_training is runtime-only and should default to False for inference/serving.
|
| 266 |
# is_training์ ๋ฐํ์ ์ ์ฉ์ด๋ฉฐ ์ถ๋ก /์๋น ๊ธฐ๋ณธ๊ฐ์ False๊ฐ ๋ง์ต๋๋ค.
|
| 267 |
+
#
|
| 268 |
+
# IMPORTANT:
|
| 269 |
+
# - use_fast๋ kwargs๋ก ์ ๋ฌ๋ ์ ์์ผ๋ฏ๋ก, ์์ผ๋ฉด ๋ฐ์ํฉ๋๋ค.
|
| 270 |
+
use_fast = bool(kwargs.pop("use_fast", False))
|
| 271 |
+
|
| 272 |
+
return cls(backbone_name_or_path=backbone, is_training=False, use_fast=use_fast)
|
| 273 |
|
| 274 |
# ============================================================
|
| 275 |
# Call interface
|
models/torchvision__densenet121/model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 33394052
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e5c4ad5ea10f956a0ead9687834bf22225e978714b4d059980dd3013b0a190ad
|
| 3 |
size 33394052
|
models/torchvision__densenet121/preprocessor_config.json
CHANGED
|
@@ -4,5 +4,6 @@
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "torchvision/densenet121",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
-
"is_training": false
|
|
|
|
| 8 |
}
|
|
|
|
| 4 |
},
|
| 5 |
"backbone_name_or_path": "torchvision/densenet121",
|
| 6 |
"image_processor_type": "BackboneMLPHead224ImageProcessor",
|
| 7 |
+
"is_training": false,
|
| 8 |
+
"use_fast": false
|
| 9 |
}
|