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

[Enhance] Update face expression project sdxl lora #48

Merged
merged 1 commit into from
Sep 2, 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
2 changes: 1 addition & 1 deletion diffengine/datasets/transforms/dump_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __call__(self, results):
out_file = osp.join(self.dump_dir, f'{dump_id}_image.png')
cv2.imwrite(out_file, img.numpy().astype(np.uint8))

if 'condition_img':
if 'condition_img' in results:
condition_img = results['condition_img']
if condition_img.shape[0] in [1, 3]:
condition_img = condition_img.permute(1, 2, 0) * 255
Expand Down
12 changes: 12 additions & 0 deletions projects/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Welcome to Projects of DiffEngine

In this folder, we welcome all contribution of diffusion model training from community.

Here, these requirements, e.g. code standards, are not that strict as in core package. Thus, developers from the community can implement their algorithms much more easily and efficiently in DiffEngine. We appreciate all contributions from community to make DiffEngine greater.

Here is an [example project](./face_expression/) about how to add your algorithms easily.

We also provide some documentation listed below:

- [🙌 Contributing \[🔝\]](../README.md#🙌-contributing-🔝)
The guides for new contributors.
4 changes: 1 addition & 3 deletions projects/face_expression/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,4 @@ You can see more details on [LoRA docs](../../docs/source/run_guides/run_lora.md

#### stable_diffusion_xl_lora_face_expression

![example1](https://github.com/okotaku/diffengine/assets/24734142/68c7569b-f62c-4228-a00d-997f2d963ad0)

Note that training failed. We should improve SDXL LoRA training.
![example1](https://github.com/okotaku/diffengine/assets/24734142/0d6e3434-4ba6-4c90-8457-06595ad9183d)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
dict(type='RandomHorizontalFlip', p=0.5),
dict(type='ComputeTimeIds'),
dict(type='torchvision/ToTensor'),
dict(type='DumpImage', max_imgs=10, dump_dir='work_dirs/dump'),
dict(type='torchvision/Normalize', mean=[0.5], std=[0.5]),
dict(type='PackInputs', input_keys=['img', 'text', 'time_ids']),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
'../../configs/_base_/default_runtime.py'
]

train_dataloader = dict(batch_size=1)
train_dataloader = dict(batch_size=2)

optim_wrapper = dict(optimizer=dict(lr=1e-4))
optim_wrapper = dict(optimizer=dict(lr=1e-4), accumulative_counts=2)

model = dict(
model='Linaqruf/animagine-xl', vae_model=None, lora_config=dict(rank=128))
model = dict(model='gsdf/CounterfeitXL', lora_config=dict(rank=32))

train_cfg = dict(by_epoch=True, max_epochs=100)
train_cfg = dict(by_epoch=True, max_epochs=50)
Loading