Update app.py
Browse files
app.py
CHANGED
|
@@ -428,18 +428,20 @@ def load_txt2img(model_id):
|
|
| 428 |
"safety_checker": None,
|
| 429 |
"requires_safety_checker": False,
|
| 430 |
"add_watermarker": False,
|
| 431 |
-
"allow_pickle": True,
|
| 432 |
"cache_dir": "/tmp/models", # Für Hugging Face Spaces
|
| 433 |
-
"use_safetensors": False # Sichereres Format
|
| 434 |
}
|
| 435 |
|
| 436 |
# Die Modelle haben unterscgiedliche Gewichtsformate. Safetensors neu und schneller Zugriff!
|
| 437 |
-
if model_id
|
| 438 |
-
model_params["
|
| 439 |
-
print(f"ℹ️ Verwende safetensors für {model_id}")
|
| 440 |
-
else:
|
| 441 |
model_params["use_safetensors"] = False
|
| 442 |
-
print(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
|
| 444 |
if config.get("supports_fp16", False) and torch_dtype == torch.float16:
|
| 445 |
model_params["variant"] = "fp16"
|
|
|
|
| 428 |
"safety_checker": None,
|
| 429 |
"requires_safety_checker": False,
|
| 430 |
"add_watermarker": False,
|
|
|
|
| 431 |
"cache_dir": "/tmp/models", # Für Hugging Face Spaces
|
|
|
|
| 432 |
}
|
| 433 |
|
| 434 |
# Die Modelle haben unterscgiedliche Gewichtsformate. Safetensors neu und schneller Zugriff!
|
| 435 |
+
if model_id == "SG161222/Realistic_Vision_V6.0_B1_noVAE":
|
| 436 |
+
model_params["allow_pickle"] = False # WICHTIG für PyTorch 2.6
|
|
|
|
|
|
|
| 437 |
model_params["use_safetensors"] = False
|
| 438 |
+
print("⚠️ Realistic Vision Modell - Nutzt .bin-Dateien.")
|
| 439 |
+
else:
|
| 440 |
+
model_params["allow_pickle"] = True
|
| 441 |
+
model_params["use_safetensors"] = True
|
| 442 |
+
model_params["variant"] = "fp16"
|
| 443 |
+
print("✅ Verwende SafeTensors für sicheres Laden.")
|
| 444 |
+
|
| 445 |
|
| 446 |
if config.get("supports_fp16", False) and torch_dtype == torch.float16:
|
| 447 |
model_params["variant"] = "fp16"
|