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

How to impleplement late-chunking with jina api? #3

Open
rickythink opened this issue Sep 13, 2024 · 2 comments
Open

How to impleplement late-chunking with jina api? #3

rickythink opened this issue Sep 13, 2024 · 2 comments

Comments

@rickythink
Copy link

rickythink commented Sep 13, 2024

Thank you, Jina team, for sharing this method.

I am currently trying to implement late chunking in my own workflow.

I noticed the following example:

# chunk afterwards (context-sensitive chunked pooling)
inputs = tokenizer(input_text, return_tensors='pt')
model_output = model(**inputs)

Is it possible to use Jina’s API for this?

From what I’ve observed, the segment API only returns the start and end tokens, and it doesn’t seem to support this use case.

Let me know if I need any adjustments!

@guenthermi
Copy link
Member

At the moment it is not possible with the API but we already working on an integration which makes it possible

@guenthermi
Copy link
Member

Now the API supports late chunking for our new model. As we also want to extend the evaluation on jina embeddings v3 I implemented support for the new model and also add a test that compares the embeddings produced with the embeddings produced by the API. In general, they can differ a little bit (not only when using late chunking) because of different optimizations applied during inference (e.g. flash attention, optimizations done by cuda for bf16, ...). Both is not merged to the main branch at the moment, but if you want to take a look at how to do late chunking with the API, you can take a look at the test case in this PR: https://github.com/jina-ai/late-chunking/pull/8/files

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

No branches or pull requests

2 participants