rinongal / stylegan-nada Goto Github PK
View Code? Open in Web Editor NEWHome Page: http://stylegan-nada.github.io/
License: MIT License
Home Page: http://stylegan-nada.github.io/
License: MIT License
41 args = Namespace(**training_args) 42 ---> 43 net = ZSSGAN(args) 44 45 g_reg_ratio = 4 / 5 /content/stylegan_nada/ZSSGAN/model/ZSSGAN.py in __init__(self, args) 172 lambda_texture=args.lambda_texture, 173 clip_model=model_name) --> 174 for model_name in args.clip_models} 175 176 self.clip_model_weights = {model_name: weight for model_name, weight in zip(args.clip_models, args.clip_model_weights)} AttributeError: 'Namespace' object has no attribute 'clip_models'
While running sample colab notebook Step 3, this error happens. Is there any fix for this?
Hi! I'm quite new when it comes to coding, and I've been struggling to do style targeting from a set of images on the colab. I've tried replacing the source class and target class options, but I only stumble upon a bunch of errors no matter what I do. Is that function not available yet on colab, or am I simply not understanding what I'm supposed to do correctly?
Hello. Thank you for this inspiring work!
I have tried to train a few generators for various styles using the train.py
script and have noticed that the results depend a lot on the chosen setup: number of iterations, source and target classes, number of layers to train at each iteration (i.e. auto_layer_k
) etc. I assume that seeing more examples of "successful" setups (those that lead to qualitative results) can help a lot to actually understand how to select the parameters effectively.
Could you share the commands you used to launch the training for some of the styles mentioned in the article, please?
I am particularly interested in these transformations:
Hi! when I try to start training, I ran into this problem:
Traceback (most recent call last):
File "train.py", line 147, in
train(args)
File "train.py", line 86, in train
[sampled_src, sampled_dst], loss = net(sample_z)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/mnt/pycharm_project_1/ZSSGAN/model/ZSSGAN.py", line 278, in forward
clip_loss = torch.sum(torch.stack([self.clip_model_weights[model_name] * self.clip_loss_models[model_name](frozen_img, self.source_class, trainable_img, self.target_class) for model_name in self.clip_model_weights.keys()]))
File "/mnt/pycharm_project_1/ZSSGAN/model/ZSSGAN.py", line 278, in
clip_loss = torch.sum(torch.stack([self.clip_model_weights[model_name] * self.clip_loss_models[model_name](frozen_img, self.source_class, trainable_img, self.target_class) for model_name in self.clip_model_weights.keys()]))
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/mnt/pycharm_project_1/ZSSGAN/criteria/clip_loss.py", line 294, in forward
clip_loss += self.lambda_direction * self.clip_directional_loss(src_img, source_class, target_img, target_class)
File "/mnt/pycharm_project_1/ZSSGAN/criteria/clip_loss.py", line 175, in clip_directional_loss
self.target_direction = self.compute_text_direction(source_class, target_class)
File "/mnt/pycharm_project_1/ZSSGAN/criteria/clip_loss.py", line 113, in compute_text_direction
source_features = self.get_text_features(source_class)
File "/mnt/pycharm_project_1/ZSSGAN/criteria/clip_loss.py", line 97, in get_text_features
text_features = self.encode_text(tokens).detach()
File "/mnt/pycharm_project_1/ZSSGAN/criteria/clip_loss.py", line 73, in encode_text
return self.model.encode_text(tokens)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/clip/model.py", line 344, in encode_text
x = self.transformer(x)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/clip/model.py", line 199, in forward
return self.resblocks(x)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/container.py", line 119, in forward
input = module(input)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/clip/model.py", line 186, in forward
x = x + self.attention(self.ln_1(x))
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/clip/model.py", line 183, in attention
return self.attn(x, x, x, need_weights=False, attn_mask=self.attn_mask)[0]
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/modules/activation.py", line 987, in forward
attn_mask=attn_mask)
File "/root/miniconda3/envs/myconda/lib/python3.7/site-packages/torch/nn/functional.py", line 4790, in multi_head_attention_forward
attn_output_weights = torch.bmm(q, k.transpose(1, 2))
RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling cublasGemmStridedBatchedExFix( handle, opa, opb, m, n, k, (void*)(&falpha), a, CUDA_R_16F, lda, stridea, b, CUDA_R_16F, ldb, strideb, (void*)(&fbeta), c, CUDA_R_16F, ldc, stridec, num_batches, CUDA_R_32F, CUBLAS_GEMM_DEFAULT_TENSOR_OP)
My environment is:
Python3.7
CUDA 11.1
cuDNN 8.0.5
Pytorch 1.8.1
Ubuntu 18.04
Do you have any ideas about this? Thanks for your help!
Hi again :)
Once I train a model, I'm trying to generate samples using not the "# Step 4: Generate samples with the new model", but the sample generator included in stylegan2-ada-rosinality cloned repo:
!python /content/stylegan_ada/generate.py --seeds 10,11 --network /content/output/checkpoint/000001.pt --outdir /content/
I'm getting this error when loading the file:
Loading networks from "/content/output/checkpoint/000001.pt"...
Traceback (most recent call last):
File "/content/stylegan_ada/generate.py", line 121, in
main()
File "/content/stylegan_ada/generate.py", line 116, in main
generate_images(**vars(args))
File "/content/stylegan_ada/generate.py", line 28, in generate_images
_G, _D, Gs = pickle.load(fp)
_pickle.UnpicklingError: A load persistent id instruction was encountered,
but no persistent_load function was specified.
I'm doing something wrong? Is it an error? Many thanks
Hi Rinon,
I'm so interested in the work and tried to run the demo on the project page by inputting my own picture, but I got an error like this:
"local variable 'shape' referenced before assignment"
Do you know how to fix it?
Btw, what is the source style of the demo when I specify an input image? Is it extracted from the input image? I'm a bit confused about this.
Thanks a lot for your time!
Hi,
Beautiful work!
Installing dependencies on a new conda environment and running as instructed gives the error:
Loading base models...
Models loaded! Starting training...
torch.Size([1, 3, 1024, 1024])
Traceback (most recent call last):
File "train_colab.py", line 144, in
[sampled_src, sampled_dst], clip_loss = net(sample_z)
File "/home/user/miniconda3/envs/nada/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/user/dev/StyleGAN-nada/ZSSGAN/model/ZSSGAN.py", line 278, in forward
clip_loss = torch.sum(torch.stack([self.clip_model_weights[model_name] * self.clip_loss_models[model_name](frozen_img, self.source_class, trainable_img, self.target_class) for model_name in self.clip_model_weights.keys()]))
File "/home/user/dev/StyleGAN-nada/ZSSGAN/model/ZSSGAN.py", line 278, in
clip_loss = torch.sum(torch.stack([self.clip_model_weights[model_name] * self.clip_loss_models[model_name](frozen_img, self.source_class, trainable_img, self.target_class) for model_name in self.clip_model_weights.keys()]))
File "/home/user/miniconda3/envs/nada/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/user/dev/StyleGAN-nada/ZSSGAN/criteria/clip_loss.py", line 299, in forward
clip_loss += self.lambda_direction * self.clip_directional_loss(src_img, source_class, target_img, target_class)
File "/home/user/dev/StyleGAN-nada/ZSSGAN/criteria/clip_loss.py", line 181, in clip_directional_loss
src_encoding = self.get_image_features(src_img)
File "/home/user/dev/StyleGAN-nada/ZSSGAN/criteria/clip_loss.py", line 109, in get_image_features
image_features = self.encode_images(img)
File "/home/user/dev/StyleGAN-nada/ZSSGAN/criteria/clip_loss.py", line 80, in encode_images
images = self.preprocess(images).to(self.device)
File "/home/user/miniconda3/envs/nada/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 60, in call
img = t(img)
File "/home/user/miniconda3/envs/nada/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 163, in call
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/home/user/miniconda3/envs/nada/lib/python3.7/site-packages/torchvision/transforms/functional.py", line 201, in normalize
raise TypeError('tensor is not a torch image.')
TypeError: tensor is not a torch image.
Hi,
I have a model trained in 2K resolution with StyleGAN-Ada and results have really good quality. I've tried StyleGAN-NADA to transfer my trained model to a new domain using the style-imgs option, and the results of the new image are quite good, however, the resulting images have less quality than the original images generated by StyleGAN-Ada.
The new images are quite blurred so I'm wondering if it's possible to adjust some parameters of the model to get more sharped images.
Hello,
Today when I I tried to run the 3rd step (training) of the Colab notebook I am getting the following error. Could you please assist?
AttributeError Traceback (most recent call last)
in ()
69
70 print("Loading base models...")
---> 71 net = ZSSGAN(args)
72 print("Models loaded! Starting training...")
73
/content/stylegan_nada/ZSSGAN/model/ZSSGAN.py in init(self, args)
154
155 # Set up frozen (source) generator
--> 156 self.generator_frozen = SG2Generator(args.frozen_gen_ckpt, img_size=args.size, channel_multiplier=args.channel_multiplier).to(self.device)
157 self.generator_frozen.freeze_layers()
158 self.generator_frozen.eval()
AttributeError: 'Namespace' object has no attribute 'channel_multiplier'
Hey, just a heads up. The colab linked in the readme doesn't work as provided. To fix it you have to add "target_img_list": None,
into the training_args dictionary.
Super cool project, thanks for work!
Thanks for the excellent work!
I want to train the generator from Human to Plastic Puppet using your adaptive layer-freezing approach, but I can't get the result(Figure 13 in the paper) from your train script, I change the improve_shape=True and lambda_global=1.0 in your script, but I'm not sure how to set the other parameters, such as "lambda_global"、"lambda_patch"、"lambda_texture"、"lambda_manifold" and so on.
can you share your train script for adaptive layer-freezing approach?
Hi,
Thanks for sharing the great work.
I am studying the StyleGAN and it is new for me.
I want to know how to use StyleGAN to create a new B images from A images. I can change the input images for StyleGAN.
Any help would be really appreciated in solving this problem!
After cloning https://huggingface.co/spaces/rinong/StyleGAN-NADA/tree/main
Attempting to run locally for video generation throws an error:
OS: Win 11 x64
CPU: 8700k
GPU: 3090
Ram: 32GB
Anaconda3 - python3.8:
conda activate chunkmogrify
cd C:\Anaconda3\envs\chunkmogrify\Lib\site-packages\StyleGAN-NADA
python app.py
Browser:
http://127.0.0.1:7860/
After adding any image, and selecting Edit image:
Aligned image has shape: (256, 256)
Traceback (most recent call last):
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\gradio\routes.py", line 275, in predict
output = await app.blocks.process_api(body, username, session_state)
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\gradio\blocks.py", line 274, in process_api
predictions = await run_in_threadpool(block_fn.fn, *processed_input)
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\starlette\concurrency.py", line 39, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\anyio\to_thread.py", line 28, in run_sync
return await get_asynclib().run_sync_in_worker_thread(func, *args, cancellable=cancellable,
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\anyio_backends_asyncio.py", line 818, in run_sync_in_worker_thread
return await future
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\anyio_backends_asyncio.py", line 754, in run
result = context.run(func, *args)
File "app.py", line 194, in inner
return func(self, *args, edit_choices)
File "app.py", line 231, in edit_image
return self.predict(input, output_styles, edit_choices=edit_choices)
File "app.py", line 252, in predict
inverted_latent = self.invert_image(input)
File "app.py", line 152, in invert_image
images, latents = self.run_on_batch(transformed_image.unsqueeze(0))
File "app.py", line 300, in run_on_batch
images, latents = self.e4e_net(
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Anaconda3\envs\chunkmogrify\Lib\site-packages\StyleGAN-NADA\e4e\models\psp.py", line 61, in forward
codes = self.encoder(x)
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Anaconda3\envs\chunkmogrify\Lib\site-packages\StyleGAN-NADA\e4e\models\encoders\psp_encoders.py", line 174, in forward
x = self.input_layer(x)
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\torch\nn\modules\container.py", line 141, in forward
input = module(input)
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\torch\nn\modules\module.py", line 1110, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\torch\nn\modules\conv.py", line 447, in forward
return self._conv_forward(input, self.weight, self.bias)
File "C:\Anaconda3\envs\chunkmogrify\lib\site-packages\torch\nn\modules\conv.py", line 443, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
The above Runetime Error also occured with:
WSL2 - Ubuntu 20.04.4 LTS
Anaconda3 - python3.9
Hi,
Thanks for sharing the great work.
I trained StyleGAN-ADA on a custom dataset and am using the trained weights to initialise StyleGAN-NADA (both, the trainable generator and the frozen generator). I am trying to train StyleGAN-NADA under image guidance, and the image prompt I am using is a set of 5 images, which the StyleGAN-ADA model has already seen during training. However, although StyleGAN-NADA learns to perform domain transfer (in my case, essentially, colour transfer, as the object shape stays roughly the same) onto source images which are close in colour to the target image prompt, the domain (colour) transfer fails when the source images are much different in colour. For example, if a light green object is shown in the target image prompt, it will result in the light green colour being successfully transferred onto a dark green object in a source image, but not onto a pink or blue object in the source image.
Any help would be really appreciated in solving this problem!
I am currently trying to run the program and I need to convert the ffhq.pkl model do a .pt one.
When I enter python stylegan_nada\convert_weight.py --repo stylegan_ada --gen models/ffhq.pkl
it says:
Traceback (most recent call last): File "stylegan_nada\convert_weight.py", line 11, in <module> from ZSSGAN.model.sg2_model import Generator, Discriminator File "C:\Users\msk4x\Documents\Projekte\stylegan\stylegan_nada\ZSSGAN\sg2_model.py", line 11, in <module> from op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d, conv2d_gradfix
How can I fix this?
I was wondering whether there's a possibility to share a script to generate videos from the trained model as shown on your project page. The .pt format is not easily usable for exporting videos from the original NVidia implementation. Any suggestion on how to implement it would be of much help.
Hi @rinongal , I have finetuned the styleganNada model and saved it by torch.save(net, "model.pt") but it didn't save the ModelClass with it due to which it is not deploying on Model Registry as standalone .pt file to serve the users. Can you help me how I pack the entire model with Class ?
Hello, I'm here to build a inference model to test several things that are exhibited on Additional examples in your README, such as turning photos into cubism painting style
but it is a bit challenging to find proper pre-trained models (if you've got one) for it.
If you do happen to have them, would you be able to share the link for it?
thanks in advance :)
I am trying to provide my own latent code for the "generate_videos.py" skript. I am using ReStyle for generating the latent code from my own pictures. When I start the skript everything is fine for the first 120 frames. After that every image is composed by multiple compressed random images. Is this a common issue?
If validated the latent code I am using. The shape of my latent code is identical to the shape of the latent code you provided. I noticed though, that the range of values of my own latent code is much greater that yours. Do you scale the values produced by ReStyle? Could this be the source of the error?
The skript works just fine for the latent code that you provided.
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.
Thanks for the great work!
For anyone interested, StyleGAN-nada can now be played on Kaggle notebook with P100 GPU, around 2x-3x speed-up compared to free Colab notebook.
Visit the annotated notebook here: https://www.kaggle.com/ratthachat/stylegan-nada-playground
@rinongal BTW, we also have kaggle badge :)
thank you for your sharing, it is a good idea for using CLIP model as supervise information and train G
as your paper said, it can generate unseen domain, like "Pig", "Super Saiyan", or "Nicolas Cage".
I think it means only the G not seen those domain dataset , but CLIP know thems. So it can supervise G to generate them。
I have two question:
1) How to improve the generation effect for “Pig”, or “Super Saiyan”, (except laten - Mapper) by using “Pig” images?
2) How to generate new domain which CLIP also never seen, like some Medical image, but I have some of them?
Hi. Thanks for opensourcing this amazing project. I am trying to train the network but I got OOM problem as I don't have any 16GB GPU. Could you please let me know which small models can I try on a 11GB GPU? Thanks so much!
Thanks for the great work!
I've managed to replicate most of your examples, except for the some cases. Could you possibly provide the setup for the Human -> Shrek and Human -> Thanos translation?
Hi, thanks for your impressive work! I am not sure how to use a style mapper to improve performance in some cases. Could you please share some tips or scripts for training a style mapper and how to use it with a fine-tuned generator?
Hi Rinon,
About the style of images, I have two questions:
Can you give us the list of all the available styles that can be used in the code? I'm a bit confused about how to set some styles correctly in the code, like the style ukiyoe, should I set it to "ukiyoe" or "ukiyo-e"? Because I'd like to reproduce the results in the paper.
Finally, how can I generate the sampling results as shown in the paper by myself? I ran the code and the saved results are four photos every time. So how can I generate diverse results as the paper shows?
Right now the size of the output is 1024x1024 pixels. Can I change the size of the output?
Thank you for your great work and I really like it.
One of the problems occurred to me is what's the purpose of normalizing edit_direction
, since the directional loss is actually cosine similarity which will normalize the compared feature. And in my experiment, it shows almost the same visual results.
StyleGAN-nada/ZSSGAN/criteria/clip_loss.py
Line 181 in 1a17364
.clone.norm()
while others did not. What's the difference of its effects?How might one load/include an generated .pt for use in the Gradio implementation after the below command has been completed?
Ex:
python train.py --size 1024 --batch 2 --n_sample 4 --output_dir output_images/images_style --lr 0.002 --frozen_gen_ckpt pretrained_models/stylegan2-ffhq-config-f.pt --iter 601 --style_img_dir images_style --auto_layer_k 18 --auto_layer_iters 1 --auto_layer_batch 8 --output_interval 50 --clip_models "ViT-B/32" "ViT-B/16" --clip_model_weights 1.0 1.0 --mixing 0.0 --save_interval 150
Result:
output_images/images_style/checkpoint/000600.pt
Hello Rinongal,
As far as I know, you mentioned that you clustered around generated images using K-medoids since yours does not use a training set.
How did you set the number of clusters K? (the few-shot adaptation methods choose K to be the number of training samples)
Can I ask you to provide details on evaluating image diversity quantitatively? If you can provide the source code for quantitative evaluation, I would be grateful. Thanks.
Hi, thanks for your excellent work! It is really instructive! however, I met a strange compiling problem while training the network. It reminds "subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1 while building extension 'fused'. This only happens on pytorch 1.7.1 and nothing happens using torch 1.4 (but clip models seem require torch1.7). I have got stuck with this for many days and still cannot find the solution 😀. Any suggestion for this? BTW, the torch 1.7 is installed using pip rather than coda, does this matter? Many thanks for the help 🤪. The environment I use is as listed:
ubuntu 20.14 pytorch 1.7.1 torchvision 0.8.2 torchaudio 0.7.2 CUDA 10.1 ninja 1.8.2
https://replicate.com/rinongal/stylegan-nada
which parameters or style or model was used to generate variations of a photo that are of a different gender / age from a source?
Hello. You said in the readme that we can replace the source class and target class with style_img_dir. But how to do it in practice? Two different img paths assigned to the same option?
great work, is it possible to due inference on cpu in colab?
i'm using this colab repo
the new pkl file should end up in the checkpoints folder right?
or do i have to add some particular lines of code?
https://github.com/rinongal/StyleGAN-nada/blob/StyleGAN3-NADA/stylegan3_nada.ipynb
edit:
found the code but it doesn't work in the normal stylegan, is that right? and if so, how do i use it after generating?
i also found out how to get the .pkl files with the save_interval but those don't work with the normal stylegan either
model_name = "network-snapshot-011120.pt"
torch.save(
{
"g_ema": net.generator_trainable.generator.state_dict(),
"g_optim": g_optim.state_dict(),
},
f"{ckpt_dir}/{model_name}",
)
!ls /content/output/checkpoint
is there any way to convert the file into a normal stylegan model again like this repo states it can convert a stylegan2-nada.pt to stylegan2.pkl so maybe this is possible for stylegan3?
https://github.com/eps696/stylegan2ada
all my pictures are slightly tilted to the left and i normally use the visualizer to fix that but it doesnt work with these files :(
Hi Rinongal, first of all many thanks for your amazing repo :)
I assume that generated .pt models under output/checkpoint folder are also in Pytorch Rosinality format, is it correct?
Is there any way to transform them into "standard" Pytorch or Tensorflow format?
Thanks again and sorry if it's off-topic
S.
Hi there, is it possible to infer with a non-square, 1024x512px, stylegan model?
Initializing networks...
0%| | 0/301 [00:00<?, ?it/s]
Traceback (most recent call last):
File "train.py", line 147, in <module>
train(args)
File "train.py", line 86, in train
[sampled_src, sampled_dst], loss = net(sample_z)
File "/home/ubuntu/anaconda3/envs/python3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/ubuntu/efs/saeid/facelab/StyleGAN-nada/ZSSGAN/model/ZSSGAN.py", line 260, in forward
train_layers = self.determine_opt_layers()
File "/home/ubuntu/efs/saeid/facelab/StyleGAN-nada/ZSSGAN/model/ZSSGAN.py", line 216, in determine_opt_layers
w_loss = [self.clip_model_weights[model_name] * self.clip_loss_models[model_name].global_clip_loss(generated_from_w, self.target_class) for model_name in self.clip_model_weights.keys()]
File "/home/ubuntu/efs/saeid/facelab/StyleGAN-nada/ZSSGAN/model/ZSSGAN.py", line 216, in <listcomp>
w_loss = [self.clip_model_weights[model_name] * self.clip_loss_models[model_name].global_clip_loss(generated_from_w, self.target_class) for model_name in self.clip_model_weights.keys()]
File "/home/ubuntu/efs/saeid/facelab/StyleGAN-nada/ZSSGAN/criteria/clip_loss.py", line 190, in global_clip_loss
image = self.preprocess(img)
File "/home/ubuntu/anaconda3/envs/python3/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 60, in __call__
img = t(img)
File "/home/ubuntu/anaconda3/envs/python3/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 163, in __call__
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/home/ubuntu/anaconda3/envs/python3/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 201, in normalize
raise TypeError('tensor is not a torch image.')
TypeError: tensor is not a torch image.
Hi there!
Thanks for your awesome project!
I was going through your project and found this image with different examples:
There are few examples the pre-trained models of which I can't find in your shared drive (e.g. shrek, simpsons, thanos and a few more). Would it be possible to add the pre-trained models of those examples as well?
Thanks in advance!
Hi!
Thanks for putting out the great work!
I am interested in training the frozen generator on a custom dataset. Could you please guide me, or kindly share the training code?
Would sincerely appreciate any help.
Thanks!
I was not able to find a StyleGan3 version of this project so I gave it a shot but got stuck because the StyleGan 2 and 3 models are apparently quite different.
For instance, the forward function for StyleGan 3 takes two tensors 'z' and 'c'
def forward(self, z, c, truncation_cutoff=None, update_emas=False):
While StyleGan 2 it only takes one tensor 'styles':
def forward(
self,
styles,
return_latents=False,
inject_index=None,
truncation=1,
truncation_latent=None,
input_is_latent=False,
input_is_s_code=False,
noise=None,
randomize_noise=True,
):
Any suggestions? This repo seems quite powerful and would be nice if could loose the old TF support.
Hi all. I noticed that by default the prompts that will be used to compute the text direction are composed based on a template. This generates a lot of directions and the mean is then used. This behaviour is not documented in the paper, am I missing something? Can I obtain the same results by only using two prompts (source and target) like described originally?
It's amazing!
Could you update to official stylegan2 and stylegan3?
hello!
I want to train this model on multiple GPUs, can you give me some advice?
looking forward to your reply!
Thanks.
Hi, thanks for the excellent work!
I set save_interval: 50, but no checkpoint saved in output_dir
ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 from ZSSGAN.model.ZSSGAN import ZSSGAN
2
3 import numpy as np
4
5 import torch
/content/stylegan_nada/ZSSGAN/model/ZSSGAN.py in ()
15 from ZSSGAN.model.sg2_model import Generator, Discriminator
16 from ZSSGAN.criteria.clip_loss import CLIPLoss
---> 17 import ZSSGAN.legacy as legacy
18
19 def requires_grad(model, flag=True):
ModuleNotFoundError: No module named 'ZSSGAN.legacy'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.