Skip to content

Commit

Permalink
Feed a copy of model config in RHO-LOSS Twin Model (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
XianzheMa authored Jul 11, 2024
1 parent 55dae26 commit 3fb42ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modyn/models/rho_loss_twin_model/rho_loss_twin_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Any, Optional

import torch
import copy
from modyn.utils import dynamic_module_import
from torch import nn

Expand All @@ -26,8 +27,9 @@ def __init__(self, model_configuration: dict[str, Any], device: str, amp: bool)
# we only need the inner model, not the wrapper
self._models = nn.ModuleList(
[
model_handler(rho_model_config, device, amp).model,
model_handler(rho_model_config, device, amp).model,
# some models change the model config dict during initialization
model_handler(copy.deepcopy(rho_model_config), device, amp).model,
model_handler(copy.deepcopy(rho_model_config), device, amp).model,
]
)
self._models_seen_ids: list[set[int]] = [set(), set()]
Expand Down

0 comments on commit 3fb42ca

Please sign in to comment.