-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
[New Model]: jinaai/jina-embeddings-v3 #16120
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8b0d986
support jina-embeddings-v3
noooop 2719b45
is_matryoshka
noooop d523b1b
Refactoring BertModel
noooop e12715b
follow modeling_bert
noooop f9c6287
+ example
noooop f696d4b
move
noooop c1e97df
+print
noooop e374cf7
ruff
noooop 43e971c
Merge branch 'vllm-project:main' into jina-embeddings
noooop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from argparse import Namespace | ||
|
||
from vllm import LLM, EngineArgs | ||
from vllm.utils import FlexibleArgumentParser | ||
|
||
|
||
def main(args: Namespace): | ||
# Sample prompts. | ||
prompts = [ | ||
"Follow the white rabbit.", # English | ||
"Sigue al conejo blanco.", # Spanish | ||
"Suis le lapin blanc.", # French | ||
"跟着白兔走。", # Chinese | ||
"اتبع الأرنب الأبيض.", # Arabic | ||
"Folge dem weißen Kaninchen.", # German | ||
] | ||
|
||
# Create an LLM. | ||
# You should pass task="embed" for embedding models | ||
model = LLM(**vars(args)) | ||
|
||
# Generate embedding. The output is a list of EmbeddingRequestOutputs. | ||
# Only text matching task is supported for now. See #16120 | ||
outputs = model.embed(prompts) | ||
|
||
# Print the outputs. | ||
print("\nGenerated Outputs:") | ||
print("Only text matching task is supported for now. See #16120") | ||
print("-" * 60) | ||
for prompt, output in zip(prompts, outputs): | ||
embeds = output.outputs.embedding | ||
embeds_trimmed = ((str(embeds[:16])[:-1] + | ||
", ...]") if len(embeds) > 16 else embeds) | ||
print(f"Prompt: {prompt!r} \n" | ||
f"Embeddings for text matching: {embeds_trimmed} " | ||
f"(size={len(embeds)})") | ||
print("-" * 60) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = FlexibleArgumentParser() | ||
parser = EngineArgs.add_cli_args(parser) | ||
# Set example specific arguments | ||
parser.set_defaults(model="jinaai/jina-embeddings-v3", | ||
task="embed", | ||
trust_remote_code=True) | ||
args = parser.parse_args() | ||
main(args) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.