yuval-alaluf / stylegan3-editing

Official Implementation of "Third Time's the Charm? Image and Video Editing with StyleGAN3" (AIM ECCVW 2022) https://arxiv.org/abs/2201.13433
https://yuval-alaluf.github.io/stylegan3-editing/
MIT License
660 stars 72 forks source link

encoder drive pSp: attribute "logger" missing #45

Closed NicolasDibot closed 1 year ago

NicolasDibot commented 1 year ago

Hello, thank you for your work.

When running train_restyle_psp.py, with non-human domain flags:

python inversion/scripts/train_restyle_psp.py \
--dataset_type my_data_encode \
--encoder_type ResNetBackboneEncoder \
--exp_dir experiments/restyle_psp_ffhq_encode \
--batch_size 2 \
--test_batch_size 2 \
--workers 8 \
--test_workers 8 \
--val_interval 5000 \
--save_interval 10000 \
--start_from_latent_avg True \
--lpips_lambda 0.8 \
--l2_lambda 1 \
--id_lambda 0 \
--moco_lambda 0.5 \
--input_nc 6 \
--n_iters_per_batch 3 \
--output_size 256 \
--stylegan_weights train_network.pt

(and data prepared correctly)

I get this error:

  File "inversion/scripts/train_restyle_psp.py", line 25, in main
    coach.train()
  File "/scratch/./inversion/training/coach_restyle_psp.py", line 146, in train
    self.parse_and_log_images(id_logs, x, y, y_hats, title='images/train')
  File "/scratch/./inversion/training/coach_restyle_psp.py", line 318, in parse_and_log_images
    self.log_images(title, im_data=im_data, subscript=subscript)
  File "/scratch/./inversion/training/coach_restyle_psp.py", line 329, in log_images
    path = Path(self.logger.log_dir) / name / f'{step:04d}.jpg'
AttributeError: 'Coach' object has no attribute 'logger

Indeed, there doesn't seem to be a logger attribute anywhere. Is there anything I'm doing wrong?

yuval-alaluf commented 1 year ago

Strange. The logger is defined here: https://github.com/yuval-alaluf/stylegan3-editing/blob/36ce2b4ddab7821586012c1d5fbf737a3ea1c355/inversion/training/coach_restyle_psp.py#L82 This is in the init of the Coach class so it should have been initialized. Did you debug to see what happens?

NicolasDibot commented 1 year ago

Well, it wasn't there, I added it and it works, thanks.