Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Still requires Tensorflow 1 dnnlib #5

Open
lxschwalb opened this issue Jul 18, 2021 · 3 comments
Open

Still requires Tensorflow 1 dnnlib #5

lxschwalb opened this issue Jul 18, 2021 · 3 comments

Comments

@lxschwalb
Copy link

The notebook still requires dnnlib, which is only compatable with TF1. So the notebook at least is not a stylegan for TF2, and does not belong in this repo, or am I missing something?

@SamKennard1
Copy link

Would be great to get a requirements.txt of a working environment for this - would love to get this running.

@martinsallandm
Copy link

martinsallandm commented Apr 16, 2023

install it (tensorflow 1.x) run the first part of the notebook (until it saves the model). Than, uninstall 1.x and work with TF 2... I dont know why the author did not commit the TF 2 saved model. By anyway, seems that he abandoned the project, so good luck. Remember to NOT use the first part anymore.

Thats all you need after saving the new model:

import numpy as np
from stylegan import StyleGAN_G
from stylegan import copy_weights_to_keras_model
import pickle
import matplotlib.pyplot as plt
import time


model = StyleGAN_G()

all_weights = pickle.load(open('gs_weights.pkl', 'rb'))
print('Weights loaded to memory.')

copy_weights_to_keras_model(model.model_mapping, all_weights)
copy_weights_to_keras_model(model.model_synthesis, all_weights)

model.generate_sample(is_visualize=True)

PS.: Install cuda tookit from nvidia (I installed 12.1) and install tensorflow >= 2.6 (I think mine 2.6.2). However, it might not find the cuda dlls, so, use conda to install cudakit 11 (?)

conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0

@martinsallandm
Copy link

I forgot to generate the weights for all the trained models (just the karas 1024), if any of you follow those instructions, I apreciate if you, before erasing the TF 1, generate the pickle file for all the models and made them avaiable. Thank you! If anyone want I can provide the pickle for the karas 1024 (the standard one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants