ali-vilab / UniAnimate

Code for Paper "UniAnimate: Taming Unified Video Diffusion Models for Consistent Human Image Animation".
https://unianimate.github.io/
524 stars 29 forks source link

local variable 'vit_frame' referenced before assignment #9

Open jkla139 opened 2 weeks ago

jkla139 commented 2 weeks ago

运行命令出错了:

python inference.py --cfg configs/my_infer.yaml

Traceback (most recent call last):
  File "/root/UniAnimate/utils/registry.py", line 67, in build_from_config
    return req_type_entry(**cfg)
  File "/root/UniAnimate/tools/inferences/inference_unianimate_entrance.py", line 77, in inference_unianimate_entrance
    worker(0, cfg, cfg_update)
  File "/root/UniAnimate/tools/inferences/inference_unianimate_entrance.py", line 296, in worker
    vit_frame, video_data, misc_data, dwpose_data, random_ref_frame_data, random_ref_dwpose_data = load_video_frames(ref_image_key, pose_seq_key, train_trans, vit_transforms, train_trans_pose, max_frames=cfg.max_frames, frame_interval =cfg.frame_interval, resolution=cfg.resolution)
  File "/root/UniAnimate/tools/inferences/inference_unianimate_entrance.py", line 183, in load_video_frames
    return vit_frame, video_data, misc_data, dwpose_data, random_ref_frame_data, random_ref_dwpose_data
UnboundLocalError: local variable 'vit_frame' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/UniAnimate/inference.py", line 18, in <module>
    INFER_ENGINE.build(dict(type=cfg_update.TASK_TYPE), cfg_update=cfg_update.cfg_dict)
  File "/root/UniAnimate/utils/registry.py", line 107, in build
    return self.build_func(*args, **kwargs, registry=self)
  File "/root/UniAnimate/utils/registry_class.py", line 7, in build_func
    return build_from_config(cfg, registry, **kwargs)
  File "/root/UniAnimate/utils/registry.py", line 69, in build_from_config
    raise Exception(f"Failed to invoke function {req_type_entry}, with {e}")
Exception: Failed to invoke function <function inference_unianimate_entrance at 0x7fc124526cb0>, with local variable 'vit_frame' referenced before assignment
wangxiang1230 commented 2 weeks ago

Hi, it seems that your frame_list is empty, and have_frames is False.

https://github.com/ali-vilab/UniAnimate/blob/87ead02104eba769f9593f14f432d95acf3a292e/tools/inferences/inference_unianimate_entrance.py#L154-L156

jkla139 commented 2 weeks ago

Hi, it seems that your frame_list is empty, and have_frames is False.

https://github.com/ali-vilab/UniAnimate/blob/87ead02104eba769f9593f14f432d95acf3a292e/tools/inferences/inference_unianimate_entrance.py#L154-L156

I know what's the problem. My video is too short. video_frame_count < frame_interval * max_frames

githubnameoo commented 1 week ago

I also encountered this error when using the sample video and code. How can I solve it?

wangxiang1230 commented 1 week ago

I also encountered this error when using the sample video and code. How can I solve it?

It seems that video_frame_count < frame_interval * max_frames. So you can reduce frame_interval to 1 or max_frame to other small values such as 16. Additionally, you can use a longer source video.

githubnameoo commented 1 week ago

Hi, if I want to deploy and run the application, are there any requirements for graphics cards and hardware devices? For example, what model and brand?

wangxiang1230 commented 1 week ago

Hi, if I want to deploy and run the application, are there any requirements for graphics cards and hardware devices? For example, what model and brand?

Hi, we recommend a graphics card >= 12G gpu memory to run our code.