Projected GAN

import pathlib
import pickle
import sys

sys.path.insert(0, '~/codes/clones/projected_gan')

import dnnlib
import legacy

paths = sorted(pathlib.Path('orig'))

out_dir = pathlib.Path('models')
out_dir.mkdir()

for path in paths:
    with dnnlib.util.open_url(path.as_posix()) as f:
        model = legacy.load_network_pkl(f)['G_ema'].to('cpu')
    ckpt = {'G_ema': model}
    outpath = out_dir / path.name
    with open(outpath, 'wb') as f:
        pickle.dump(ckpt, f)