diff --git a/focoos/focoos.py b/focoos/focoos.py index cf1d1d4..7b8d68d 100644 --- a/focoos/focoos.py +++ b/focoos/focoos.py @@ -165,16 +165,10 @@ def get_dataset_by_name(self, name: str) -> Optional[DatasetMetadata]: def get_model_by_name( self, name: str, remote=True ) -> Optional[Union[RemoteModel, LocalModel]]: - found = False models = self.list_models() for model in models: if name.lower() == model.name.lower(): - found = True - break - if found: - if remote: - return self.get_remote_model(model.ref) - else: - return self.get_local_model(model.ref) - else: - return None + if remote: + return self.get_remote_model(model.ref) + else: + return self.get_local_model(model.ref)