Comments (3)
Problem solved. Just need to load pkl in tf1, then save it as cktp.
code from https://gitmemory.com/issue/moono/stylegan-reproduced/1/486484910
import os
import pprint
import pickle
import numpy as np
import PIL.Image
import dnnlib
import dnnlib.tflib as tflib
import config
import tensorflow as tf
def main():
# Initialize TensorFlow.
tflib.init_tf()
# Load pre-trained network.
url = 'https://drive.google.com/uc?id=1MEGjdvVpUsu1jB4zrXZN7Y4kBBOzizDQ' # karras2019stylegan-ffhq-1024x1024.pkl
with dnnlib.util.open_url(url, cache_dir=config.cache_dir) as f:
_G, _D, Gs = pickle.load(f)
# _G = Instantaneous snapshot of the generator. Mainly useful for resuming a previous training run.
# _D = Instantaneous snapshot of the discriminator. Mainly useful for resuming a previous training run.
# Gs = Long-term average of the generator. Yields higher-quality results than the instantaneous snapshot.
# Print network details.
Gs.print_layers()
# t_var = tf.trainable_variables()
# pprint.pprint(t_var)
saver = tf.train.Saver()
save_path = saver.save(tf.get_default_session(), "./model.ckpt")
if __name__ == "__main__":
main()
from stylegan2-tf-2.x.
But module dnnlib
uses tensorflow v1. I tried to replace tensorflow
to tensorflow.compat.v1
in dnnlib
, but it doesn't work unfortunately.
I converted it using this colab notebook finally. May be useful for those who don't want to have a deal with docker :)
from stylegan2-tf-2.x.
@starrabb1t I mean save the weight in tf1, then you can use tf2 to open this model and load weights.
from stylegan2-tf-2.x.
Related Issues (15)
- Cannot convert pkl file to ckpt when the size is 256 or 512. HOT 5
- Training details HOT 2
- checkpoint of FFHQ 256*256?
- Error
- when training in 256x256, the output is 256x512 pixels HOT 1
- Memory leak
- 10 errors detected in the compilation of upfirdn_2d.cu
- different resolution pkl file HOT 1
- Please update readme HOT 3
- Training on custom dataset failed HOT 9
- Training crash randomly HOT 2
- What are the "labels" in the generator and discriminator? HOT 2
- Need help understanding the role of the 'upfirdn' after the transpose_conv HOT 1
- NHWC Support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stylegan2-tf-2.x.