Coder Social home page Coder Social logo

Comments (7)

Dok11 avatar Dok11 commented on August 22, 2024 1

Try this: lightweight_gan --name name-of-your-model --show-progress --num-image-tiles 4 --generate-types [ema]
Library dont support --models_dir "path" argument.

from lightweight-gan.

woctezuma avatar woctezuma commented on August 22, 2024 1

Issue arises at line 1208:

def show_progress(self, num_images=4, types=['default', 'ema']):
checkpoints = self.get_checkpoints()
dir_name = self.name + str('-progress')
dir_full = Path().absolute() / self.results_dir / dir_name
ext = self.image_extension
latents = None
if not dir_full.exists():
os.mkdir(dir_full)
for checkpoint in tqdm(checkpoints, desc='Generating progress images'):
self.load(checkpoint, print_version=False)
self.GAN.eval()

It looks like checkpoints (returned at line 1198) is None, as in #48.

You might want to ensure that you are running the latest release of the package.

from lightweight-gan.

druidOfCode avatar druidOfCode commented on August 22, 2024

Unfortunately no dice. Different error this time though.
Ran: lightweight_gan --name "default" --show-progress --num-image-tiles 4 --generate-types [ema]
Log: Generating progress images: 0it [00:00, ?it/s]Traceback (most recent call last): File "/usr/local/bin/lightweight_gan", line 8, in <module> sys.exit(main()) File "/usr/local/lib/python3.6/dist-packages/lightweight_gan/cli.py", line 185, in main fire.Fire(train_from_folder) File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 138, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 468, in _Fire target=component.__name__) File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 672, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "/usr/local/lib/python3.6/dist-packages/lightweight_gan/cli.py", line 166, in train_from_folder model.show_progress(num_images=num_image_tiles, types=generate_types) File "/usr/local/lib/python3.6/dist-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/lightweight_gan/lightweight_gan.py", line 1208, in show_progress for checkpoint in tqdm(checkpoints, desc='Generating progress images'): File "/usr/local/lib/python3.6/dist-packages/tqdm/std.py", line 1104, in __iter__ for obj in iterable: TypeError: 'NoneType' object is not iterable Generating progress images: 0it [00:00, ?it/s]

from lightweight-gan.

druidOfCode avatar druidOfCode commented on August 22, 2024

Currently running the latest (0.17.4). Worth noting that this is running in Colab, not sure why it would cause this but I'd be remiss to not mention this.

from lightweight-gan.

druidOfCode avatar druidOfCode commented on August 22, 2024

Dang it, I was pretty sure I had it there. With models_dir being unsupported here, I figured it was unable to find the checkpoints since it checks ./models/model-name/ but in my environment, the checkpoints are in ./model-name/. Moved the folders around... Now I'm back to the first error.

Generating progress images: 0% 0/32 [00:00<?, ?it/s]Traceback (most recent call last): File "/usr/local/bin/lightweight_gan", line 8, in <module> sys.exit(main()) File "/usr/local/lib/python3.6/dist-packages/lightweight_gan/cli.py", line 185, in main fire.Fire(train_from_folder) File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 138, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 468, in _Fire target=component.__name__) File "/usr/local/lib/python3.6/dist-packages/fire/core.py", line 672, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "/usr/local/lib/python3.6/dist-packages/lightweight_gan/cli.py", line 166, in train_from_folder model.show_progress(num_images=num_image_tiles, types=generate_types) File "/usr/local/lib/python3.6/dist-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/lightweight_gan/lightweight_gan.py", line 1223, in show_progress generated_image = self.generate_truncated(self.GAN.GE, latents) File "/usr/local/lib/python3.6/dist-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/lightweight_gan/lightweight_gan.py", line 1272, in generate_truncated generated_images = evaluate_in_chunks(self.batch_size, G, style) File "/usr/local/lib/python3.6/dist-packages/lightweight_gan/lightweight_gan.py", line 99, in evaluate_in_chunks split_args = list(zip(*list(map(lambda x: x.split(max_batch_size, dim=0), args)))) File "/usr/local/lib/python3.6/dist-packages/lightweight_gan/lightweight_gan.py", line 99, in <lambda> split_args = list(zip(*list(map(lambda x: x.split(max_batch_size, dim=0), args)))) AttributeError: 'NoneType' object has no attribute 'split' Generating progress images: 0% 0/32 [00:12<?, ?it/s]

The number of checkpoints is accurate though, so it found the files at least... progress 👍🏾
(Edit: link to Colab for generating progress (I have a separate one that does the training) for additional context https://colab.research.google.com/drive/1H9Mh406f_Bc1ImIGnQObp3H0OXTRDJ08?usp=sharing)

Update: Confirmed issue is present in 0.17.5

from lightweight-gan.

Dok11 avatar Dok11 commented on August 22, 2024

Can you show files structure with model checkpoints and usage command?

from lightweight-gan.

druidOfCode avatar druidOfCode commented on August 22, 2024

Heres the file structure for the working directory:

LightGAN/
├── default/
│   ├── .config.json
│   ├── model_1.pt
│   ├── model_10.pt
│   ├── model_11.pt
│   ├── model_12.pt
│   ├── model_13.pt
│    . . .
│   ├── model_45.pt
│   ├── model_5.pt
│   ├── model_6.pt
│   ├── model_7.pt
│   ├── model_8.pt
│   └── model_9.pt
├── generated/
│   └── default/
├── models/
│   └── default/
│       ├── .config.json
│       ├── model_1.pt
│       ├── model_10.pt
│       ├── model_11.pt
│       ├── model_12.pt
│       ├── model_13.pt
│        . . .
│       ├── model_45.pt
│       ├── model_5.pt
│       ├── model_6.pt
│       ├── model_7.pt
│       ├── model_8.pt
│       └── model_9.pt
└── results/
    ├── default/
    │   ├── 0-ema.jpg
    │   ├── 0.jpg
    │   ├── 1-ema.jpg
    │   ├── 1.jpg
    │   ├── 10-ema.jpg
    │   ├── 10.jpg
    │   ├── 11-ema.jpg
    │   ├── 11.jpg
    │   ├── 12-ema.jpg
    │   ├── 12.jpg
    │   ├── 13-ema.jpg
    │   ├── 13.jpg
    │   ├── 14-ema.jpg
    │   ├── 14.jpg
    │   ├── 15-ema.jpg
    │   ├── 15.jpg
    │   ├── 16-ema.jpg
    │   ├── 16.jpg
    │   ├── 17-ema.jpg
    │   ├── 17.jpg
    │   ├── 18-ema.jpg
    │   ├── 18.jpg
    │   ├── 19-ema.jpg
    │   ├── 19.jpg
    │   ├── 2-ema.jpg
    │   ├── 2.jpg
    │    . . .
    │   ├── 59.jpg
    │   ├── 6-ema.jpg
    │   ├── 6.jpg
    │   ├── 60-ema.jpg
    │   ├── 60.jpg
    │   ├── 61-ema.jpg
    │   ├── 61.jpg
    │   ├── 7-ema.jpg
    │   ├── 7.jpg
    │   ├── 8-ema.jpg
    │   ├── 8.jpg
    │   ├── 9-ema.jpg
    │   ├── 9.jpg
    │   └── fid_scores.txt
    └── default-progress/

Command for generating checkpoints:
lightweight_gan --num-train-steps 150000 --data /content/images --optimizer "adabelief" --attn-res-layers [32,64,128] --image-size 512 --disc-output-size 5 --models_dir "/content/drive/MyDrive/Colab Notebooks/LightGAN" --results_dir "/content/drive/MyDrive/Colab Notebooks/LightGAN/results" --calculate_fid_every 25000

Command for generating progress:
lightweight_gan --name "default" --show-progress --num-image-tiles 4 --generate-types [ema]

from lightweight-gan.

Related Issues (20)

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.