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

How to optimize CPU usage by modifying test_EDTalk_A_use_exp_weight function to leverage GPU #31

Open
emboss33 opened this issue Sep 11, 2024 · 1 comment

Comments

@emboss33
Copy link

emboss33 commented Sep 11, 2024

I noticed a significant increase in CPU usage in the following part of demo_EDTalk_A_using_predefined_exp_weights.py

I suspect that the function test_EDTalk_A_use_exp_weight in generator.py is causing this spike in CPU usage. I am planning to modify this function to utilize GPU (CUDA) more efficiently in order to reduce the load on the CPU and improve the calculation speed, anyone here?

img_target_lip = self.lip_vid_target[i:i+1]
if i >= len_pose:
    img_target_pose = self.pose_vid_target[:, -1, :, :, :]
else:
    img_target_pose = self.pose_vid_target[:, i, :, :, :]

img_recon = self.gen.test_EDTalk_A_use_exp_weight(self.img_source, img_target_lip, img_target_pose, self.exp_vid_target, h_start)

vid_target_recon.append(img_recon.unsqueeze(2))
@tanshuai0219
Copy link
Owner

I noticed a significant increase in CPU usage in the following part of demo_EDTalk_A_using_predefined_exp_weights.py

I suspect that the function test_EDTalk_A_use_exp_weight in generator.py is causing this spike in CPU usage. I am planning to modify this function to utilize GPU (CUDA) more efficiently in order to reduce the load on the CPU and improve the calculation speed, anyone here?

img_target_lip = self.lip_vid_target[i:i+1]
if i >= len_pose:
    img_target_pose = self.pose_vid_target[:, -1, :, :, :]
else:
    img_target_pose = self.pose_vid_target[:, i, :, :, :]

img_recon = self.gen.test_EDTalk_A_use_exp_weight(self.img_source, img_target_lip, img_target_pose, self.exp_vid_target, h_start)

vid_target_recon.append(img_recon.unsqueeze(2))

I have checked the codes, and the current models and function calculation are on GPU. I think only loading data depends on CPU.

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

2 participants