facebookresearch / StyleNeRF

This is the open source implementation of the ICLR2022 paper "StyleNeRF: A Style-based 3D-Aware Generator for High-resolution Image Synthesis"
956 stars 92 forks source link

Training resume option not working for ffhq512 #9

Open Abhishek-Sharma1995 opened 2 years ago

Abhishek-Sharma1995 commented 2 years ago

!python run_train.py outdir=/content/drive/MyDrive/colab-sg2-ada-pytorch/stylegan2-ada-pytorch/results data=/content/drive/MyDrive/the-crypto-chicks spec=stylegan2 model=stylenerf_ffhq resume=ffhq512

getting this error while running above training python file:

Constructing networks... Resuming from "https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada-pytorch/pretrained/transfer-learning-source-nets/ffhq-res512-mirror-stylegan2-noaug.pkl" Error loading: synthesis.b64.conv0.weight torch.Size([512, 512, 3, 3]) torch.Size([512, 256, 1, 1]) Error executing job with overrides: ['outdir=/content/drive/MyDrive/colab-sg2-ada-pytorch/stylegan2-ada-pytorch/results', 'data=/content/drive/MyDrive/the-crypto-chicks', 'spec=stylegan2', 'model=stylenerf_ffhq', 'resume=ffhq512'] Traceback (most recent call last): File "run_train.py", line 380, in main subprocess_fn(rank=0, args=args) File "run_train.py", line 302, in subprocess_fn training_loop.training_loop(**args) File "/content/StyleNeRF/training/training_loop.py", line 188, in training_loop misc.copy_params_and_buffers(resume_data[name], module, require_all=False) File "/content/StyleNeRF/torch_utils/misc.py", line 168, in copy_params_and_buffers raise e File "/content/StyleNeRF/torch_utils/misc.py", line 165, in copy_params_andbuffers tensor.copy(src_tensors[name].detach()).requiresgrad(tensor.requires_grad) RuntimeError: The size of tensor a (256) must match the size of tensor b (512) at non-singleton dimension 1

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

MultiPath commented 2 years ago

Hi, thanks for showing this. It seems a mismatch in the shape. I think I modified some part of the code which makes it incompatible with the stylegan2 checkpoints. I will try to fix it if possible.

Harry-KIT commented 2 years ago

Hi @Abhishek-Sharma1995, You can solve your problem with this command.

python run_train.py outdir=train_out data=${PWD}/your_data model=stylenerf_ffhq resume=${PWD}/ffhq_512.pkl model.G_kwargs.synthesis_kwargs.kernel_size=3 model.G_kwargs.synthesis_kwargs.upsample_mode=pixelshuffle model.G_kwargs.synthesis_kwargs.rgb_out_dim=512