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

bug(node, vectordb): error when using Float64 embedding function #1292

Open
universalmind303 opened this issue May 10, 2024 · 1 comment
Open
Labels
bug Something isn't working typescript Typescript / javascript

Comments

@universalmind303
Copy link
Contributor

LanceDB version

main

What happened?

I get some buffer allocation errors if i try to specify Float64 as my embedding function type

Error: Invalid argument error: Need at least 8192 bytes in buffers[0] in array of type Float64, but got 4096

Are there known steps to reproduce?

const db = await lancedb.connect("/tmp/lancedb");

const embeddingFunction = {
  sourceColumn: "text",
  embed: async function (batch) {
    return batch.map(() => Array(512).fill(1.0))

  },
};

const data = [
  {text: "hello"},
  {text: "hello world"},
]

const schema = new Schema([
  new Field("vector", new FixedSizeList(512, new Field("item", new Float64()))),
  new Field("text", new Utf8())
]);

const name = "test";
let table = await db.createTable({name, data, schema, embeddingFunction})

However, if I change Float64 to Float32, everything works fine.

@universalmind303 universalmind303 added bug Something isn't working typescript Typescript / javascript labels May 10, 2024
@universalmind303 universalmind303 changed the title bug(node): error when using Float64 embedding function bug(node, vectordb): error when using Float64 embedding function May 10, 2024
@wjones127
Copy link
Contributor

That seems odd. We might hard code f32 in some places, but in Lance we do support f16 and f64, so we should fix any places that assume f32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working typescript Typescript / javascript
Projects
None yet
Development

No branches or pull requests

2 participants