We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4947d5b commit 0c962e9Copy full SHA for 0c962e9
swift/plugin/loss.py
@@ -174,6 +174,8 @@ def calculate_infonce_metrics(embeddings, labels):
174
from scipy.stats import pearsonr, spearmanr
175
hard_negatives = os.environ.get('INFONCE_HARD_NEGATIVES', None)
176
use_batch = strtobool(os.environ.get('INFONCE_USE_BATCH', 'True'))
177
+ if hard_negatives is not None:
178
+ hard_negatives = int(hard_negatives)
179
split_tensors = _parse_multi_negative_sentences(torch.tensor(embeddings), torch.tensor(labels), hard_negatives)
180
split_tensors = [t.numpy() for t in split_tensors]
181
can_batched = hard_negatives is not None
0 commit comments