unum-cloud / usearch

Fast Open-Source Search & Clustering engine × for Vectors & 🔜 Strings × in C++, C, Python, JavaScript, Rust, Java, Objective-C, Swift, C#, GoLang, and Wolfram 🔍
https://unum-cloud.github.io/usearch/
Apache License 2.0
2.27k stars 143 forks source link

Bug: usearch crashes on Windows Python 3.12.3 for v2.15.1 #491

Open genotrance opened 2 months ago

genotrance commented 2 months ago

Describe the bug

usearch is crashing Python script on adding embeddings to the database. Last working version on Windows is v2.12. Crash is seen since 2.13+ to the latest version.

Same steps work on Linux for latest version, tested with Python 3.12 and 3.10.

Steps to reproduce

# embeddings = List[List[float]]
index = usearch.index.Index(ndim=len(embeddings[0]), dtype="f32")
index.add(idx, embedding)

usearch simply exits on the third line. There is no stack trace, error or crash.

Expected behavior

Embeddings should get added to the database.

USearch version

v2.13+

Operating System

Windows

Hardware architecture

x86

Which interface are you using?

Python bindings

Contact Details

No response

Are you open to being tagged as a contributor?

Is there an existing issue for this?

Code of Conduct

ashvardanian commented 2 months ago

@genotrance, can you please provide more details on the environment - like the CPU model?

genotrance commented 2 months ago

This is a Win11 laptop with an i7-1265U.

Platform: Windows-11-10.0.22621-SP0
Python version: 3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)]
Architecture: ('64bit', 'WindowsPE')
ashvardanian commented 2 months ago

@genotrance, can you please also log this:

index.hardware_acceleration
genotrance commented 2 months ago

With 2.12, I got the output serial. On 2.15.1, I got haswell.

ashvardanian commented 2 months ago

@genotrance, the haswell label makes sense, as your CPU supports AVX2. Does the issue persist if you try some other dtype in the constructor, like f16 and bf16?

genotrance commented 2 months ago

I tried f16 and bf16 and both crashed. I was adding as below:

import usearch.index
i = usearch.index.Index(ndim=2, dtype="f16") # or bf16
i.add(1, np.array([[0.1, 0.2]], dtype="float16"))