diff --git a/examples/cars/train.py b/examples/cars/train.py index ddc18d39..2da4137c 100644 --- a/examples/cars/train.py +++ b/examples/cars/train.py @@ -22,7 +22,6 @@ def train( shuffle: bool, save_dir: str, ): - model = Model( lr=lr, mining=mining, diff --git a/quaterion/dataset/similarity_data_loader.py b/quaterion/dataset/similarity_data_loader.py index 0e775f03..9bc1af0b 100644 --- a/quaterion/dataset/similarity_data_loader.py +++ b/quaterion/dataset/similarity_data_loader.py @@ -31,7 +31,6 @@ class SimilarityDataLoader(DataLoader, Generic[T_co]): """ def __init__(self, dataset: Dataset, **kwargs): - if "collate_fn" not in kwargs: kwargs["collate_fn"] = self.__class__.pre_collate_fn self._original_dataset = dataset diff --git a/quaterion/loss/cos_face_loss.py b/quaterion/loss/cos_face_loss.py index 7980aeb5..4de05435 100644 --- a/quaterion/loss/cos_face_loss.py +++ b/quaterion/loss/cos_face_loss.py @@ -27,7 +27,6 @@ def __init__( margin: Optional[float] = 0.35, scale: Optional[float] = 64.0, ): - super(GroupLoss, self).__init__() self.kernel = nn.Parameter(torch.FloatTensor(embedding_size, num_groups)) @@ -36,7 +35,6 @@ def __init__( self.margin = margin def forward(self, embeddings: Tensor, groups: LongTensor) -> Tensor: - """Compute loss value Args: embeddings: shape: (batch_size, vector_length) - Output embeddings from the diff --git a/quaterion/loss/online_contrastive_loss.py b/quaterion/loss/online_contrastive_loss.py index 8ae841a7..d57c8c75 100644 --- a/quaterion/loss/online_contrastive_loss.py +++ b/quaterion/loss/online_contrastive_loss.py @@ -93,7 +93,6 @@ def forward( ) if self._mining == "all": - num_positive_pairs = anchor_positive_mask.sum() positive_loss = anchor_positive_dists.sum() / torch.max( num_positive_pairs, torch.tensor(1e-16) @@ -106,7 +105,6 @@ def forward( ).sum() / torch.max(num_negative_pairs, torch.tensor(1e-16)) else: # batch-hard pair mining - # get the hardest positive for each anchor # shape: (batch_size,) hardest_positive_dists = anchor_positive_dists.max(dim=1)[0] diff --git a/quaterion/train/cache/cache_model.py b/quaterion/train/cache/cache_model.py index 10fbd6fe..7aafe4f6 100644 --- a/quaterion/train/cache/cache_model.py +++ b/quaterion/train/cache/cache_model.py @@ -24,7 +24,6 @@ def __init__( self, encoders: Dict[str, CacheEncoder], ): - super().__init__() self.encoders = encoders for key, encoder in self.encoders.items(): diff --git a/quaterion/train/trainable_model.py b/quaterion/train/trainable_model.py index d0110c75..e8eadbe1 100644 --- a/quaterion/train/trainable_model.py +++ b/quaterion/train/trainable_model.py @@ -381,7 +381,6 @@ def _maybe_compute_xbm_loss( ): loss_obj = self.loss # Assign to tmp variable for better type inference if isinstance(loss_obj, GroupLoss): - memory_embeddings, memory_groups = self._xbm_buffer.get() memory_loss = loss_obj.xbm_loss( embeddings, targets["groups"], memory_embeddings, memory_groups diff --git a/tests/test_import.py b/tests/test_import.py index 233a6bfa..24541994 100644 --- a/tests/test_import.py +++ b/tests/test_import.py @@ -1,3 +1,2 @@ def test_import_main_classes(): - from quaterion import Quaterion, TrainableModel