Attempt a forward pass. Returns True on success.
(
model: nn.Module,
inputs: Dict[str, Any],
)
| 360 | |
| 361 | |
| 362 | def _try_forward( |
| 363 | model: nn.Module, |
| 364 | inputs: Dict[str, Any], |
| 365 | ) -> bool: |
| 366 | """Attempt a forward pass. Returns True on success.""" |
| 367 | try: |
| 368 | if "input_ids" in inputs: |
| 369 | model(input_ids=inputs["input_ids"]) |
| 370 | elif "x" in inputs: |
| 371 | model(inputs["x"]) |
| 372 | else: |
| 373 | model(**inputs) |
| 374 | return True |
| 375 | except Exception: |
| 376 | return False |
| 377 | |
| 378 | |
| 379 | def _prepare_model_and_input( |
no outgoing calls
no test coverage detected