Dai-Wenxun / MotionLCM

[ ECCV 2024 ] MotionLCM: This repo is the official implementation of "MotionLCM: Real-time Controllable Motion Generation via Latent Consistency Model"
Other
222 stars 7 forks source link

ValueError: unknown file extension: .mp4 #4

Closed Zeyi-Lin closed 5 months ago

Zeyi-Lin commented 5 months ago

When I execute the 'python demo.py --cfg configs/motionlcm_t2m.yaml --example assets/example.txt' command, I get an error:

(motionlcm) linzeyi@trainer1:~/MotionLCM$ python demo.py --cfg configs/motionlcm_t2m.yaml --example assets/example.txt
05/01/2024 17:26:53 - INFO - __main__ - Loading checkpoints from experiments_t2m/motionlcm_humanml/motionlcm_humanml.ckpt
05/01/2024 17:26:53 - INFO - __main__ - Is LCM: True
05/01/2024 17:26:53 - INFO - __main__ - Is Controlnet: False
05/01/2024 17:26:54 - INFO - sentence_transformers.SentenceTransformer - Load pretrained SentenceTransformer: ./deps/sentence-t5-large
05/01/2024 17:26:57 - INFO - sentence_transformers.SentenceTransformer - Use pytorch device: cuda
05/01/2024 17:26:57 - INFO - mld.models.modeltype.mld - VAE Encoder: 7.634M
05/01/2024 17:26:57 - INFO - mld.models.modeltype.mld - VAE Decoder: 10.007M
05/01/2024 17:26:57 - INFO - mld.models.modeltype.mld - Denoiser: 8.418M
05/01/2024 17:27:03 - INFO - __main__ - 196: the man walks in a counterclockwise circle.
05/01/2024 17:27:03 - INFO - __main__ - 100: a person walks backward slowly.
05/01/2024 17:27:03 - INFO - __main__ - 56: a person does a jump.
1it [00:00, 127.26it/s]
05/01/2024 17:27:05 - INFO - __main__ - Motions are generated here:
./experiments_t2m_test/motionlcm_humanml/demo_2024-05-01T17-26-53/samples/batch_id_0_sample_id_0_length_196_rep_0.pkl
05/01/2024 17:27:05 - WARNING - matplotlib.animation - MovieWriter ffmpeg unavailable; using Pillow instead.
05/01/2024 17:27:05 - INFO - matplotlib.animation - Animation.save using <class 'matplotlib.animation.PillowWriter'>
Traceback (most recent call last):
  File "/home/linzeyi/anaconda3/envs/motionlcm/lib/python3.10/site-packages/PIL/Image.py", line 2436, in save
    format = EXTENSION[ext]
KeyError: '.mp4'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/linzeyi/MotionLCM/demo.py", line 154, in <module>
    main()
  File "/home/linzeyi/MotionLCM/demo.py", line 106, in main
    plot_3d_motion(pkl_path.replace('.pkl', '.mp4'), joints[i].detach().cpu().numpy(), text[i], fps=20)
  File "/home/linzeyi/MotionLCM/mld/data/humanml/utils/plot_script.py", line 97, in plot_3d_motion
    ani.save(save_path, fps=fps)
  File "/home/linzeyi/anaconda3/envs/motionlcm/lib/python3.10/site-packages/matplotlib/animation.py", line 1139, in save
    with mpl.rc_context({'savefig.bbox': None}), \
  File "/home/linzeyi/anaconda3/envs/motionlcm/lib/python3.10/contextlib.py", line 142, in __exit__
    next(self.gen)
  File "/home/linzeyi/anaconda3/envs/motionlcm/lib/python3.10/site-packages/matplotlib/animation.py", line 253, in saving
    self.finish()
  File "/home/linzeyi/anaconda3/envs/motionlcm/lib/python3.10/site-packages/matplotlib/animation.py", line 554, in finish
    self._frames[0].save(
  File "/home/linzeyi/anaconda3/envs/motionlcm/lib/python3.10/site-packages/PIL/Image.py", line 2439, in save
    raise ValueError(msg) from e
ValueError: unknown file extension: .mp4

My Environment:Linux, No display.

Dai-Wenxun commented 5 months ago

Fixed in https://github.com/Dai-Wenxun/MotionLCM/commit/ed4fa0e9b6fe1f301486c0c76d52d59fb482d3d5. I added the installation tutorial of FFmpeg.