This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from collections import OrderedDict | |
from typing import List | |
checkpoints_weights_paths: List[str] = ... # sorted in descending order by score | |
model: torch.nn.Module = ... | |
def average_weights(state_dicts: List[dict]): | |
everage_dict = OrderedDict() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import base class first | |
# or you'll get such error: | |
# TypeError: super(type, obj): obj must be an instance or subtype of type | |
from albumentations import DualTransform | |
# new targets function | |
def new_tf_targets(self): | |
return { | |
'image': self.apply, # do not rename this one | |
'image2': self.apply, # new |