Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support controlnet #151

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions controlnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Mindspore-ControlNet

The Stable diffusion code is copied from https://github.com/mindspore-lab/minddiffusion

## 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
```
Loading
Loading