Home > Software engineering >  Colab error: cannot import name 'pix2pixHD_model' from 'pix2pixHD' (unknown loca
Colab error: cannot import name 'pix2pixHD_model' from 'pix2pixHD' (unknown loca

Time:07-20

I am using Colab and I am trying to code a Pix2Pix gan. here is my code:

 ! git clone https://github.com/NVIDIA/pix2pixHD
 ! pip install dominate 

after this Code block it say this :

fatal: destination path 'pix2pixHD' already exists and is not an empty directory.
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Requirement already satisfied: dominate in /usr/local/lib/python3.7/dist-packages (2.6.0)

Then I have this :

 ! cd pix2pixHD/
 ! python3 setup.py install
 import pix2pixHD
 from pix2pixHD import pix2pixHD_model
 gan_model = pix2pixHD.pix2pixHD_model()
 gan_model.compile(loss='mae', optimizer='adam')
 gan_model.fit(x, y, epochs=100, batch_size=1, callbacks=[pix2pixHD.save_weights_callback(gan_model, every=10)])

but I am getting this error :

python3: can't open file 'setup.py': [Errno 2] No such file or directory
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-46-6ae9c67e59ac> in <module>()
  2 get_ipython().system(' python3 setup.py install')
  3 import pix2pixHD
----> 4 from pix2pixHD import pix2pixHD_model
  5 gan_model = pix2pixHD.pix2pixHD_model()
  6 gan_model.compile(loss='mae', optimizer='adam')

ImportError: cannot import name 'pix2pixHD_model' from 'pix2pixHD' (unknown location)

So then I tried this:

            
  • Related