avatarify-python icon indicating copy to clipboard operation
avatarify-python copied to clipboard

run_windows.bat raises a RuntimeError

Open AlbyIanna opened this issue 6 years ago • 19 comments

I'm trying to run avatarify on Windows 10, I'm pretty sure to have installed everything correctly, but every time I try to run run_windows.bat I get this error:

Traceback (most recent call last):
    File "cam_fomm.py", line 219, in <module>
        fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=True, device=device)
    File "C:\Users\Alberto\miniconda3\envs\avatarify\lib\site-packages\face_alignment\api.py", line 78, in __init__
        fan_weights = load_url(models_urls[network_name], map_location=lambda storage, loc: storage)
    File "C:\Users\Alberto\miniconda3\envs\avatarify\lib\site-packages\torch\hub.py", line 506, in load_state_dict_from_url
        return torch.load(cached_file, map_location=map_location)
    File "C:\Users\Alberto\miniconda3\envs\avatarify\lib\site-packages\torch\serialization.py", line 529, in load
        return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
    File "C:\Users\Alberto\miniconda3\envs\avatarify\lib\site-packages\torch\serialization.py", line 709, in _legacy_load
        deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
RuntimeError: unexpected EOF, expected 640133 more bytes. The file might be corrupted.

Any idea?

AlbyIanna avatar Apr 19 '20 01:04 AlbyIanna

I can't comment on your specific error, but I just setup on Windows 10 and I don't see the same error. Perhaps try clone the repo again?

Output from the script on my machine:

(avatarify) c:\GIT_Repos\avatarify>run_windows.bat

(avatarify) c:\GIT_Repos\avatarify>REM Web-camera device id

(avatarify) c:\GIT_Repos\avatarify>set CAMID=0

(avatarify) c:\GIT_Repos\avatarify>REM ################################################

(avatarify) c:\GIT_Repos\avatarify>REM Normally you don't want to change settings below

(avatarify) c:\GIT_Repos\avatarify>REM Conda environment name

(avatarify) c:\GIT_Repos\avatarify>set CONDA_ENV_NAME=avatarify

(avatarify) c:\GIT_Repos\avatarify>REM @set /P CAMID="Pick the webcam id you want to use (typically "0"): " 0: ./avatars\einstein.jpg 1: ./avatars\eminem.jpg 2: ./avatars\jobs.jpg 3: ./avatars\mona.jpg 4: ./avatars\obama.jpg 5: ./avatars\potter.jpg 6: ./avatars\ronaldo.png 7: ./avatars\schwarzenegger.png load checkpoints.. cam_fomm.py:35: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config = yaml.load(f) Downloading: "https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth" to C:\Users\stuart/.cache\torch\checkpoints\s3fd-619a316812.pth 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 85.7M/85.7M [00:37<00:00, 2.39MB/s] Downloading: "https://www.adrianbulat.com/downloads/python-fan/2DFAN4-11f355bf06.pth.tar" to C:\Users\stuart/.cache\torch\checkpoints\2DFAN4-11f355bf06.pth.tar 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 91.2M/91.2M [00:36<00:00, 2.63MB/s] Traceback (most recent call last): File "cam_fomm.py", line 238, in change_avatar(fa, avatars[cur_ava]) File "cam_fomm.py", line 163, in change_avatar avatar_kp = get_frame_kp(fa, new_avatar) File "cam_fomm.py", line 65, in get_frame_kp kp_landmarks = fa.get_landmarks(255 * image) File "C:\Users\stuart\miniconda3\envs\avatarify\lib\site-packages\face_alignment\api.py", line 107, in get_landmarks return self.get_landmarks_from_image(image_or_path, detected_faces) File "C:\Users\stuart\miniconda3\envs\avatarify\lib\site-packages\torch\autograd\grad_mode.py", line 49, in decorate_no_grad return func(*args, **kwargs) File "C:\Users\stuart\miniconda3\envs\avatarify\lib\site-packages\face_alignment\api.py", line 140, in get_landmarks_from_image detected_faces = self.face_detector.detect_from_image(image[..., ::-1].copy()) File "C:\Users\stuart\miniconda3\envs\avatarify\lib\site-packages\face_alignment\detection\sfd\sfd_detector.py", line 34, in detect_from_image bboxlist = detect(self.face_detector, image, device=self.device) File "C:\Users\stuart\miniconda3\envs\avatarify\lib\site-packages\face_alignment\detection\sfd\detect.py", line 30, in detect olist = net(img) File "C:\Users\stuart\miniconda3\envs\avatarify\lib\site-packages\torch\nn\modules\module.py", line 532, in call result = self.forward(*input, **kwargs) File "C:\Users\stuart\miniconda3\envs\avatarify\lib\site-packages\face_alignment\detection\sfd\net_s3fd.py", line 71, in forward h = F.relu(self.conv1_1(x)) File "C:\Users\stuart\miniconda3\envs\avatarify\lib\site-packages\torch\nn\functional.py", line 914, in relu result = torch.relu(input) RuntimeError: CUDA error: no kernel image is available for execution on the device

(avatarify) c:\GIT_Repos\avatarify>

virtualmonster avatar Apr 19 '20 09:04 virtualmonster

I tried reinstalling everything, but I get the same exact error

AlbyIanna avatar Apr 19 '20 11:04 AlbyIanna

@AlbyIanna did you interrupt downloading files at the first run_windows.bat call?

alievk avatar Apr 19 '20 11:04 alievk

@virtualmonster Looks like you have an unsupported GPU. GTX somethng I guess?

alievk avatar Apr 19 '20 11:04 alievk

@alievk yes, its a GTX Titan... it supports CUDA but from what I read in the specs, it supported CUDA 3.5 at release. I installed CUDA 10.x and there were no errors

virtualmonster avatar Apr 19 '20 11:04 virtualmonster

@virtualmonster could you explain in more detail how you fixed the problem?

alievk avatar Apr 19 '20 12:04 alievk

I have a GTX 860M

AlbyIanna avatar Apr 19 '20 12:04 AlbyIanna

@AlbyIanna did you interrupt downloading files at the first run_windows.bat call?

@alievk I think so, but I'm not 100% sure. How do I check if everthing has been installed correctly?

AlbyIanna avatar Apr 19 '20 12:04 AlbyIanna

Okay, I solved it. I found out that torch/serialization.py was trying to access three tar files at 'C:\\Users\\[my_username]/.cache\\torch\\checkpoints\\, but after opening my .cache folder in my home, one of them was missing. So I deleted the checkpoints folder, then I re-ran run_windows.bat and it worked perfectly. Thanks!

AlbyIanna avatar Apr 19 '20 16:04 AlbyIanna

I had a CUDA pop-up error window when running, but strangely it then started fine anyway.

E3V3A avatar Apr 20 '20 22:04 E3V3A

@alievk yes, its a GTX Titan... it supports CUDA but from what I read in the specs, it supported CUDA 3.5 at release. I installed CUDA 10.x and there were no errors

I had quite same problem and I was suggeted to install pytorch from source. However I still doesnt work correctly.

YosAwed avatar Apr 21 '20 05:04 YosAwed

问题截图 run_windows.bat

18845045369 avatar May 02 '20 05:05 18845045369

Problem complement:This is what I sent to my friend after the successful run, and this is the problem with his run

18845045369 avatar May 02 '20 05:05 18845045369

As it look (and said before) you have some kind of connection issue. Bad firewall or unstable internet connection.

E3V3A avatar May 02 '20 14:05 E3V3A

无标题 This is my run_windows.bat And nothing happened after that. What should I do?

GTX1660Ti

2tenthree avatar May 27 '20 14:05 2tenthree

Closing issue since OP's problem is solved. Please open a separate issue is anything else mentioned in this conversation (better handling of network errors?) should be considered a bug in Avatarify.

JohanAR avatar Jan 13 '21 08:01 JohanAR

Okay, I solved it. I found out that torch/serialization.py was trying to access three tar files at 'C:\\Users\\[my_username]/.cache\\torch\\checkpoints\\, but after opening my .cache folder in my home, one of them was missing. So I deleted the checkpoints folder, then I re-ran run_windows.bat and it worked perfectly. Thanks!

Please i'm going through same thing.. can you assist me how you got yours done so i get mine done ?

Papimalay avatar Aug 04 '23 21:08 Papimalay

I don’t have your WhatsApp can you share with me ?

On Sat, 5 Aug 2023 at 1:27 PM, SanPatrick01 @.***> wrote:

Snap your problem to my WhatsApp please

— Reply to this email directly, view it on GitHub https://github.com/alievk/avatarify-python/issues/65#issuecomment-1666396868, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBXGZ6FLOBHGMNCN36NEJ4TXTXKUFANCNFSM4MLSRG7Q . You are receiving this because you commented.Message ID: @.***>

Papimalay avatar Aug 05 '23 08:08 Papimalay

My WhatsApp number +60166227040, pls anyone can help me sort it out

On Sat, 5 Aug 2023 at 4:05 PM, Papi @.***> wrote:

I don’t have your WhatsApp can you share with me ?

On Sat, 5 Aug 2023 at 1:27 PM, SanPatrick01 @.***> wrote:

Snap your problem to my WhatsApp please

— Reply to this email directly, view it on GitHub https://github.com/alievk/avatarify-python/issues/65#issuecomment-1666396868, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBXGZ6FLOBHGMNCN36NEJ4TXTXKUFANCNFSM4MLSRG7Q . You are receiving this because you commented.Message ID: @.***>

Papimalay avatar Aug 05 '23 08:08 Papimalay