Ejemplo n.º 1
0
def test_ort_callback_fails_no_model(tmpdir):
    model = BoringModel()
    trainer = Trainer(default_root_dir=tmpdir,
                      fast_dev_run=True,
                      callbacks=ORTCallback())
    with pytest.raises(MisconfigurationException,
                       match="Torch ORT requires to wrap a single model"):
        trainer.fit(
            model,
            train_dataloader=torch.utils.data.DataLoader(DummyDataset()),
            val_dataloaders=torch.utils.data.DataLoader(DummyDataset()),
        )
Ejemplo n.º 2
0
 def configure_callbacks(self) -> List[Callback]:
     callbacks = super().configure_callbacks() or []
     if self.enable_ort:
         callbacks.append(ORTCallback())
     return callbacks