rinongal / StyleGAN-nada

http://stylegan-nada.github.io/
MIT License
1.15k stars 146 forks source link

Docker image old version of code #36

Closed MAGLeb closed 2 years ago

MAGLeb commented 2 years ago

Am I right that in the docker container old version of the code? Try to pass images to train the model, but the result is different. Model does not use images to train.

MAGLeb commented 2 years ago

And of course different results between the google collab model and the docker model. COLLAB image DOCKER image Same parameters.

rinongal commented 2 years ago

Which docker are you using? The one from replicate, or the one from our own docker repo?

MAGLeb commented 2 years ago

The second one. Use the command docker-compose up in the StyleGan directory for creating an image.

rinongal commented 2 years ago

Just an update that I haven't forgotten you, but it's a rather busy week due to conference deadlines. I'll probably be more free around the weekend and I'll try to look into things.

MAGLeb commented 2 years ago

Thank you. I am waiting. If I can help you, I am at your disposal.

rinongal commented 2 years ago

Okay, so the docker does make use of older code. It should still have support for image directory targeting, but the notebook inside the docker doesn't support this option.

The quickest solution to get things up-to-date is to just git pull/clone inside the docker. It has the correct environment set up (and you've been able to run the code inside it), so the new code should work fine as well.

A second alternative is to use the docker from replicate.com which is more up-to-date. You can grab it with: docker pull r8.im/rinongal/stylegan-nada@sha256:5295deb56da56f890f123e1bb0ede34d63896adf42d6c4856defdca2b187552a This version is slightly bigger since it also has some pre-trained models inside for inference. It doesn't have all the initial models from other domains though.

Finally, I can update the docker, but that's going to take me a bit of time since I've got a few other things on my table atm.

We can start by seeing if option 1 works for you. If it doesn't then we can try the other two.

MAGLeb commented 2 years ago

Finally, I can update the docker, but that's going to take me a bit of time since I've got a few other things on my table atm.

Thank you for your answer. Yeah of cause. I will try the first two options and let you know.

MAGLeb commented 2 years ago

Tried first case, install a new version of the stylegan_naga repository I have been stuck on saving the model.

torch.save(model, path)

Traceback (most recent call last):
  File "train.py", line 55, in <module>
    train()
  File "train.py", line 36, in train
    model.save(model_name)
  File "/workspace/style-transfer/model_gan.py", line 45, in save
    torch.save(model_wrapper, path)
  File "/opt/conda/lib/python3.7/site-packages/torch/serialization.py", line 379, in save
    _save(obj, opened_zipfile, pickle_module, pickle_protocol)
  File "/opt/conda/lib/python3.7/site-packages/torch/serialization.py", line 484, in _save
    pickler.dump(obj)
AttributeError: Can't pickle local object '_transform.<locals>.<lambda>'

type(model)
# <class 'ZSSGAN.model.ZSSGAN.ZSSGAN'>

Try to figure out the reason for the problem but unsuccessfully. Also in the docker instant from replica, I saw that you saved the model in a different way than I do.

The next step try to use docker instant.

MAGLeb commented 2 years ago

Also, one more example of training the model with parameters:

That was in your paper: image

In docker container: image

But I had very good results with:

rinongal commented 2 years ago

An immediate guess is that there's some difference between the parameters you're using and the ones in the Colab.

Your ukiyo-e / white walker / werewolf results also look nothing like I'd expect. Mostly the color scheme. Can you check what the training outputs look like? Are they similar to your own editing results, or closer to mine?

If it's the later, then you're probably not loading the model correctly.

About saving - just see what I'm doing in my code. You want to save the generator itself. You don't need the rest of the ZSSGAN module.

rinongal commented 2 years ago

I tried running the prompts again the colab and I'm not encountering your issue. In some of the other issues / in our paper, we list the parameters used for specific prompts. You can try reproducing the results with those parameters and this might give us a better idea of whether parameter differences are at fault or not.

MAGLeb commented 2 years ago

Thanks so much. I refreshed the Style-Gan repository and saved the model in your way (saved only generator) and everything works fine. Also start to investigate your paper to understand which parameters are related to the results.