Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardobl committed Apr 20, 2024
1 parent 371c283 commit 40d87cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def encode(self, sentences):
to_encode_index=[]
out = []
for s in sentences:
hash = hashlib.sha256(self.modelName+":"+s.encode()).hexdigest()
hash = hashlib.sha256((self.modelName+":"+s).encode()).hexdigest()
cache_file = self.cachePath+"/"+hash+".dat"
if not os.path.exists(cache_file):
to_encode.append(s)
Expand All @@ -87,7 +87,7 @@ def encode(self, sentences):

for i in range(len(to_encode_index)):
out[to_encode_index[i]] = encoded[i]
hash = hashlib.sha256(self.modelName+":"+to_encode[i].encode()).hexdigest()
hash = hashlib.sha256((self.modelName+":"+to_encode[i]).encode()).hexdigest()
with open(self.cachePath+"/"+hash+".dat", "wb") as f:
pickle.dump(encoded[i], f)

Expand Down

0 comments on commit 40d87cb

Please sign in to comment.