yuval-alaluf/stylegan3-editing

encoder drive pSp: attribute "logger" missing

NicolasDibot opened this issue · 2 comments

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?

Strange. The logger is defined here:

self.logger = SummaryWriter(log_dir=log_dir)

This is in the init of the Coach class so it should have been initialized. Did you debug to see what happens?

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