(motion_token, lengths, codebook_size=512)
| 17 | |
| 18 | |
| 19 | def 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 | |
| 32 | def load_example_input(txt_path, task, model): |
no outgoing calls
no test coverage detected