Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colab notebook throwing error while running inference.py #48

Open
Dheeraj791 opened this issue Jun 7, 2023 · 23 comments
Open

Colab notebook throwing error while running inference.py #48

Dheeraj791 opened this issue Jun 7, 2023 · 23 comments

Comments

@Dheeraj791
Copy link

Traceback (most recent call last):
File "/content/video-retalking/inference.py", line 342, in
main()
File "/content/video-retalking/inference.py", line 78, in main
kp_extractor = KeypointExtractor()
File "/content/video-retalking/third_part/face3d/extract_kp_videos.py", line 16, in init
self.detector = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D)
File "/usr/lib/python3.10/enum.py", line 437, in getattr
raise AttributeError(name) from None
AttributeError: _2D

@sauces88
Copy link

sauces88 commented Jun 7, 2023

+1

1 similar comment
@OceanTan
Copy link

OceanTan commented Jun 8, 2023

+1

@OceanTan
Copy link

OceanTan commented Jun 8, 2023

有解决方案吗?

@OceanTan
Copy link

OceanTan commented Jun 8, 2023

有解决方案吗?

path:./third_paet/face3d/extract_kp_videos.py
第16行将face_alignment.LandmarksType._2D改为face_alignment.LandmarksType.TWO_D试试

@sauces88
Copy link

sauces88 commented Jun 8, 2023 via email

@OceanTan
Copy link

OceanTan commented Jun 8, 2023

我将

我将他改为TWO_D后又出现新的错误,我打算也重新配置下环境。可以给一份你anaconda环境中的requirements.txt吗?

@foxyear-kyumin
Copy link

+1
原来都是正常的,新加其他视频后就出这样的问题?有解决办法吗?

@OceanTan
Copy link

OceanTan commented Jun 9, 2023

解决了吗?

@sauces88
Copy link

sauces88 commented Jun 9, 2023

我将

我将他改为TWO_D后又出现新的错误,我打算也重新配置下环境。可以给一份你anaconda环境中的requirements.txt吗?

basicsr==1.4.2
kornia==0.5.1
face-alignment==1.3.5
ninja==1.10.2.3
einops==0.4.1
facexlib==0.2.5
librosa==0.9.2
dlib==19.24.0
gradio>=3.7.0
opencv-contrib-python
opencv-python
scikit-image
numpy==1.23.1

@OceanTan
Copy link

OceanTan commented Jun 9, 2023

好的,谢谢!我再去试试。我尝试过anaconda重新安装环境,也试过降低numpy版本一致不行。

@crankyz
Copy link

crankyz commented Jun 9, 2023

Same issue, that something wrong with new version of some package, bc initial one worked fine.

@OceanTan
Copy link

OceanTan commented Jun 9, 2023

I started locally and tried to reinstall the environment. Finally, running the project with colad is the same problem. Do you have a solution on your end?

@crankyz
Copy link

crankyz commented Jun 9, 2023

Ok, my China friends. The problem been bc AdrianBulat change a model in facealignment so we need to change code in a proj ect. The solution is to change a line 16 to self.detector = face_alignment.FaceAlignment(face_alignment.LandmarksType.TWO_D) in /content/video-retalking/third_part/face3d/extract_kp_videos.py from LandmarksType._2D . Then same in line 152 in utils\alignment_stit.py .Have a nice day everyone.

@Shadhil24
Copy link

Shadhil24 commented Jun 9, 2023

Ok, my China friends. The problem been bc AdrianBulat change a model in facealignment so we need to change code in a proj ect. The solution is to change a line 16 to self.detector = face_alignment.FaceAlignment(face_alignment.LandmarksType.TWO_D) in /content/video-retalking/third_part/face3d/extract_kp_videos.py from LandmarksType._2D . Then same in line 152 in utils\alignment_stit.py .Have a nice day everyone.

This was helpful, thank you

@OceanTan
Copy link

OceanTan commented Jun 9, 2023

Ok, my China friends. The problem been bc AdrianBulat change a model in facealignment so we need to change code in a proj ect. The solution is to change a line 16 to in /content/video-retalking/third_part/face3d/extract_kp_videos.py from LandmarksType._2D . Then same in line 152 in utils\alignment_stit.py .Have a nice day everyone.self.detector = face_alignment.FaceAlignment(face_alignment.LandmarksType.TWO_D)
I now have a new error with the following message

`
PS E:\video-retalking> python inference.py --face examples/face/1.mp4 --audio examples/audio/1.wav --outfile results/1_1.mp4
[Info] Using cuda for inference.
Downloading: "https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth" to C:\Users\admin.conda\envs\video_retalking\lib\site-packages\facexlib\weights\detection_Resnet50_Final.pth

100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 104M/104M [02:59<00:00, 611kB/s]
Downloading: "https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth" to C:\Users\admin.conda\envs\video_retalking\lib\site-packages\facexlib\weights\parsing_parsenet.pth

100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 81.4M/81.4M [01:29<00:00, 952kB/s]
[Step 0] Number of frames available for inference: 135
[Step 1] Landmarks Extraction in Video.
landmark Det:: 1%|▉ | 1/135 [00:05<11:37, 5.20s/it]nvrtc: error: invalid value for --gpu-architecture (-arch)

nvrtc compilation failed:

#define NAN __int_as_float(0x7fffffff)
#define POS_INFINITY __int_as_float(0x7f800000)
#define NEG_INFINITY __int_as_float(0xff800000)

template
device T maximum(T a, T b) {
}

template
device T minimum(T a, T b) {
return isnan(a) ? a : (a < b ? a : b);
}

extern "C" global
void fused_cat_cat(float* tinput0_42, float* tinput0_46, float* tout3_67, float* tinput0_60, float* tinput0_52, float* tout3_71, float* aten_cat, float* aten_cat_1) {
{
if (blockIdx.x<512 ? 1 : 0) {
__ldg(tinput0_60 + (512 * blockIdx.x + threadIdx.x) % 262144) : __ldg(tinput0_52 + (512 * blockIdx.x + threadIdx.x) % 262144 - 131072)) : __ldg(tout3_71 + (512 * blockIdx.x + threadIdx.x) % 262144 - 196608));
}
aten_cat[512 * blockIdx.x + threadIdx.x] = ((((512 * blockIdx.x + threadIdx.x) / 4096) % 256<192 ? 1 : 0) ? ((((512 * blockIdx.x + threadIdx.x) / 4096) % 256<128 ? 1 : 0) ? __ldg(tinput0_42 + (512 * blockIdx.x + threadIdx.x) % 1048576) : __ldg(tinput0_46 + (512 * blockIdx.x + threadIdx.x) % 1048576 - 524288)) : __ldg(tout3_67 + (512 * blockIdx.x + threadIdx.x) % 1048576 - 786432));
}
}

landmark Det:: 1%|▉ | 1/135 [00:05<11:55, 5.34s/it]
Traceback (most recent call last):
File "inference.py", line 342, in
main()
File "inference.py", line 79, in main
lm = kp_extractor.extract_keypoint(frames_pil, './temp/'+base_name+'_landmarks.txt')
File "E:\video-retalking\third_part\face3d\extract_kp_videos.py", line 27, in extract_keypoint
current_kp = self.extract_keypoint(image)
File "E:\video-retalking\third_part\face3d\extract_kp_videos.py", line 55, in extract_keypoint
return keypoints
UnboundLocalError: local variable 'keypoints' referenced before assignment
`
I downgraded numpy to 1.23.1 according to their method, but it still doesn't work. Do you have this problem?

@crankyz
Copy link

crankyz commented Jun 9, 2023

No, I dont. That looks lile u have a problem with driver or cuda instalation. Try to update cuda vs cudnn. Whats your video card? Also I have installed torch through "conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch". Now its actually another issue for you than topic starter.

@OceanTan
Copy link

OceanTan commented Jun 9, 2023

No, I dont. That looks lile u have a problem with driver or cuda instalation. Try to update cuda vs cudnn. Whats your video card? Also I have installed torch through "conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch". Now its actually another issue for you than topic starter.

My graphics card is NVIDIA Geforce RTX 4090 and the CUDA version is 12.1. Because torch was slow to download in China, conda downloads often failed. So I used the pip image to download. My current torch version is 1.9.1+cu111 and torchvision version is 0.10.1+cu111

@crankyz
Copy link

crankyz commented Jun 9, 2023

U need at least CUDA 11.7 torch version. That current that u installed dosent support your awesome card/

@OceanTan
Copy link

OceanTan commented Jun 9, 2023

您至少需要 CUDA 11.7 火炬版本。你安装的电流支持你的真棒卡/

Thank you very much! I'll try again. I think the high version of cuda is compatible with the low version of pytorch. Just beginning to contact this knowledge! Thank you very much for your explanation!

@OceanTan
Copy link

OceanTan commented Jun 9, 2023

您至少需要 CUDA 11.7 火炬版本。你安装的电流支持你的真棒卡/

Thanks, according to your hint. My project also ran successfully!! This is so cool!!

@kunncheng
Copy link
Collaborator

Hi guys, this is casued by the update of face-alignment, as discussed in 1adrianb/face-alignment#341.

I changed the version of face-alignment from 1.3.5 to 1.3.4 in the requirements.txt.
The colab notebook should now work fine.

edhyah added a commit to edhyah/metrical-tracker that referenced this issue Jun 19, 2023
`AttributeError: _2D`. Based on an online GitHub thread that I found,
there was a model change in the face-alignment package that causes this.
This commit resolves this issue. This bug fix was tested on the default
face-alignment pip package version face-alignment==1.3.5. The link to
the GitHub thread is below:

OpenTalker/video-retalking#48 (comment)
@zgu123
Copy link

zgu123 commented Aug 15, 2023

Ok, my China friends. The problem been bc AdrianBulat change a model in facealignment so we need to change code in a proj ect. The solution is to change a line 16 to self.detector = face_alignment.FaceAlignment(face_alignment.LandmarksType.TWO_D) in /content/video-retalking/third_part/face3d/extract_kp_videos.py from LandmarksType._2D . Then same in line 152 in utils\alignment_stit.py .Have a nice day everyone.

it fixes my problem. You are my hero buddy

@ykhasia
Copy link

ykhasia commented Oct 29, 2023

Ok, my China friends. The problem been bc AdrianBulat change a model in facealignment so we need to change code in a proj ect. The solution is to change a line 16 to self.detector = face_alignment.FaceAlignment(face_alignment.LandmarksType.TWO_D) in /content/video-retalking/third_part/face3d/extract_kp_videos.py from LandmarksType._2D . Then same in line 152 in utils\alignment_stit.py .Have a nice day everyone.

much appreciate!! this is the solution. thank you .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants