Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divide By Zero Error #248

Closed
jlewi opened this issue Sep 18, 2024 · 0 comments · Fixed by #252
Closed

Divide By Zero Error #248

jlewi opened this issue Sep 18, 2024 · 0 comments · Fixed by #252

Comments

@jlewi
Copy link
Owner

jlewi commented Sep 18, 2024

We're getting a panic here

db.embeddings = mat.NewDense(int(float32(len(matches))/1.5), oai.SmallEmbeddingsDims, nil)

I think the problem is if len(matches) < 1.5 we end up rounding down to 0 which causes a problem.

jlewi added a commit that referenced this issue Sep 20, 2024
* Because we divide by 1.5; in the edge case were we have 1 example we'd
  end up rounding down to 0 which will cause problems when we try to initialize a matrix to that size.
Fix #248
@jlewi jlewi closed this as completed in 95ffab7 Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant