eladrich / pixel2style2pixel

Official Implementation for "Encoding in Style: a StyleGAN Encoder for Image-to-Image Translation" (CVPR 2021) presenting the pixel2style2pixel (pSp) framework
https://eladrich.github.io/pixel2style2pixel/
MIT License
3.19k stars 570 forks source link

'Namespace' object has no attribute 'output_size' #122

Closed molo32 closed 3 years ago

molo32 commented 3 years ago

I am using the colab, in the sketch to face task, but when it reaches this cell it gives this error.

opts = Namespace(**opts)
net = pSp(opts)
net.eval()
net.cuda()
print('Model successfully loaded!')

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-16-289d4bd41723> in <module>()
      1 opts = Namespace(**opts)
----> 2 net = pSp(opts)
      3 net.eval()
      4 net.cuda()
      5 print('Model successfully loaded!')

/content/pixel2style2pixel/models/psp.py in __init__(self, opts)
     26                 self.set_opts(opts)
     27                 # compute number of style inputs based on the output resolution
---> 28                 self.opts.n_styles = int(math.log(self.opts.output_size, 2)) * 2 - 2
     29                 # Define architecture
     30                 self.encoder = self.set_encoder()

AttributeError: 'Namespace' object has no attribute 'output_size'
yuval-alaluf commented 3 years ago

Whoops. Today I added a few new features and I forgot to update the notebook accordingly. Should be fixed now 😄

zhaobozb commented 3 years ago

output_size is also missing in the Inversion "In the Wild" section :)

yuval-alaluf commented 3 years ago

I completely forgot that section existed in the notebook :sweat_smile:
Should be good now! I believe everything should be working now so I am resolving for now. If you find other issues, feel free to reopon.