AkashKumarave commited on
Commit
f4836de
·
verified ·
1 Parent(s): a3c77b4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -19
app.py CHANGED
@@ -7,7 +7,6 @@ from insightface.app import FaceAnalysis
7
  from huggingface_hub import hf_hub_download
8
  import os
9
  import logging
10
- from safetensors.torch import load_file
11
  import time
12
 
13
  # Set up detailed logging
@@ -63,18 +62,11 @@ def download_file(repo_id, filename, local_dir, max_retries=3):
63
  return file_path
64
 
65
  # Define paths
66
- kolors_unet_path = "./unet"
67
  ip_adapter_path = "./"
68
- os.makedirs(kolors_unet_path, exist_ok=True)
69
  os.makedirs(ip_adapter_path, exist_ok=True)
70
 
71
- # Download weights with retries
72
  logger.info("Starting weights download...")
73
- kolors_weights = download_file(
74
- "Kwai-Kolors/Kolors",
75
- "unet/diffusion_pytorch_model.fp16.safetensors",
76
- kolors_unet_path
77
- )
78
  ip_adapter_weights = download_file(
79
  "Kwai-Kolors/Kolors-IP-Adapter-FaceID-Plus",
80
  "ipa-faceid-plus.bin",
@@ -110,16 +102,6 @@ except Exception as e:
110
  logger.error(f"Failed to load SDXL base model: {e}")
111
  raise
112
 
113
- # Load Kolors unet weights with strict=False
114
- logger.info(f"Loading Kolors unet weights from {kolors_weights}...")
115
- try:
116
- state_dict = load_file(kolors_weights, device=device)
117
- pipe.unet.load_state_dict(state_dict, strict=False)
118
- logger.info("Kolors unet weights loaded successfully (with ignored mismatches).")
119
- except Exception as e:
120
- logger.error(f"Failed to load Kolors unet weights: {e}")
121
- raise
122
-
123
  # Load IP-Adapter
124
  logger.info(f"Loading IP-Adapter from {ip_adapter_weights}...")
125
  try:
 
7
  from huggingface_hub import hf_hub_download
8
  import os
9
  import logging
 
10
  import time
11
 
12
  # Set up detailed logging
 
62
  return file_path
63
 
64
  # Define paths
 
65
  ip_adapter_path = "./"
 
66
  os.makedirs(ip_adapter_path, exist_ok=True)
67
 
68
+ # Download IP-Adapter weights with retries
69
  logger.info("Starting weights download...")
 
 
 
 
 
70
  ip_adapter_weights = download_file(
71
  "Kwai-Kolors/Kolors-IP-Adapter-FaceID-Plus",
72
  "ipa-faceid-plus.bin",
 
102
  logger.error(f"Failed to load SDXL base model: {e}")
103
  raise
104
 
 
 
 
 
 
 
 
 
 
 
105
  # Load IP-Adapter
106
  logger.info(f"Loading IP-Adapter from {ip_adapter_weights}...")
107
  try: