Skip to content

Commit

Permalink
fix: sample size
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianwerk committed Oct 15, 2021
1 parent f47e366 commit 1dc475f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion finetuner/tuner/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def extract_catalog(docs):


def prepare_eval_docs(docs, catalog, limit=10, sample_size=100, seed=42):
sampled_docs = docs.sample(sample_size, seed)
sampled_docs = docs.sample(min(sample_size, len(docs)), seed)
to_be_scored_docs = DocumentArray()
for doc in sampled_docs:
d = Document(
Expand Down
2 changes: 1 addition & 1 deletion finetuner/tuner/pytorch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def get_embeddings(self, data: DocumentArrayLike):
blobs = data.blobs
embeddings = self.embed_model(torch.Tensor(blobs).to(self.device))
for doc, embed in zip(data, embeddings):
doc.embedding = np.array(embed)
doc.embedding = np.array(embed.cpu())

def save(self, *args, **kwargs):
torch.save(self.embed_model.state_dict(), *args, **kwargs)

0 comments on commit 1dc475f

Please sign in to comment.