Skip to content

Commit

Permalink
fix fallback for model
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Sordoni committed Oct 24, 2024
1 parent d37f3b5 commit fa35120
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mttl/models/library/expert.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ def model(self):
"""Returns the expert model associated with the expert. Tries to get it
from training_config if expert_model is None for back-compatibility.
"""
return self.expert_model or getattr(self.training_config, "model", None)
if self.expert_model:
return self.expert_model
elif self.training_config:
# fallback to training config
return self.training_config.get("model")

@property
def dataset(self):
"""Returns the dataset name from training config or an empty string."""
return getattr(getattr(self, "training_config", {}), "dataset", "")
return getattr(self, "training_config", {}).get("dataset", "")

@property
def modifier_name(self):
Expand Down

0 comments on commit fa35120

Please sign in to comment.