sony / san

PyTorch implementation of slicing adversarial network (SAN)
90 stars 5 forks source link

Fail to load network .pkl file #6

Open Baoren1996 opened 3 months ago

Baoren1996 commented 3 months ago

I tried to download the saved network from the link below: https://zenodo.org/record/10947091/files/stylesan-xl_cifar10.pkl however, when I tried to use the following code for evaluation:

python calc_metrics.py --metrics=fid50k_full --network=./stylesan-xl_cifar10.pkl

but got error: Screenshot 2024-09-03 at 12 03 00

Python==3.8.10 Pytorch==2.4.0+cu121

Can somebody help?

TakashiShibuyaSony commented 3 months ago

Hello, thank you for reaching out to us!

Our recommendation is preparing a Docker container, following the README.md. https://github.com/sony/san/tree/main/stylesan-xl#requirements

If you don't want to rely on Docker for some reason, it should be good to use the same versions of packages described in the following files. https://github.com/sony/san/blob/0e52b1428b2e66ae1c5f6a3586a76497d88c9ea8/stylesan-xl/requirements.txt#L1-L20 https://github.com/sony/san/blob/0e52b1428b2e66ae1c5f6a3586a76497d88c9ea8/stylesan-xl/Dockerfile#L5 This may work.

Thank you.

Baoren1996 commented 2 months ago

Hello, thank you for reaching out to us!

Our recommendation is preparing a Docker container, following the README.md. https://github.com/sony/san/tree/main/stylesan-xl#requirements

If you don't want to rely on Docker for some reason, it should be good to use the same versions of packages described in the following files.

https://github.com/sony/san/blob/0e52b1428b2e66ae1c5f6a3586a76497d88c9ea8/stylesan-xl/requirements.txt#L1-L20

https://github.com/sony/san/blob/0e52b1428b2e66ae1c5f6a3586a76497d88c9ea8/stylesan-xl/Dockerfile#L5

This may work. Thank you.

Hi @TakashiShibuyaSony, thanks for your instruction which works perfectly for me.

Another question, given the CIFAR model snapshot, is there any way to resume the training from the pkl file? do I also need the stem network .pkl file?

Thanks a lot in advance.

Best, Baoren

TakashiShibuyaSony commented 2 months ago

Hi @Baoren1996, You can resume the training by using the following option. You should provide the path of the .pkl file. https://github.com/sony/san/blob/0e52b1428b2e66ae1c5f6a3586a76497d88c9ea8/stylesan-xl/train.py#L144

Regarding the .pkl file of the stem network, the current code requires it (Our codebase build on that of StyleGAN-XL, and their code requires a stem network even in resuming training). But, I guess you can resume the training without the stem network by reloading the ckpt for resume in the following lines again. https://github.com/sony/san/blob/0e52b1428b2e66ae1c5f6a3586a76497d88c9ea8/stylesan-xl/training/networks_stylegan3_resetting.py#L613-L614 And, the succeeding lines should also be modified. In particular, the following lines are not necessary in this case because these lines are for appending new layers in progressive training. https://github.com/sony/san/blob/0e52b1428b2e66ae1c5f6a3586a76497d88c9ea8/stylesan-xl/training/networks_stylegan3_resetting.py#L651-L673

Thanks!

Cwyxx commented 1 month ago

Update dill to 0.3.9. It works for me.

TakashiShibuyaSony commented 1 month ago

Hi @Cwyxx, Thank you very much for your helpful information. We updated requirements.txt