Skip to content

how to instantiate a model, load a checkpoint and visualize some generated images? #189

@ghost

Description

Could you help with this please? I'm trying to run a DCGAN model form the StudioGAN repo and using the checkpoint at Hugging face. No matter what I try it shows different error. Can any one please show me how to instantiate one of the GAN model like DCGAN, WGAN,... and then load a checkpoints and just generate some data. No training whatsoever.

As my system is quite weak I need to run over Colab. Here's what I did:

I've downloaded checkpoints from Hugging face here for Cifar10-DCGAN. then made a folder "checkpoints" and uploaded this checkpoints. Also made a folder with name "results". Then:

!pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116
!pip install tqdm ninja h5py kornia matplotlib pandas sklearn scipy seaborn wandb PyYaml click requests pyspng imageio-ffmpeg timm
! pip install wandb
!wandb login  xxx # my login info....

Then cloned the repo

!git clone https://github.com/POSTECH-CVLab/PyTorch-StudioGAN.git

And then once I did

import os
os.chdir("PyTorch-StudioGAN")

!CUDA_VISIBLE_DEVICES=0 python3  \
/content/PyTorch-StudioGAN/src/main.py \
-sf -metrics is fid prdc -cfg /content/PyTorch-StudioGAN/src/configs/CIFAR10/DCGAN.yaml \
-data data/cifar10 -ckpt /content/checkpoints -save /content/results  

The tag -t is for training and -sf is for saving figures I guess. So, it still shows an error! What's the issue and how can I fix it??
And it give the error message of :

Traceback (most recent call last):
  File "/content/PyTorch-StudioGAN/src/main.py", line 192, in <module>
    loader.load_worker(local_rank=rank,
  File "/content/PyTorch-StudioGAN/src/loader.py", line 237, in load_worker
    ckpt.load_StudioGAN_ckpts(ckpt_dir=cfgs.RUN.ckpt_dir,
  File "/content/PyTorch-StudioGAN/src/utils/ckpt.py", line 81, in load_StudioGAN_ckpts
    Gen_ckpt_path = glob.glob(glob.escape(x) + '*.pth')[0]
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions