Skip to content

Commit

Permalink
another attempt to get it to train
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeadriel committed May 23, 2024
1 parent 907fa72 commit 7b3f514
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/fineTune.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,18 @@ def predictSentencePairs(
sents2 = [ [w for w in sent if w in sif_weights and w != vocab.unk] for sent in pairs[1] ]

similarities = torch.zeros((len(sents1), 1), requires_grad=True, device=device)
similaritiesTmp = torch.zeros((len(sents1), 1), requires_grad=False, device=device)

for y in range(len(sents1)):
sent1 = sents1[y]
sent2 = sents2[y]

similarity = 0

for word1 in sent1:
for word2 in sent2:
similarity += model[word1] * model[word2] * sif_weights[word1] * sif_weights[word2]
similaritiesTmp[y] += model[word1] * model[word2] * sif_weights[word1] * sif_weights[word2]

similarities[y] += similarity
similarities += similaritiesTmp

return similarities

Expand Down

0 comments on commit 7b3f514

Please sign in to comment.