ali-vilab / dreamtalk

Official implementations for paper: DreamTalk: When Expressive Talking Head Generation Meets Diffusion Probabilistic Models
https://dreamtalk-project.github.io/
MIT License
1.62k stars 199 forks source link

failed when generating long video: `'numpy.ndarray' object has no attribute 'unsqueeze'` #23

Open yoebet opened 10 months ago

yoebet commented 10 months ago

I generated a little longer video(3 or 4 minutes), it reports 'numpy.ndarray' object has no attribute 'unsqueeze'

I spotted hear https://github.com/ali-vilab/dreamtalk/blob/main/inference_for_demo_video.py#L118

if len(pose) >= len(gen_exp):
    selected_pose = pose[: len(gen_exp)]
else:
    selected_pose = pose[-1].unsqueeze(0).repeat(len(gen_exp), 1)
    selected_pose[: len(pose)] = pose

the pose is of np type(not a torch Tensor), and the second argument ofrepeat (dimension) may be 0, so I changed as such:

selected_pose = pose[-1][np.newaxis, ...].repeat(len(gen_exp), 0)

It works.