MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / save_motion_dict

Method save_motion_dict

trainer/base_trainer.py:290–304  ·  view source on GitHub ↗
(self, motion_dict, mean, std, device='cuda:0', vis=True, result_folder=None)

Source from the content-addressed store, hash-verified

288 optimizer, ckpt_dir, dcp, lora)
289
290 def save_motion_dict(self, motion_dict, mean, std, device='cuda:0', vis=True, result_folder=None):
291 if result_folder is None:
292 result_folder = self.vis_dir
293 for file_name, motion in motion_dict.items():
294 motion = motion * std + mean
295 motion_save_path = os.path.join(result_folder, file_name)
296 motion_save_folder = os.path.dirname(motion_save_path)
297 os.makedirs(motion_save_folder, exist_ok=True)
298 torch.save(motion[0].cpu(), motion_save_path)
299 motion_dim = motion.shape[-1]
300 if vis:
301 if motion_dim == 276:
302 motion_vis(motion_save_path, motion_save_folder, H=384, W=384, batch_size=24, fps=20, device=device, recover_from_velocity=True)
303 else:
304 self.logger.info(f'unsupported motion dimension {motion_dim}')
305
306 def save_txt_dict(self, txt_dict, result_folder=None):
307 if result_folder is None:

Callers 1

mainFunction · 0.95

Calls 1

motion_visFunction · 0.90

Tested by

no test coverage detected