Skip to content

Commit

Permalink
bug fixes in update_text
Browse files Browse the repository at this point in the history
  • Loading branch information
rishiraj committed Apr 14, 2024
1 parent 6674a2b commit 812af60
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spanking/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def delete_text(self, index):
def update_text(self, index, new_text):
if 0 <= index < len(self.texts):
self.texts[index] = new_text
new_embedding = self.model.encode([new_text], normalize_embeddings=True)
self.embeddings = jax.ops.index_update(self.embeddings, index, new_embedding)
new_embedding = self.model.encode([new_text], normalize_embeddings=True).squeeze()
self.embeddings = (self.embeddings).at[index].set(new_embedding)
else:
raise IndexError("Invalid index")

Expand Down

0 comments on commit 812af60

Please sign in to comment.