-
Hey everyone, loss_store = store(group="criterion")
loss_store(InversionLoss, name="inversion")
loss_store(TripletLoss, name="triplet")
loss_store(CosineSimilarityLoss, name="cosine") which works great so far. class CombinedLoss(Loss):
def __init__(self, losses: list[Loss], weights: list[float]):
super().__init__()
self.losses = losses
self.weights = weights Now I am running into troubles, as I don't know how to configure the list of losses. def build_loss_temp() -> Loss:
return CombinedLoss(
losses=[InversionLoss(), CosineSimilarityLoss()],
weights=[0.7, 0.3],
)
# and then saving it
loss_store(build_loss_temp, name="combined") Though this is tideous and would make it harder to programatically create configs. Ideally I'm aiming for something like this: loss_store(builds(CombinedLoss, weights=[0.7, 0.3], hydra_defaults=["_self_", {"losses": ["inversion", "cosine"]}]), name="combined") Is this possible? Thanks in advance :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hydra does not treat lists very nicely -- it is hard to overwrite specific elements in lists. I think your |
Beta Was this translation helpful? Give feedback.
Hydra does not treat lists very nicely -- it is hard to overwrite specific elements in lists. I think your
build_loss_temp
is the most straightforward approach for now. The alternative, more general approach, will require a lot more work on your end and a lot of explanation on my end. And I need to see if there is possibly a way for me to simplify things for you before you go down that path.