Spaces:
Sleeping
Sleeping
Update inference.py
Browse files- inference.py +9 -5
inference.py
CHANGED
|
@@ -694,12 +694,16 @@ class GenerativeInferenceModel:
|
|
| 694 |
|
| 695 |
# Prepare image tensor - match original code's conditional transform
|
| 696 |
load_start = time.time()
|
| 697 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 698 |
custom_transform = get_transform(
|
| 699 |
-
input_size=
|
| 700 |
-
normalize=
|
| 701 |
-
norm_mean=
|
| 702 |
-
norm_std=
|
| 703 |
)
|
| 704 |
|
| 705 |
# Special handling for GradModulation as in original
|
|
|
|
| 694 |
|
| 695 |
# Prepare image tensor - match original code's conditional transform
|
| 696 |
load_start = time.time()
|
| 697 |
+
# Pick the right preproc for this model
|
| 698 |
+
pre = self.model_preproc.get(model_type, {"size": 224, "mean": IMAGENET_MEAN, "std": IMAGENET_STD})
|
| 699 |
+
|
| 700 |
+
# IMPORTANT: the model already includes a NormalizeByChannelMeanStd as layer 0,
|
| 701 |
+
# so do NOT normalize again here, or you’ll double-normalize.
|
| 702 |
custom_transform = get_transform(
|
| 703 |
+
input_size=pre["size"], # 112 for resnet50_robust_face
|
| 704 |
+
normalize=False, # leave False; model handles normalization internally
|
| 705 |
+
norm_mean=pre["mean"],
|
| 706 |
+
norm_std=pre["std"]
|
| 707 |
)
|
| 708 |
|
| 709 |
# Special handling for GradModulation as in original
|