Run a single forward pass with the correct calling convention.
(model: nn.Module, inputs: Dict[str, Any])
| 514 | |
| 515 | |
| 516 | def _run_forward(model: nn.Module, inputs: Dict[str, Any]) -> None: |
| 517 | """Run a single forward pass with the correct calling convention.""" |
| 518 | if "input_ids" in inputs: |
| 519 | model(input_ids=inputs["input_ids"]) |
| 520 | elif "x" in inputs: |
| 521 | try: |
| 522 | model(inputs["x"]) |
| 523 | except TypeError: |
| 524 | model(**inputs) |
| 525 | else: |
| 526 | model(**inputs) |
| 527 | |
| 528 | |
| 529 | def profile_model( |