Problem with the PKL
#1
by
learnprogandcs
- opened
I'm having trouble using the PKL model in the repo.
There is a small mistake in the notebook:
!wget https://huggingface.co/skytnt/fbanime-gan/raw/main/code/networks_stylegan2.py -O networks_stylegan2.py
Since I believe you deleted it in previous commits (I used networks_stylegan2.py from your Github instead).
Using the notebook, i added this code to test the model output in pytorch:
z_dim = G.z_dim
c_dim = G.c_dim
w_dim = G.w_dim
batch_size = 1
z = np.random.RandomState(20).randn(batch_size, 1024).astype(np.float32)
#z = np.random.randn(batch_size, 1024).astype(np.float64)
#z = np.zeros((batch_size, 1024)).astype(np.float32)
z = torch.Tensor(z)
labels = torch.zeros((batch_size, c_dim))
truncation_psi = torch.Tensor([0.7, 1])
w = G.mapping(z, labels, truncation_psi=truncation_psi)
imgs = G.synthesis(w, noise_strength=1)
imgs = (imgs * 127.5 + 128)
imgs = imgs.clamp(0, 255).to(torch.uint8).permute((0, 2, 3, 1)).detach().cpu().numpy()
result = Image.fromarray(imgs[0])
result
But the result is the following :
Do you know why the code produces this output ?
Same problem as https://huggingface.co/spaces/skytnt/full-body-anime-gan/discussions/3
the pkl is fp16 version, it only works well on gpu.
I'll upload fp32 version later.
Indeed, thanks a lot for your answer
The fp32 version has been uploaded.
skytnt
changed discussion status to
closed