PyTorch-StudioGAN icon indicating copy to clipboard operation
PyTorch-StudioGAN copied to clipboard

list index out of range(in utils.ckpt. load_StudioGAN_ckpts())

Open goongzi-leean opened this issue 2 years ago • 1 comments

hi,

I found glob. glob (in utils.ckpt. load_StudioGAN_ckpts())returns an empty list, causing list index out of range to appear.

The reason is that the folder name contains special character '=', so you need to run glob.escape() to get the file in the path normally.

I used

x = join(ckpt_dir, "model=G-{when}-weights-step=".format(when=when))
Gen_ckpt_path = glob.glob(glob.escape(x) + '*.pth')[0]
    
y = join(ckpt_dir, "model=D-{when}-weights-step=".format(when=when))
Dis_ckpt_path = glob.glob(glob.escape(y) + '*.pth')[0]

instead of

Gen_ckpt_path = glob.glob(join(ckpt_dir, "model=G-{when}-weights-step*.pth".format(when=when)))[0]

Dis_ckpt_path = glob.glob(join(ckpt_dir, "model=D-{when}-weights-step*.pth".format(when=when)))[0]

goongzi-leean avatar Aug 04 '22 17:08 goongzi-leean

thank.

I will reflect this ASPA.

Thank you for your kind reporting.

mingukkang avatar Aug 24 '22 08:08 mingukkang