dsaint31 commited on
Commit
7ddb6f9
ยท
verified ยท
1 Parent(s): e59dbaa

Add/Update backbone checkpoints (count=6)

Browse files
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": "20260210_111913",
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__(self, backbone_name_or_path: BackboneID, is_training: bool = False, **kwargs):
 
 
 
 
 
 
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
- self._delegate = AutoImageProcessor.from_pretrained(self.backbone_name_or_path)
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=is_training, **kwargs)
 
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=False)
 
 
 
 
 
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:01add885928661dde020c6cc5adaf1e6b8d6684a9effa7ef2903ac8d03fc9a5c
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": "20260210_111913",
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__(self, backbone_name_or_path: BackboneID, is_training: bool = False, **kwargs):
 
 
 
 
 
 
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
- self._delegate = AutoImageProcessor.from_pretrained(self.backbone_name_or_path)
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=is_training, **kwargs)
 
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=False)
 
 
 
 
 
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:5ca403809fcb589b9b176f4712c6f6aa3c31d2cb7465aaaa6cd4391d46947e8e
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": "20260210_111913",
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__(self, backbone_name_or_path: BackboneID, is_training: bool = False, **kwargs):
 
 
 
 
 
 
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
- self._delegate = AutoImageProcessor.from_pretrained(self.backbone_name_or_path)
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=is_training, **kwargs)
 
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=False)
 
 
 
 
 
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:229f77319aec60efa8fff986455e304b9f4f2d46440550b69490da095a11d170
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": "20260210_111913",
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__(self, backbone_name_or_path: BackboneID, is_training: bool = False, **kwargs):
 
 
 
 
 
 
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
- self._delegate = AutoImageProcessor.from_pretrained(self.backbone_name_or_path)
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=is_training, **kwargs)
 
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=False)
 
 
 
 
 
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:61d4b000d39bc1301116050226ee05a3cc3851359f4dc38febbb5f397fbb844f
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": "20260210_111913",
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__(self, backbone_name_or_path: BackboneID, is_training: bool = False, **kwargs):
 
 
 
 
 
 
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
- self._delegate = AutoImageProcessor.from_pretrained(self.backbone_name_or_path)
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=is_training, **kwargs)
 
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=False)
 
 
 
 
 
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:53c62717fc23ff4a775482d0f9ca8c730a2c04681a9eeefa01864847d713aa9f
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": "20260210_111913",
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__(self, backbone_name_or_path: BackboneID, is_training: bool = False, **kwargs):
 
 
 
 
 
 
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
- self._delegate = AutoImageProcessor.from_pretrained(self.backbone_name_or_path)
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=is_training, **kwargs)
 
 
 
 
 
 
 
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
- return cls(backbone_name_or_path=backbone, is_training=False)
 
 
 
 
 
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:e8431398f3461657aea5362b326d351fcdd4c5c009bf126765d0dcd60f94aa72
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
  }