Skip to content

Commit 25e9dc5

Browse files
committed
download weights with huggingface_hub
1 parent 8a57db9 commit 25e9dc5

File tree

22 files changed

+23
-197100
lines changed

22 files changed

+23
-197100
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
data/
2-
*.safetensors
3-
*.bin
1+
models/*
2+
!models/.gitkeep
43

54
# Byte-compiled / optimized / DLL files
65
__pycache__/

README.md

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,10 @@ ComfyUI adaptation of [IDM-VTON](https://github.com/yisol/IDM-VTON).
1919
cd custom_nodes
2020
git clone https://github.com/TemryL/ComfyUI-IDM-VTON.git
2121
cd ComfyUI-IDM-VTON
22-
pip install -r requirements.txt
23-
```
24-
25-
## Download weights:
26-
Download the models weights from [yisol/IDM-VTON](https://huggingface.co/yisol/IDM-VTON) in [HuggingFace](https://huggingface.co). The folder structure should be as follow:
27-
28-
```
29-
models
30-
└── idm_vton
31-
├── image_encoder
32-
│ ├── config.json
33-
│ └── model.safetensors
34-
├── scheduler
35-
│ └── scheduler_config.json
36-
├── text_encoder
37-
│ ├── config.json
38-
│ └── model.safetensors
39-
├── text_encoder_2
40-
│ ├── config.json
41-
│ └── model.safetensors
42-
├── tokenizer
43-
│ ├── merges.txt
44-
│ ├── special_tokens_map.json
45-
│ ├── tokenizer_config.json
46-
│ └── vocab.json
47-
├── tokenizer_2
48-
│ ├── merges.txt
49-
│ ├── special_tokens_map.json
50-
│ ├── tokenizer_config.json
51-
│ └── vocab.json
52-
├── unet
53-
│ ├── config.json
54-
│ └── diffusion_pytorch_model.bin
55-
├── unet_encoder
56-
│ ├── config.json
57-
│ └── diffusion_pytorch_model.safetensors
58-
└── vae
59-
├── config.json
60-
└── diffusion_pytorch_model.safetensors
61-
```
62-
You can place this folder wherever you want as long as you specify the correct path to `models/idm_vton` in the `Load IDM-VTON Pipeline` node. Config files are already provided in this repo. We also provide a shell script to download the weights from [HuggingFace](https://huggingface.co/yisol/IDM-VTON):
63-
```bash
64-
./scripts/download_weights.sh
22+
python install.py
6523
```
6624

25+
Models weights from [yisol/IDM-VTON](https://huggingface.co/yisol/IDM-VTON) in [HuggingFace](https://huggingface.co) will be downloaded in [models](models/) folder of this repository.
6726

6827
# Mask Generation
6928
The workflow provided above uses [ComfyUI Segment Anything](https://github.com/storyicon/comfyui_segment_anything) to generate the image mask.

install.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import sys
22
import os.path
33
import subprocess
4+
from huggingface_hub import snapshot_download
45

56

6-
custom_nodes_path = os.path.dirname(os.path.abspath(__file__))
7+
CUSTOM_NODES_PATH = os.path.dirname(os.path.abspath(__file__))
8+
WEIGHTS_PATH = os.path.join(CUSTOM_NODES_PATH, "models")
9+
HF_REPO_ID = "yisol/IDM-VTON"
710

811

912
def build_pip_install_cmds(args):
@@ -14,8 +17,9 @@ def build_pip_install_cmds(args):
1417

1518
def ensure_package():
1619
cmds = build_pip_install_cmds(['-r', 'requirements.txt'])
17-
subprocess.run(cmds, cwd=custom_nodes_path)
20+
subprocess.run(cmds, cwd=CUSTOM_NODES_PATH)
1821

1922

2023
if __name__ == "__main__":
21-
ensure_package()
24+
ensure_package()
25+
snapshot_download(repo_id=HF_REPO_ID, local_dir=WEIGHTS_PATH)

models/.gitkeep

Whitespace-only changes.

models/idm_vton/image_encoder/config.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

models/idm_vton/model_index.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

models/idm_vton/scheduler/scheduler_config.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

models/idm_vton/text_encoder/config.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

models/idm_vton/text_encoder_2/config.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)