Repository: graphnet-team/graphnet
Issue: MisconfigurationException: `Trainer(strategy='ddp')` is not compatible with an interactive environment. 

**Describe the bug**
Default distribution strategy of `Trainer` in `Model` is `ddp` which is incompatible with notebook environments. We can set the distribution strategy using configs for `Model.fit()`, but not for Model.Predict(). Therefore, fresh models that have state dicts loaded into them won't run in notebooks as they default to `ddp.`

**To Reproduce**
Steps to reproduce the behavior:
Follow steps in #403 but in notebook.

**Expected behavior**
We should have control over this argument for `Model.predict` too.

**Full traceback**
Please include the full error message to allow for debugging
```
MisconfigurationException: `Trainer(strategy='ddp')` is not compatible with an interactive environment. Run your code as a script, or choose one of the compatible strategies: `Fabric(strategy=None|'dp'|'ddp_notebook')`. In case you are spawning processes yourself, make sure to include the Trainer creation inside the worker function.
```



Changed files:
src/graphnet/models/model.py, src/graphnet/models/standard_model.py

diff --git a/src/graphnet/models/model.py b/src/graphnet/models/model.py
index 28f6531d..96909c06 100644
--- a/src/graphnet/models/model.py
+++ b/src/graphnet/models/model.py
@@ -114,6 +114,7 @@ class Model(Configurable, LightningModule, LoggerMixin, ABC):
         self,
         dataloader: DataLoader,
         gpus: Optional[Union[List[int], int]] = None,
+        distribution_strategy: Optional[str] = None,
     ) -> List[Tensor]:
         """Return predictions for `dataloader`.
 
@@ -123,7 +124,7 @@ class Model(Configurable, LightningModule, LoggerMixin, ABC):
 
         if not hasattr(self, "_inference_trainer"):
             self._construct_trainers(
-                gpus=gpus,
+                gpus=gpus, distribution_strategy=distribution_strategy
             )
         elif gpus is not None:
             self.warning(
@@ -151,6 +152,7 @@ class Model(Configurable, LightningModule, LoggerMixin, ABC):
         additional_attributes: Optional[List[str]] = None,
         index_column: str = "event_no",
         gpus: Optional[Union[List[int], int]] = None,
+        distribution_strategy: Optional[str] = None,
     ) -> pd.DataFrame:
         """Return predictions for `dataloader` as a DataFrame.
 
@@ -179,6 +181,7 @@ class Model(Configurable, LightningModule, LoggerMixin, ABC):
         predictions_torch = self.predict(
             dataloader=dataloader,
             gpus=gpus,
+            distribution_strategy=distribution_strategy,
         )
         predictions = (
             torch.cat(predictions_torch, dim=1).detach().cpu().numpy()
diff --git a/src/graphnet/models/standard_model.py b/src/graphnet/models/standard_model.py
index 8d778880..78dd994a 100644
--- a/src/graphnet/models/standard_model.py
+++ b/src/graphnet/models/standard_model.py
@@ -166,10 +166,12 @@ class StandardModel(Model):
         self,
         dataloader: DataLoader,
         gpus: Optional[Union[List[int], int]] = None,
+        distribution_strategy: Optional[str] = None,
     ) -> List[Tensor]:
         """Return predictions for `dataloader`."""
         self.inference()
         return super().predict(
             dataloader=dataloader,
             gpus=gpus,
+            distribution_strategy=distribution_strategy,
         )