Skip to content

Commit

Permalink
ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent committed Oct 28, 2023
1 parent 89e531d commit 995fd1c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions embetter/finetune/_contrastive_tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import numpy as np
import torch
import torch.nn as nn
from dataclasses import dataclass

from ._constrastive_learn import ContrastiveLearner
Expand All @@ -31,7 +30,7 @@ def generate_pairs_batch(labels, n_neg=3):
single_example = {}
indices = np.arange(len(labels))
for label, grouper in groupby(
((s, l) for s, l in zip(indices, labels)), key=lambda x: x[1]
((s, lab) for s, lab in zip(indices, labels)), key=lambda x: x[1]
):
lookup[label].extend(list(i[0] for i in grouper))
single_example[label] = len(lookup[label]) == 1
Expand Down

0 comments on commit 995fd1c

Please sign in to comment.