imlixinyang / HiSD

Official pytorch implementation of paper "Image-to-image Translation via Hierarchical Style Disentanglement" (CVPR 2021 Oral).
Other
388 stars 49 forks source link

Can you elease a checkpoint of Open the mouth tag? #23

Open c1a1o1 opened 3 years ago

c1a1o1 commented 3 years ago

Can you elease a checkpoint of Open the mouth tag?

imlixinyang commented 3 years ago

Hi! Have you tried to train this tag by yourself? It wouldn't cost much for either time and GPU for a single-tag HiSD model. (maybe several hours on a single 1080Ti.) If you want to manipulate a single image only, you can also try recent CLIP-guided method like StyleCLIP. Please let me know if there are any problems when you reproduce HiSD.

c1a1o1 commented 3 years ago

F:\ProgramData\Anaconda3\python.exe F:/work/mingxingshipin/HiSD-main/core/train.py F:\work\mingxingshipin\HiSD-main\core\utils.py:47: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. return yaml.load(stream) Traceback (most recent call last): File "F:/work/mingxingshipin/HiSD-main/core/train.py", line 66, in G_adv, G_sty, G_rec, D_adv = trainer.update(x, y, i, j, j_trg) File "F:\work\mingxingshipin\HiSD-main\core\trainer.py", line 139, in update x_trg, x_cyc, s, s_trg = self.models((x, y, i, j, j_trg), mode='gen') File "F:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, kwargs) File "F:\work\mingxingshipin\HiSD-main\core\trainer.py", line 30, in forward return self.gen_losses(args) File "F:\work\mingxingshipin\HiSD-main\core\trainer.py", line 52, in gen_losses x_trg = self.gen.decode(e_trg) File "F:\work\mingxingshipin\HiSD-main\core\networks.py", line 130, in decode x = self.decoder(e) File "F:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(input, kwargs) File "F:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\container.py", line 117, in forward input = module(input) File "F:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(*input, *kwargs) File "F:\work\mingxingshipin\HiSD-main\core\networks.py", line 306, in forward out = self.conv2(self.activ(self.in2(self.conv1(F.interpolate(self.activ(self.in1(x.clone())), scale_factor=2, mode='nearest'))))) File "F:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 727, in _call_impl result = self.forward(input, *kwargs) File "F:\work\mingxingshipin\HiSD-main\core\networks.py", line 383, in forward out = (x - bias_in) / (weight_in + self.eps) self.weight + self.bias RuntimeError: CUDA out of memory. Tried to allocate 64.00 MiB (GPU 0; 11.00 GiB total capacity; 8.14 GiB already allocated; 7.74 MiB free; 8.26 GiB reserved in total by PyTorch)

Process finished with exit code 1

imlixinyang commented 3 years ago

Could you show me which config file you used in you reproduction?

c1a1o1 commented 3 years ago

Copyright (C) 2018 NVIDIA Corporation. All rights reserved.

Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).

logger options

image_save_iter: 1000 # How often do you want to save output images during training snapshot_save_iter: 10000 # How often do you want to save trained models log_iter: 10 # How often do you want to log the training stats

optimization options

total_iterations: 600000 batch_size: 8 num_workers: 1 weight_decay: 0
beta1: 0 beta2: 0.99 init: kaiming lr_dis: 0.0001 lr_gen_mappers: 0.000001 lr_gen_others: 0.0001

adv_w: 1
sty_w: 1
rec_w: 1

style_dim: 256 noise_dim: 32

discriminators:

No normalization (Attribute-specific)

channels: [32, 64, 128, 256, 512, 512, 512] extractors:

No normalization (Tag-specific)

channels: [32, 64, 128, 256, 512, 512, 512] encoder:

Instance Normalization (Shared)

channels: [64, 128, 256] translators:

Adaptive Instance Normalization (Tag-specific)

channels: [64, 64, 64, 64, 64, 64, 64, 64] decoder:

Instance Normalization (Shared)

channels: [256, 128, 64] mappers:

No normalization (Attribute-specific)

Last num of pre_channels should be equal to the first num of post_channels

pre_channels: [256, 256, 256] post_channels: [256, 256, 256]

tags:

name: Mouth_Slightly_Open
tag_irrelevant_conditions_dim: 2
attributes: 
  -
    name: 'with'
    filename: ../datasets/Mouth_Slightly_Open_with.txt
  -
    name: 'without'
    filename: ../datasets/Mouth_Slightly_Open_without.txt

data options

input_dim: 3 # number of image channels new_size: 256 # first resize the shortest image side to this size crop_image_height: 256 # random crop image of this height crop_image_width: 256 # random crop image of this width

imlixinyang commented 3 years ago

The config file you used need 2x1080Ti. You can change 'new_size', 'crop_image_height' and 'crop_image_weight' in "data options" to 128 or use the "celeba-hq.yaml" to reduce the need of GPU memory.

c1a1o1 commented 3 years ago

arguments are located on different GPUs

c1a1o1 commented 3 years ago

3090 is not ok???

imlixinyang commented 3 years ago

3090 has 24GB GPU memory, which is enough for the config file you used. But as you comment: "" RuntimeError: CUDA out of memory. Tried to allocate 64.00 MiB (GPU 0; 11.00 GiB total capacity; 8.14 GiB already allocated; 7.74 MiB free; 8.26 GiB reserved in total by PyTorch) "" It seems that you use a 11GB GPU. Maybe you can check if you use the correct GPU.