williamyang1991 / DualStyleGAN

[CVPR 2022] Pastiche Master: Exemplar-Based High-Resolution Portrait Style Transfer
Other
1.61k stars 249 forks source link

issue while installing #91

Closed nonvegetarian closed 10 months ago

nonvegetarian commented 10 months ago

(base) C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main>conda env create -f ./environment/dualstylegan_env.yaml Collecting package metadata (repodata.json): done Solving environment: failed

ResolvePackageNotFound:

williamyang1991 commented 10 months ago

You may refer to https://github.com/williamyang1991/VToonify/issues/50#issuecomment-1443061101 and https://github.com/williamyang1991/VToonify/issues/38 for solution. And you may refer to https://github.com/williamyang1991/VToonify/tree/main/model/stylegan/op_cpu#readme if you cannot install something like fused

nonvegetarian commented 10 months ago

facing this error now -

(vtoon_env) C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main>python style_transfer.py --scale_image No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.3' Traceback (most recent call last): File "C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main\style_transfer.py", line 4, in from util import save_image, load_image File "C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main\util.py", line 10, in from model.stylegan.op import conv2d_gradfix File "C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main\model\stylegan\op__init__.py", line 1, in from .fused_act import FusedLeakyReLU, fused_leaky_relu File "C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main\model\stylegan\op\fused_act.py", line 11, in fused = load( File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1308, in load return _jit_compile( File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1710, in _jit_compile _write_ninja_file_and_build_library( File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1810, in _write_ninja_file_and_build_library _write_ninja_file_to_build_library( File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 2199, in _write_ninja_file_to_build_library cuda_flags = common_cflags + COMMON_NVCC_FLAGS + _get_cuda_arch_flags() File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\utils\cpp_extension.py", line 1980, in _get_cuda_arch_flags arch_list[-1] += '+PTX' IndexError: list index out of range

williamyang1991 commented 10 months ago

You error is about fused

File "C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main\model\stylegan\op\fused_act.py", line 11, in fused = load(

And my previous answer

And you may refer to https://github.com/williamyang1991/VToonify/tree/main/model/stylegan/op_cpu#readme if you cannot install something like fused

So, please refer to my previous answer

nonvegetarian commented 10 months ago

Thankyou, encountering this error now -

(vtoon_env) C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main>python style_transfer.py --scale_image usage: style_transfer.py [-h] [--content CONTENT] [--style STYLE] [--style_id STYLE_ID] [--truncation TRUNCATION] [--weight WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT WEIGHT] [--name NAME] [--preserve_color] [--model_path MODEL_PATH] [--model_name MODEL_NAME] [--output_path OUTPUT_PATH] [--data_path DATA_PATH] [--align_face] [--exstyle_name EXSTYLE_NAME] [--wplus] style_transfer.py: error: unrecognized arguments: --scale_image

nonvegetarian commented 10 months ago

And this error after I remove "--scale_image" -

(vtoon_env) C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main>python style_transfer.py Load options align_face: False content: ./data/content/081680.jpg data_path: ./data/ exstyle_name: exstyle_code.npy model_name: generator.pt model_path: ./checkpoint/ name: cartoon_transfer output_path: ./output/ preserve_color: False style: cartoon style_id: 53 truncation: 0.75 weight: [0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] wplus: False


Traceback (most recent call last): File "C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main\style_transfer.py", line 75, in ckpt = torch.load(os.path.join(args.model_path, args.style, args.model_name), map_location=lambda storage, loc: storage) File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\serialization.py", line 986, in load with _open_file_like(f, 'rb') as opened_file: File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\serialization.py", line 435, in _open_file_like return _open_file(name_or_buffer, mode) File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\serialization.py", line 416, in init super().init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: './checkpoint/cartoon\generator.pt'

williamyang1991 commented 10 months ago

I believe you need to carefully read the README.md before running the code.

No option of --scale_image but align_face image

Manually download the pretrained model image

nonvegetarian commented 10 months ago

Thankyou, but there seems to be an issue-

(vtoon_env) C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main>python style_transfer.py --content ./data/content/unsplash-rDEOVtE7vOs.jpg --align_face --preserve_color Load options align_face: True content: ./data/content/unsplash-rDEOVtE7vOs.jpg data_path: ./data/ exstyle_name: exstyle_code.npy model_name: generator.pt model_path: ./checkpoint/ name: cartoon_transfer output_path: ./output/ preserve_color: True style: cartoon style_id: 53 truncation: 0.75 weight: [0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] wplus: False


Traceback (most recent call last): File "C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main\style_transfer.py", line 75, in ckpt = torch.load(os.path.join(args.model_path, args.style, args.model_name), map_location=lambda storage, loc: storage) File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\serialization.py", line 986, in load with _open_file_like(f, 'rb') as opened_file: File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\serialization.py", line 435, in _open_file_like return _open_file(name_or_buffer, mode) File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\serialization.py", line 416, in init super().init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: './checkpoint/cartoon\generator.pt'

williamyang1991 commented 10 months ago

Manually download the pretrained model

Please read my answer carefully. Download the missing pretrained model and save it to './checkpoint/cartoon\generator.pt'

https://github.com/williamyang1991/DualStyleGAN#pretrained-models

nonvegetarian commented 10 months ago

I don't have a cartoon folder inside the checkpoint folder. I just have one readme file in my checkpoint folder

nonvegetarian commented 10 months ago

I have downloaded the generator.pt but, where do I save it?

can you please help me with this bit?

I have nothing but readme.md file in my checkpoint folder

williamyang1991 commented 10 months ago

Please read my answer carefully. Download the missing pretrained model and save it to './checkpoint/cartoon\generator.pt'

create a new folder named cartoon and save it to './checkpoint/cartoon/generator.pt

nonvegetarian commented 10 months ago

Should I also download the rest of the files ("refined_exstyle_code.npy", "sampler.pt", "instyle_code.npy", "finetune000600.pt", "exstyle_code.npy") from the drive for cartoon pretrained model and save them in the "cartoon" folder inside the checkpoint?

williamyang1991 commented 10 months ago

To avoid similar issues, you'd better download them all

nonvegetarian commented 10 months ago

Now it says - "Torch not compiled with CUDA enabled"

(vtoon_env) C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main>python style_transfer.py --content ./data/content/unsplash-rDEOVtE7vOs.jpg --align_face --preserve_color Load options align_face: True content: ./data/content/unsplash-rDEOVtE7vOs.jpg data_path: ./data/ exstyle_name: refined_exstyle_code.npy model_name: generator.pt model_path: ./checkpoint/ name: cartoon_transfer output_path: ./output/ preserve_color: True style: cartoon style_id: 53 truncation: 0.75 weight: [0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 0.75, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] wplus: False


Traceback (most recent call last): File "C:\Users\ruthv\Downloads\DualStyleGAN-main\DualStyleGAN-main\style_transfer.py", line 77, in generator = generator.to(device) File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\nn\modules\module.py", line 1160, in to return self._apply(convert) File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\nn\modules\module.py", line 810, in _apply module._apply(fn) File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\nn\modules\module.py", line 810, in _apply module._apply(fn) File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\nn\modules\module.py", line 833, in _apply param_applied = fn(param) File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\nn\modules\module.py", line 1158, in convert return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking) File "C:\Users\ruthv\anaconda3\envs\vtoon_env\lib\site-packages\torch\cuda__init__.py", line 289, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

williamyang1991 commented 10 months ago

If you are brand-new to pytorch and running deep learning models, I suggest you to use the huggingface demo rather than asking me.

nonvegetarian commented 10 months ago

Thanks, but I would like to execute and try it out for myself and learn through...Can you help me?

nonvegetarian commented 10 months ago

I have used -

pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

to install pytorch compiled with my CUDA version now, I'll update you when it is done

williamyang1991 commented 10 months ago

I'm sorry I'm very busy and have no time to help you with these basic installation issues. Your issues are basically not about the bug of my code, but the lack of your experience in building environment and running deep learning models. All these issues can find solutions on the Internet. I think the best way is to search the solution on Google rather than asking me everytime you find an error..

I will close this issue and not answer your questions in this issue. If you find bugs of the code rather than these basic installation issues, you can raise a new issue.