-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor the convert script and add readme
- Loading branch information
Showing
17 changed files
with
581 additions
and
1,508 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,33 @@ | ||
# Mindspore-controlnet | ||
# Mindspore-ControlNet | ||
|
||
1. Convert pytorch ckeckpoints to mindspore | ||
The Stable diffusion code is copied from https://github.com/mindspore-lab/minddiffusion | ||
|
||
2. Run test_controlnet.py to use controlnet. | ||
## Install | ||
``` shell | ||
pip install mindspore==1.9.0 | ||
pip install -r requirements.txt | ||
``` | ||
|
||
|
||
## 1. Inference with pretrained ControlNet | ||
1. download pytorch controlnet checkpoints from https://huggingface.co/lllyasviel/ControlNet/tree/main/models or https://huggingface.co/lllyasviel/ControlNet-v1-1/tree/main. | ||
|
||
2. convert downloaded pytorch checkpoints to mindspore checkpoints, or directly download from https://huggingface.co/unrealMJ/MindSpore-ControlNet and put them into torch2ms/ms_weight | ||
```shell | ||
python torch2ms/convert.py --input_path xxxx --output_path xxxx # convert full model | ||
python torch2ms/convert.py --input_path xxxx --output_path xxxx --only_controlnet # convert controlnet only | ||
``` | ||
|
||
3. Run run_controlnet_inference.py to use controlnet. | ||
```shell | ||
python run_controlnet_inference.py --input_path xxxx --output_path xxxx | ||
``` | ||
|
||
## 2. Train ControlNet from scratch | ||
1. Download the dataset from https://huggingface.co/datasets/fusing/fill50k | ||
|
||
|
||
2. Run run_controlnet_train.py to train controlnet. | ||
```shell | ||
python run_controlnet_train.py --data_path xxxx --train_config configs/train_controlnet_config.json --model_config configs/cldm_v15.yaml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.