Giter VIP home page Giter VIP logo

stylegan2ada's People

Contributors

eps696 avatar gilesbathgate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

stylegan2ada's Issues

Parameter --snap=1 does not work

Hello, thank you very much for the great repo.

For non-square experiments I use your repo with Google Colab (not Pro), here unfortunately the connection often breaks down unexpectedly, which is why I would like to change snaps from default=5 to 1. But I always get this error:

/content/sg2-ada-pt-eps696/src Traceback (most recent call last): File "train.py", line 406, in <module> main() # pylint: disable=no-value-for-parameter File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/click/decorators.py", line 21, in new_func return f(get_current_context(), *args, **kwargs) File "train.py", line 353, in main run_desc, args = setup_training_loop_kwargs(**config_kwargs) File "train.py", line 61, in setup_training_loop_kwargs assert snap > 1, '--snap must be at least 1' AssertionError: --snap must be at least 1

I start my training with this command:

!python train.py
--train_dir=/content/googledrive/MyDrive
--data=/content/720x1280-Test.zip
--cfg="eps"
--mirror=True
--snap=1
--seed=0
--kimg=25000
--aug=ada
--target=0.699
--augpipe=bgc
--gamma=6
--workers=2

error when trying to fine tune 1280x768 model

Hi!

I'm trying to fine tune a model i found here: https://thisbeachdoesnotexist.com/

Model specs:

StyleGAN2-Ada
Dataset 20.000 images
Network size 362 MB
Resolution 1280ร—768 px
Network layout 5ร—3 squares (with 28 = 256 px sides)
Training options --min_w=5 --min_h=3 --res_log2=8
Trained using RoyWheels/stylegan2-ada (github)
Training steps 25.000 kimg
Metric FID50k 3.14

I get this warning

Resuming from "/G/MyDrive/sg2a_eps/train/beach-network-snapshot-025000.pkl", kimg 0
warning: unknown TF kwargs ['res_log2', 'min_w', 'min_h']

and then this error

AssertionError Traceback (most recent call last)
/G/MyDrive/sg2a_eps/src/train.py in ()
407 spec = "ModuleSpec(name='builtins', loader=<class '_frozen_importlib.BuiltinImporter'>)"
408
--> 409 main() # pylint: disable=no-value-for-parameter
410

13 frames
/G/MyDrive/sg2a_eps/src/training/networks.py in init(self, w_dim, img_resolution, img_channels, init_res, channel_base, channel_max, num_fp16_res, **block_kwargs)
451 **block_kwargs, # Arguments for SynthesisBlock.
452 ):
--> 453 assert img_resolution >= 4 and img_resolution & (img_resolution - 1) == 0
454 super().init()
455 self.w_dim = w_dim

AssertionError:

My dataset is in 1280x768.
I've been able to train with my dataset from scratch, but having this problem when doing transfer learning from this beach model.

Thank You!

Change aspect ratio of a trained model

Hi @eps696 first of all many thanks for your code.
I'm using your colab notebook to try to change aspect ratio of a model. After trying some models without success I found in another issue a model that it was supposed to work:
Issue "Arbitrary resolution for torch models #2"
Model https://drive.google.com/file/d/1OHuKMJFH0b85ql2vMrD9bWYFjAiwvXAE/view

But also using this model I'm getting this error:
AssertionError: !! G/D subnets not found in source model !!

Is it a only colab issue? Any hint?
Many thanks

Arbitrary resolution for torch models

Hi!
I think it is more likely that I did something wrong, but I can't generate anything with a non-native resolution.
I made a small research and found that legacy.py is used for loading models and resolution change is applied only for models converted from tensorflow.

Anyway, repo is great, thanks for your work!

Seed usage

Similar to the stylegan2-ada repo, is it possible to specify seeds when using the generate script?

ie gen.bat ffhq-1024.pkl --seeds=0-100

Individual changes.

Your commits seem to have very brief descriptions, and I can't find the changes specific to the features you've added. I'd like to take just the changes relating to non-square aspect ratio support.

Would it be possible for you to help me isolate these changes and put them in a separate branch?

Generator outputs are non-sense after 5 days of training

Hi,

I was using the official StyleGAN2-ada from NVIDIA's pytorch repo, which worked well but do not allow to directly train on rectangular images. So I am trying this repo (thanks for the work !) on 768x1024 images.

The saved _reals.jpg images look totally fine. But after 4368kimg the generator is still outputting "crap". See the output of fake-4368.jpg below:

fake-4368

Has anyone faced this please ? The only configuration I provide to the training is --batch 8 --kimg 10000 and the dataset is about 40k images all cropped to 768x1024. I have inspected the dataset, its curated and of consistent quality.

Thanks for any hints, would be nice not to spend too much runs into black and green glitches .. (the targets are natural images)

Drive keep unmounting

I'm experiencing a weird behavior with the drive folder keeping unmounting. After running the general setup cell and successfully downloading files in sg2a_eps I get

ERROR:root:File 'src/train.py' not found.
[Errno 107] Transport endpoint is not connected: '/G/MyDrive/sg2a_eps/'
/G/MyDrive/sg2a_eps

Installing collected packages: ninja
Successfully installed ninja-1.10.0.post2
Mounted at /G
/G/MyDrive
/G/MyDrive/sg2a_eps
Requirement already satisfied: click in /usr/local/lib/python3.7/dist-packages (from -r requirements.txt (line 1)) (7.1.2)
Requirement already satisfied: psutil in /usr/local/lib/python3.7/dist-packages (from -r requirements.txt (line 2)) (5.4.8)
.. Done ..

Tuple error

why I am getting this error?

TypeError: 'tuple' object is not callable

when I remove --aug=ada --target=0.7 and give no aug it works

I am training on rgba images, none of aug is working, previously it was working now its failing.

%run src/train.py --data data/mydata --resume train/035-mydata-512-big-target0.7-gf_bnc --batch=20 --kimg 1000 --mirror=False --aug=ada --target=0.7 --cfg="big"

ModuleAttributeError: 'Generator' object has no attribute 'init_res'

Hey Vadim,

I seem to be having this error whenever I try to generate using custom size, multi-latent generation or 'other tricks' digression mode.

Native generation seems to be working just fine, but I'm really missing these features as compared to the original SG2.

I'm trying to generate from a SG2-ada-pytorch .pkl.

Thanks for your work on maintaining this repo!

Kimg needs to be specified

Thanks for setting this up. Trying this on rbga images, so hoping it works. Just as an fyi, unlike stylegan2-ada it looks like the kimg arg needs to be specified when training otherwise it breaks. Should it be defaulted?

train.py

Hi, thank you for the excellent repo. I have a query about the train.py file, does the train.py use the StyleGAN2-ADA network from network.py or stylegan2_multi.py file because I see 2 different Generator Classes defined in each of the files? Also, apologies if this is a trivial question.

Can't find ffhq-256 in train folder

I want to train with fine-tune style.
But I could not find pre-trained model named ffhq-256.pkl in /train/.
Is there any link or urls to download them?

Assertion error in multi-latent generation

I get an assertion error when I try to use multi-latent generation in both Google Colab and running locally in Jupyter notebook on Ubuntu in a working sg2ada environment.

Native generation works fine in both cases.

Would love to try multi-latents but not sure what to do with this one! Thanks for any help!

*Edit - In case it's relevant, this is an SG2-ADA model that was trained originally in Tensorflow and then converted to pytorch using Derrick's legacy.py

**Edit again - Fixed now! I had been using a TF model. Still had an error using one converted with legacy.py, but then tried your model_convert.py and all is working now!

Colab error message looks like this:

/G/MyDrive/sg2a_eps
 .. Gs custom .. network-snapshot-000230
 latents (20, 3, 512)
0/20
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
[/G/MyDrive/sg2a_eps/src/_genSGAN2.py](https://localhost:8080/#) in <module>
    164 
    165 if __name__ == '__main__':
--> 166     generate()

6 frames
[/G/MyDrive/sg2a_eps/src/_genSGAN2.py](https://localhost:8080/#) in generate()
    140         # generate multi-latent result
    141         if custom:
--> 142             output = Gs(latent, label, latmask, dc, truncation_psi=a.trunc, noise_mode='const')
    143         else:
    144             output = Gs(latent, label, truncation_psi=a.trunc, noise_mode='const')

[/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py](https://localhost:8080/#) in _call_impl(self, *input, **kwargs)
    725             result = self._slow_forward(*input, **kwargs)
    726         else:
--> 727             result = self.forward(*input, **kwargs)
    728         for hook in itertools.chain(
    729                 _global_forward_hooks.values(),

[/G/MyDrive/sg2a_eps/src/training/stylegan2_multi.py](https://localhost:8080/#) in forward(self, z, c, latmask, dconst, truncation_psi, truncation_cutoff, **synthesis_kwargs)
    403     # def forward(self, z, c, truncation_psi=1, truncation_cutoff=None, **synthesis_kwargs):
    404         ws = self.mapping(z, c, truncation_psi=truncation_psi, truncation_cutoff=truncation_cutoff)
--> 405         img = self.synthesis(ws, latmask, dconst, **synthesis_kwargs) # !!! custom
    406         return img
    407 

[/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py](https://localhost:8080/#) in _call_impl(self, *input, **kwargs)
    725             result = self._slow_forward(*input, **kwargs)
    726         else:
--> 727             result = self.forward(*input, **kwargs)
    728         for hook in itertools.chain(
    729                 _global_forward_hooks.values(),

[/G/MyDrive/sg2a_eps/src/training/stylegan2_multi.py](https://localhost:8080/#) in forward(self, ws, latmask, dconst, **block_kwargs)
    366             block = getattr(self, f'b{res}')
    367 # !!! custom
--> 368             x, img = block(x, img, cur_ws, latmask, dconst, **block_kwargs)
    369             # x, img = block(x, img, cur_ws, **block_kwargs)
    370         return img

[/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py](https://localhost:8080/#) in _call_impl(self, *input, **kwargs)
    725             result = self._slow_forward(*input, **kwargs)
    726         else:
--> 727             result = self.forward(*input, **kwargs)
    728         for hook in itertools.chain(
    729                 _global_forward_hooks.values(),

[/G/MyDrive/sg2a_eps/src/training/stylegan2_multi.py](https://localhost:8080/#) in forward(self, x, img, ws, latmask, dconst, force_fp32, fused_modconv, **layer_kwargs)
    295             img = img.add_(y) if img is not None else y
    296 
--> 297         assert x.dtype == dtype
    298         assert img is None or img.dtype == torch.float32
    299         return x, img

AssertionError:

The local Jupyter traceback is almost the same but references some different lines.

Cant change aspect ratio to square

Hi there, Im trying to change a 512x1024 model into a 1024x1024 model, it says success and outputs a model but its size is still 512x1024 or atleast when I try to infer at 1024x1024 it gives me the error:
size mismatch for noises.noise_16: copying a param with shape torch.Size([1, 1, 1024, 512]) from checkpoint, the shape in current model is torch.Size([1, 1, 1024, 1024]).

Thanks!

Is it possible to turn of mirroring ?

I'm trying to keep an image compositon while training, but the notebook keeps adding mirrored copies of my dataset. Is there a way to turn this of ? I've searched the code but haven't found a solution yet.

xoxo
Moto

screen_mirror_eps

RGBA Images training

I am trying to train with rgba images, but its going to gradient explosion, I tried to reduce the learning rate but nothing seems to work.
Can somebody help? My dataset has about 2k unique images and I pumped it upto 60k images with augmentation.
Finetuning by adding alpha to other rgb models did not go well, Im training from scratch.
download (31)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.