Code Monkey home page Code Monkey logo

Comments (8)

williamyang1991 avatar williamyang1991 commented on May 30, 2024

You still need to run Facial Destylization, since we need to prepare paired training data to train DualStyleGAN (i.e., need to obtain the intrinsic and extrinsic style codes).

Then, in Progressive Fine-Tuning, you can skip step 1 & 2 by loading my pretrained model, and only run step 3.

from dualstylegan.

dongyun-kim-arch avatar dongyun-kim-arch commented on May 30, 2024

Thanks for answering it!
So does it mean I can skip step2 in facial destylization but need to do step 3? Or should I do both?

from dualstylegan.

williamyang1991 avatar williamyang1991 commented on May 30, 2024

You can try with or without step 2.
I don't know which one is better.

from dualstylegan.

dongyun-kim-arch avatar dongyun-kim-arch commented on May 30, 2024

Thanks!
I tried to train step2 in Facial Destylization, but faced an error.

I prepared 300 images with alignment and super resolution script, 1024x1024, and saved them in /data/mystyle/images/train
and then run this command
python ./model/stylegan/prepare_data.py --out ./data/mystyle/lmdb/ --n_worker 4 --size 1024 ./data/mystyle/images/
It created two files in lmdb folder which are data.mdb and lock.mdb.

and run this command,
python -m torch.distributed.launch --nproc_per_node=1 --master_port=8765 finetune_stylegan.py --iter 600 --batch 4 --ckpt ./checkpoint/stylegan2-ffhq-config-f.pt --style mystyle --augment ./data/mystyle/lmdb/
but faced this error. Could you point out what I am wrong here?

I am using RTX A5000 GPU 24G VRAM

load model: ./checkpoint/stylegan2-ffhq-config-f.pt
0%| | 0/600 [00:00<?, ?it/s]/home/donghyun/Desktop/training/DualStyleGAN/model/stylegan/op/conv2d_gradfix.py:88: UserWarning: conv2d_gradfix not supported on PyTorch 1.12.1+cu113. Falling back to torch.nn.functional.conv2d().
warnings.warn(
0%| | 0/600 [00:01<?, ?it/s]
Traceback (most recent call last):
File "finetune_stylegan.py", line 391, in
train(args, loader, generator, discriminator, g_optim, d_optim, g_ema, device)
File "finetune_stylegan.py", line 159, in train
r1_loss = d_r1_loss(real_pred, real_img)
File "/home/donghyun/Desktop/training/DualStyleGAN/util.py", line 71, in d_r1_loss
grad_real, = autograd.grad(
File "/home/donghyun/anaconda3/envs/dualstylegan_env/lib/python3.8/site-packages/torch/autograd/init.py", line 276, in grad
return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
File "/home/donghyun/anaconda3/envs/dualstylegan_env/lib/python3.8/site-packages/torch/autograd/function.py", line 253, in apply
return user_fn(self, *args)
File "/home/donghyun/Desktop/training/DualStyleGAN/model/stylegan/non_leaking.py", line 352, in backward
grad_input, grad_grid = GridSampleBackward.apply(grad_output, input, grid)
File "/home/donghyun/Desktop/training/DualStyleGAN/model/stylegan/non_leaking.py", line 361, in forward
grad_input, grad_grid = op(grad_output, input, grid, 0, 0, False)
TypeError: 'tuple' object is not callable
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 17115) of binary: /home/donghyun/anaconda3/envs/dualstylegan_env/bin/python
Traceback (most recent call last):
File "/home/donghyun/anaconda3/envs/dualstylegan_env/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/donghyun/anaconda3/envs/dualstylegan_env/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/donghyun/anaconda3/envs/dualstylegan_env/lib/python3.8/site-packages/torch/distributed/launch.py", line 193, in
main()
File "/home/donghyun/anaconda3/envs/dualstylegan_env/lib/python3.8/site-packages/torch/distributed/launch.py", line 189, in main
launch(args)
File "/home/donghyun/anaconda3/envs/dualstylegan_env/lib/python3.8/site-packages/torch/distributed/launch.py", line 174, in launch
run(args)
File "/home/donghyun/anaconda3/envs/dualstylegan_env/lib/python3.8/site-packages/torch/distributed/run.py", line 752, in run
elastic_launch(
File "/home/donghyun/anaconda3/envs/dualstylegan_env/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 131, in call
return launch_agent(self._config, self._entrypoint, list(args))
File "/home/donghyun/anaconda3/envs/dualstylegan_env/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 245, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:

finetune_stylegan.py FAILED

Failures:
<NO_OTHER_FAILURES>

Root Cause (first observed failure):
[0]:
time : 2022-11-11_01:36:27
host : kr-03
rank : 0 (local_rank: 0)

from dualstylegan.

williamyang1991 avatar williamyang1991 commented on May 30, 2024

https://github.com/williamyang1991/DualStyleGAN/tree/main/model/stylegan/op_cpu
you can change to CPU compatible version to avoid using conv2d_gradfix.py

from dualstylegan.

williamyang1991 avatar williamyang1991 commented on May 30, 2024

conv2d_gradfix.py is from stylegan2-pytorch, or you can check similar issues in
https://github.com/rosinality/stylegan2-pytorch/issues
to see if there are any solution

from dualstylegan.

dongyun-kim-arch avatar dongyun-kim-arch commented on May 30, 2024

I see. I thought this is because of the multi GPU setting.

I wonder about your training process when creating different models such as cartoon or Pixar.
Did you train all the models from Facial Destylization to optimization? or skip step 2 in Facial Destylization or any other steps?

from dualstylegan.

williamyang1991 avatar williamyang1991 commented on May 30, 2024

all process
only skip Progressive Fine-Tuning step 1 & 2 by loading the pretrained model

from dualstylegan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.