MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / motion_token_to_string

Method motion_token_to_string

mGPT/archs/mgpt_lm.py:390–400  ·  view source on GitHub ↗
(self, motion_token: Tensor, lengths: List[int])

Source from the content-addressed store, hash-verified

388 return cleaned_text
389
390 def motion_token_to_string(self, motion_token: Tensor, lengths: List[int]):
391 motion_string = []
392 for i in range(len(motion_token)):
393 motion_i = motion_token[i].cpu(
394 ) if motion_token[i].device.type == 'cuda' else motion_token[i]
395 motion_list = motion_i.tolist()[:lengths[i]]
396 motion_string.append(
397 (f'<motion_id_{self.m_codebook_size}>' +
398 ''.join([f'<motion_id_{int(i)}>' for i in motion_list]) +
399 f'<motion_id_{self.m_codebook_size + 1}>'))
400 return motion_string
401
402 def motion_token_list_to_string(self, motion_token: Tensor):
403 motion_string = []

Callers 4

forward_encdecMethod · 0.95
forward_decMethod · 0.95
generate_conditionalMethod · 0.95
load_motionFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected