Comments (8)
No. Here is a minimal example that you can test:
# run with usearch-2.9.2 installed
import usearch.index
idx = usearch.index.Index(ndim=1024, metric='ip')
idx.save('index')
# run with usearch-2.12.0 installed
import usearch.index
# will throw an error in usearch-2.12.0
idx = usearch.index.Index.restore('index', view=True)
There's no need to insert anything into the database in order to trigger the error. Should be that the metadata in the old version is messed up.
from usearch.
There were no changes in the file format, but the number of checks and assertions grew. Apparently, one of those checks is hurting us here.
Does it also fail if you create an arbitrary index, and then call .load
- reinitializing it with a different file?
from usearch.
It fails with a different error:
RuntimeError: Key type doesn't match, consider rebuilding
triggered by the following code:
idx = usearch.index.Index(ndim=1024, metric='ip')
idx.load(idx_path)
which runs fine if downgraded to 2.9.2.
from usearch.
Interesting. Any chance the file was corrupted somewhere in between?
from usearch.
Update: this works both ways --- old version cannot open databases created by the new version either.
from usearch.
There were no changes in the file format, but the number of checks and assertions grew. Apparently, one of those checks is hurting us here.
In fact the file format changed due to a subtle change in code.
Compare:
usearch/include/usearch/index_plugins.hpp
Lines 122 to 142 in 5ea48c8
with:
usearch/include/usearch/index_plugins.hpp
Lines 128 to 148 in f79d818
so different versions interpret enums in the metadata differently.
As the metadata stored on disk also has version information, we can make new version of the library open old databases by mapping the old values to the new values. There seems to be no easy fix for the reverse direction, however.
As this definitely breaks compatibility between versions (affecting all f16, f32, f64 indices and all languages), this should be marked as a breaking change.
from usearch.
We can localize the damage by changing what is returned by this function:
usearch/include/usearch/index_dense.hpp
Lines 176 to 236 in 5ea48c8
Since the result is returned in various places inside the function, maybe it is best to add a method on index_dense_metadata_result_t
to "upgrade" its version to the new enum by mutating its headers appropriately.
I can make a pull request for it if that's OK.
from usearch.
Good catch @zh217! I think a good solution would be a custom function to convert enum to integer and vice-versa, with respect to the file version. Can you add it in index_plugins?
from usearch.
Related Issues (20)
- Bug: crash when hardware concurrency is exceeded HOT 5
- Bug: index.search returns invalid keys when k > index size HOT 5
- Bug: Deadlock in concurrent update()s HOT 5
- Bug: Replacing initial entry affects visibility of other entries HOT 2
- Feature: Cross compilation of sqlite extension for ios and android for react native apps HOT 2
- Bug: Issues index dtype=i8 with Inner Product Metrics HOT 27
- Feature parity between GoLang and C HOT 1
- Feature: Java search API extension to batch search and ANN.
- Bug: Segfault when dimensions of added vector don't add up (Rust) HOT 8
- Bug: Failed to run c++ examples. HOT 2
- Bug: Arm64 versions starting at v10.0 and up give the error Fatal Python error: Illegal instruction HOT 3
- Low index performance after `clear()` HOT 2
- Bug: Syntax Error with Jest in ESM HOT 3
- Bug: Rust build does not use simsimd (`index.hardware_acceleration()` reports `serial`) HOT 2
- Feature: adding `py.typed` metadata to `python/usearch` HOT 1
- Bug: npm package does not support esm in nodejs project. HOT 3
- "usearch_sqlite" binary for Windows HOT 1
- Bug: Rust test_add_remove_vector fails on main-dev HOT 2
- Docs: The usearch.h exact_search documentation doesn't match the function arguments HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from usearch.