Taeu / Style-Your-Hair

Official Pytorch implementation of "Style Your Hair: Latent Optimization for Pose-Invariant Hairstyle Transfer via Local-Style-Aware Hair Alignment (ECCV 2022)"
293 stars 40 forks source link

Error while running main.py command #27

Open RahmaButt opened 4 months ago

RahmaButt commented 4 months ago

when i run this command python main.py --input_dir ffhq_image --im_path1 source.png --im_path2 target.png --output_dir style_your_hair_output --warp_loss_with_prev_list delta_w style_hair_slic_large --save_all --version final --flip_check

i got error Loading StyleGAN2 from checkpoint: pretrained_models/ffhq.pt torch.Size([512]) Setting up Perceptual loss... C:\Users\WebPC-05\AppData\Local\anaconda3\envs\testing2\lib\site-packages\torchvision\models_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead. warnings.warn( C:\Users\WebPC-05\AppData\Local\anaconda3\envs\testing2\lib\site-packages\torchvision\models_utils.py:223: UserWarning: Arguments other than a weight enum or None for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing weights=VGG16_Weights.IMAGENET1K_V1. You can also use weights=VGG16_Weights.DEFAULT to get the most up-to-date weights. warnings.warn(msg) Loading model from: C:\Users\WebPC-05\Style-Your-Hair\losses\lpips\weights\v0.1\vgg.pth ...[net-lin [vgg]] initialized ...Done Traceback (most recent call last): File "C:\Users\WebPC-05\Style-Your-Hair\main.py", line 162, in main(args) File "C:\Users\WebPC-05\Style-Your-Hair\main.py", line 53, in main im_path2 = flip_check(im_path1, im_path2, args.device) File "C:\Users\WebPC-05\Style-Your-Hair\utils\kp_diff.py", line 14, in flip_check kp_extractor = face_alignment.FaceAlignment(face_alignment.LandmarksType._3D, flip_input=False, device=device) File "C:\Users\WebPC-05\AppData\Local\anaconda3\envs\testing2\lib\enum.py", line 429, in getattr raise AttributeError(name) from None AttributeError: _3D Capture

spike2233 commented 3 months ago

same error.have you solved this problem?

spike2233 commented 3 months ago

_3D ======> THREE_D

prabhasreddy-57 commented 2 months ago

did you get this error when you ran python main.py --input_dir ./ffhq_image/ --im_path1 source.png --im_path2 target.png --output_dir ./style_your_hair_output/ --warp_loss_with_prev_list delta_w style_hair_slic_large --save_all --version final --flip_check

Traceback (most recent call last): File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\utils\cpp_extension.py", line 1673, in _run_ninja_build env=env) File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\subprocess.py", line 512, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "main.py", line 12, in from models.Alignment import Alignment File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\Alignment.py", line 3, in from models.Net import Net File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\Net.py", line 3, in from models.stylegan2.model import Generator File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\stylegan2\model.py", line 11, in from models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\stylegan2\op__init.py", line 1, in from .fused_act import FusedLeakyReLU, fused_leaky_relu File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\stylegan2\op\fused_act.py", line 15, in os.path.join(module_path, "fused_bias_act_kernel.cu"), File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\utils\cpp_extension.py", line 1091, in load keep_intermediates=keep_intermediates) File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\utils\cpp_extension.py", line 1302, in _jit_compile is_standalone=is_standalone) File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\utils\cpp_extension.py", line 1407, in _write_ninja_file_and_build_library error_prefix=f"Error building extension '{name}'") File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\utils\cpp_extension.py", line 1683, in _run_ninja_build raise RuntimeError(message) from e RuntimeError: Error building extension 'fused': [1/3] C:\Users\prabhas\AppData\Local\Temp\CUDA\bin\nvcc --generate-dependencies-with-compile --dependency-output fused_bias_act_kernel.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\TH -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\THC -IC:\Users\prabhas\AppData\Local\Temp\CUDA\include -IC:\Users\prabhas\anaconda3\envs\hairstyle\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -c C:\Users\prabhas\Desktop\Style-Your-Hair\models\stylegan2\op\fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o FAILED: fused_bias_act_kernel.cuda.o C:\Users\prabhas\AppData\Local\Temp\CUDA\bin\nvcc --generate-dependencies-with-compile --dependency-output fused_bias_act_kernel.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\TH -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\THC -IC:\Users\prabhas\AppData\Local\Temp\CUDA\ininja: fatal: ReadFile: The handle is invalid.

nclude -IC:\Users\prabhas\anaconda3\envs\hairstyle\Include -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -c C:\Users\prabhas\Desktop\Style-Your-Hair\models\stylegan2\op\fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o CreateProcess failed: The system cannot find the file specified.

after installing all the libraries i am getting this error when i ran the initial command how did u solve it

RahmaButt commented 2 months ago

Hello , You can do following thing to check the cause of error First verify that your cuda and cudnn working accurately and use your gpu , you can use commands to check this Then Check Ninja Installation Then check MSVC Build Tools ( Open Visual Studio Installer and ensure "Desktop development with C++" is installed. ) If it wont work reinstall requirements.txt Thank You

On Fri, Jun 28, 2024 at 10:23 PM prabhasreddy-57 @.***> wrote:

did you get this error when you ran python main.py --input_dir ./ffhq_image/ --im_path1 source.png --im_path2 target.png --output_dir ./style_your_hair_output/ --warp_loss_with_prev_list delta_w style_hair_slic_large --save_all --version final --flip_check

Traceback (most recent call last): File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\utils\cpp_extension.py", line 1673, in _run_ninja_build env=env) File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\subprocess.py", line 512, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "main.py", line 12, in from models.Alignment import Alignment File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\Alignment.py", line 3, in from models.Net import Net File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\Net.py", line 3, in from models.stylegan2.model import Generator File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\stylegan2\model.py", line 11, in from models.stylegan2.op import FusedLeakyReLU, fused_leakyrelu, upfirdn2d File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\stylegan2\opinit_.py", line 1, in from .fused_act import FusedLeakyReLU, fused_leaky_relu File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\stylegan2\op\fused_act.py", line 15, in os.path.join(module_path, "fused_bias_act_kernel.cu"), File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\utils\cpp_extension.py", line 1091, in load keep_intermediates=keep_intermediates) File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\utils\cpp_extension.py", line 1302, in

jit_compile is_standalone=is_standalone) File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\utils\cpp_extension.py", line 1407, in write_ninja_file_and_build_library error_prefix=f"Error building extension '{name}'") File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\utils\cpp_extension.py", line 1683, in run_ninja_build raise RuntimeError(message) from e RuntimeError: Error building extension 'fused': [1/3] C:\Users\prabhas\AppData\Local\Temp\CUDA\bin\nvcc --generate-dependencies-with-compile --dependency-output fused_bias_act_kernel.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\TH -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\THC -IC:\Users\prabhas\AppData\Local\Temp\CUDA\include -IC:\Users\prabhas\anaconda3\envs\hairstyle\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -c C:\Users\prabhas\Desktop\Style-Your-Hair\models\stylegan2\op\ fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o FAILED: fused_bias_act_kernel.cuda.o C:\Users\prabhas\AppData\Local\Temp\CUDA\bin\nvcc --generate-dependencies-with-compile --dependency-output fused_bias_act_kernel.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\TH -IC:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\include\THC -IC:\Users\prabhas\AppData\Local\Temp\CUDA\ininja: fatal: ReadFile: The handle is invalid.

nclude -IC:\Users\prabhas\anaconda3\envs\hairstyle\Include -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_BFLOAT16_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -c C:\Users\prabhas\Desktop\Style-Your-Hair\models\stylegan2\op\ fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o CreateProcess failed: The system cannot find the file specified.

after installing all the libraries i am getting this error when i ran the initial command how did u solve it

— Reply to this email directly, view it on GitHub https://github.com/Taeu/Style-Your-Hair/issues/27#issuecomment-2197362218, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFVZVWZIO23EPAEG5DGQLETZJWLXZAVCNFSM6AAAAABGLIAQJGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGM3DEMRRHA . You are receiving this because you were mentioned.Message ID: @.***>

prabhasreddy-57 commented 1 month ago

RuntimeError: no valid convolution algorithms available in CuDNN(hairstyle) C:\Users\prabhas\Desktop\Style-Your-Hair>python main.py --input_dir ./ffhq_image/ --im_path1 source.png --im_path2 target.png --output_dir ./style_your_hair_output/ --warp_loss_with_prev_list delta_w style_hair_slic_large --save_all --version final --flip_check Loading StyleGAN2 from checkpoint: pretrained_models/ffhq.pt torch.Size([512]) Setting up Perceptual loss... Loading model from: C:\Users\prabhas\Desktop\Style-Your-Hair\losses\lpips\weights\v0.1\vgg.pth ...[net-lin [vgg]] initialized ...Done flip is better, kp_diff : 29.72156524658203 > kp_diff_flip : 19.58245277404785 Number of images: 2 Images: 0%| | 0/2 [00:00<?, ?it/s]source Images: 50%|█████████████████████████████████████████████████████████████▌ | 1/2 [04:48<04:48, 288.43s/it]target_flip Images: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [09:37<00:00, 288.89s/it] Number of images: 2 Images: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [02:01<00:00, 60.58s/it] Loading StyleGAN2 from checkpoint: pretrained_models/ffhq.pt torch.Size([512]) Setting up Perceptual loss... Loading model from: C:\Users\prabhas\Desktop\Style-Your-Hair\losses\lpips\weights\v0.1\vgg.pth ...[net-lin [vgg]] initialized ...Done Setting up Perceptual loss... Loading model from: C:\Users\prabhas\Desktop\Style-Your-Hair\losses\masked_lpips\weights\v0.1\vgg.pth ...[net-lin [vgg]] initialized ...Done Warp Target Step 1: 0%| | 0/100 [00:00<?, ?it/s]C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\nn\functional.py:3500: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. "The default behavior for interpolate/upsample with float scale_factor changed " Traceback (most recent call last): File "main.py", line 162, in main(args) File "main.py", line 72, in main align.align_images(im_path1, im_path2, sign=args.sign, align_more_region=False, smooth=args.smooth) File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\Alignment.py", line 290, in align_images save_intermediate=save_intermediate, is_downsampled = is_downsampled) File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\Alignment.py", line 158, in create_target_segmentation_mask im2, warped_latent_2, warped_down_seg = self.warp_target(img_path2, src_kp_hm, None, img_path1) # Warping !! File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\Alignment.py", line 566, in warp_target latent_in, warped_down_seg = self.optimize_warping(pbar, optimizer_warp_w, latent_W_optimized, latent_F_optimized, mode, is_downsampled, src_kp_hm, im_name_1, im_name_2, cur_check_dir, img_path1, img_path2) File "C:\Users\prabhas\Desktop\Style-Your-Hair\models\Alignment.py", line 782, in optimize_warping loss.backward() File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\tensor.py", line 245, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs) File "C:\Users\prabhas\anaconda3\envs\hairstyle\lib\site-packages\torch\autograd__init__.py", line 147, in backward allow_unreachable=True, accumulate_grad=True) # allow_unreachable flag RuntimeError: no valid convolution algorithms available in CuDNN