(self,
texts: Optional[List[str]] = None,
motion_tokens: Optional[Tensor] = None,
lengths: Optional[List[int]] = None,
task: str = "t2m",
with_len: bool = False,
stage: str = 'train',
tasks: dict = None)
| 283 | return outputs_tokens, cleaned_text |
| 284 | |
| 285 | def generate_conditional(self, |
| 286 | texts: Optional[List[str]] = None, |
| 287 | motion_tokens: Optional[Tensor] = None, |
| 288 | lengths: Optional[List[int]] = None, |
| 289 | task: str = "t2m", |
| 290 | with_len: bool = False, |
| 291 | stage: str = 'train', |
| 292 | tasks: dict = None): |
| 293 | |
| 294 | self.device = self.language_model.device |
| 295 | |
| 296 | if task in ["t2m", "m2m", "pred", "inbetween"]: |
| 297 | |
| 298 | if task == "t2m": |
| 299 | assert texts is not None |
| 300 | motion_strings = [''] * len(texts) |
| 301 | if not with_len: |
| 302 | if tasks is None: |
| 303 | tasks = [{ |
| 304 | 'input': |
| 305 | ['Generate motion: <Caption_Placeholder>'], |
| 306 | 'output': [''] |
| 307 | }] * len(texts) |
| 308 | |
| 309 | lengths = [0] * len(texts) |
| 310 | else: |
| 311 | tasks = [{ |
| 312 | 'input': [ |
| 313 | 'Generate motion with <Frame_Placeholder> frames: <Caption_Placeholder>' |
| 314 | ], |
| 315 | 'output': [''] |
| 316 | }] * len(texts) |
| 317 | |
| 318 | elif task == "pred": |
| 319 | assert motion_tokens is not None and lengths is not None |
| 320 | texts = [''] * len(lengths) |
| 321 | tasks = [{ |
| 322 | 'input': ['Predict motion: <Motion_Placeholder_s1>'], |
| 323 | 'output': [''] |
| 324 | }] * len(lengths) |
| 325 | |
| 326 | motion_strings_old = self.motion_token_to_string( |
| 327 | motion_tokens, lengths) |
| 328 | motion_strings = [] |
| 329 | for i, length in enumerate(lengths): |
| 330 | split = length // 5 |
| 331 | motion_strings.append( |
| 332 | '>'.join(motion_strings_old[i].split('>')[:split]) + |
| 333 | '>') |
| 334 | |
| 335 | elif task == "inbetween": |
| 336 | assert motion_tokens is not None and lengths is not None |
| 337 | texts = [''] * len(lengths) |
| 338 | tasks = [{ |
| 339 | 'input': [ |
| 340 | "Complete the masked motion: <Motion_Placeholder_Masked>" |
| 341 | ], |
| 342 | 'output': [''] |
no test coverage detected