Benrise commited on
Commit
9366128
·
1 Parent(s): ebe744a

Minor fix

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -67,18 +67,18 @@ def load_models():
67
  subfolder="unet"
68
  )
69
 
70
- checkpoint_path = os.path.join(CHECKPOINT_DIR, "pytorch_model.bin")
71
- if not os.path.exists(checkpoint_path):
72
  print("⏳ Загрузка чекпоинта модели...")
73
- hf_hub_download(
74
  repo_id="Benrise/VITON-HD",
75
  filename="VITONHD/model/pytorch_model.bin",
76
- token=TOKEN,
77
- local_dir=CHECKPOINT_DIR,
78
- force_filename="pytorch_model.bin"
79
  )
80
-
81
- unet.load_state_dict(torch.load(checkpoint_path))
 
 
82
 
83
  cloth_encoder = ClothEncoder.from_pretrained(
84
  "stabilityai/stable-diffusion-xl-base-1.0",
 
67
  subfolder="unet"
68
  )
69
 
70
+ unet_checkpoint_path = os.path.join(CHECKPOINT_DIR, "pytorch_model.bin")
71
+ if not os.path.exists(unet_checkpoint_path):
72
  print("⏳ Загрузка чекпоинта модели...")
73
+ temp_path = hf_hub_download(
74
  repo_id="Benrise/VITON-HD",
75
  filename="VITONHD/model/pytorch_model.bin",
76
+ token=TOKEN
 
 
77
  )
78
+ import shutil
79
+ shutil.copy(temp_path, unet_checkpoint_path)
80
+ print(f"✅ Файл успешно сохранён по пути: {unet_checkpoint_path}")
81
+ unet.load_state_dict(torch.load(unet_checkpoint_path, map_location=device))
82
 
83
  cloth_encoder = ClothEncoder.from_pretrained(
84
  "stabilityai/stable-diffusion-xl-base-1.0",