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

Function motion_token_to_string

demo.py:19–29  ·  view source on GitHub ↗
(motion_token, lengths, codebook_size=512)

Source from the content-addressed store, hash-verified

17
18
19def motion_token_to_string(motion_token, lengths, codebook_size=512):
20 motion_string = []
21 for i in range(motion_token.shape[0]):
22 motion_i = motion_token[i].cpu(
23 ) if motion_token.device.type == 'cuda' else motion_token[i]
24 motion_list = motion_i.tolist()[:lengths[i]]
25 motion_string.append(
26 (f'<motion_id_{codebook_size}>' +
27 ''.join([f'<motion_id_{int(i)}>' for i in motion_list]) +
28 f'<motion_id_{codebook_size + 1}>'))
29 return motion_string
30
31
32def load_example_input(txt_path, task, model):

Callers 1

load_example_inputFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected