h-y1heng / StableMoFusion

MIT License
49 stars 5 forks source link

TypeError: plot_3d_motion() got an unexpected keyword argument 'label' #5

Closed fyyakaxyy closed 3 weeks ago

fyyakaxyy commented 1 month ago

Sorry to bother you again, I encountered a new problem while running:

python -m utils.scripts.train_UnderPressure_model --dataset_name t2m

The error is:

epoch: 0  step: 46  loss:0.002644855761900544
Traceback (most recent call last):
  File "stablemofusion/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "stablemofusion/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "StableMoFusion/utils/scripts/train_UnderPressure_model.py", line 149, in <module>
    plot_3d_motion(pjoin(checkpoints_dir, fname), kinematic_tree, positions, title="", fps=opt.fps,
TypeError: plot_3d_motion() got an unexpected keyword argument 'label'

and plot_3d_motion in StableMoFusion/utils/scripts/train_UnderPressure_model.py is:

plot_3d_motion(pjoin(checkpoints_dir, fname), kinematic_tree, positions, title="", fps=opt.fps,
                               radius=opt.radius, label=labels)

I check the function plot_3d_motion in StableMoFusion/utils/plot_script.py and I find there is no "label" in this function:

def plot_3d_motion(save_path, kinematic_tree, joints, title, figsize=(10, 10), fps=120, radius=4):

so I delete "label" in plot_3d_motion:

plot_3d_motion(pjoin(checkpoints_dir, fname), kinematic_tree, positions, title="", fps=opt.fps,
                               radius=opt.radius)

the new error is:

MovieWriter stderr:
[libopenh264 @ 0x5620e7c60300] Incorrect library version loaded
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Traceback (most recent call last):
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/animation.py", line 251, in saving
    yield self
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/animation.py", line 1145, in save
    writer.grab_frame(**savefig_kwargs)
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/animation.py", line 363, in grab_frame
    self.fig.savefig(self._frame_sink(), format=self.frame_format,
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/figure.py", line 2311, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 2210, in print_figure
    result = print_method(
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 1639, in wrapper
    return func(*args, **kwargs)
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/backends/backend_agg.py", line 456, in print_raw
    fh.write(renderer.buffer_rgba())
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "stablemofusion/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "stablemofusion/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "StableMoFusion/utils/scripts/train_UnderPressure_model.py", line 151, in <module>
    plot_3d_motion(pjoin(checkpoints_dir, fname), kinematic_tree, positions, title="", fps=opt.fps,
  File "StableMoFusion/utils/plot_script.py", line 114, in plot_3d_motion
    ani.save(save_path, fps=fps)
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/animation.py", line 1145, in save
    writer.grab_frame(**savefig_kwargs)
  File "stablemofusion/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/animation.py", line 253, in saving
    self.finish()
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/animation.py", line 354, in finish
    self.cleanup()
  File "stablemofusion/lib/python3.8/site-packages/matplotlib/animation.py", line 390, in cleanup
    raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1000x1000', '-pix_fmt', 'rgba', '-r', '20', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-y', 'StableMoFusion/checkpoints/footskate/00.mp4']' returned non-zero exit status 1.

How can I solve it? Thank you.

h-y1heng commented 1 month ago

The first error you mentioned TypeError: plot_3d_motion() got an unexpected keyword argument 'label' is indeed a problem that we didn't find during code cleaning. Just remove it label=labels.

And the second problem you encounter seems to be because your ffpmeg version is not suitable or is incomplete. What is your ffpmeg version?