|
2 | 2 |
|
3 | 3 | from functools import partial
|
4 | 4 |
|
| 5 | +import torch |
| 6 | + |
5 | 7 | from mteb.model_meta import ModelMeta
|
| 8 | +from mteb.models.instruct_wrapper import instruct_wrapper |
| 9 | + |
| 10 | + |
| 11 | +def instruction_template(instruction: str) -> str: |
| 12 | + return f"Instruct: {instruction}\nQuery: " if instruction else "" |
6 | 13 |
|
7 |
| -from .instruct_wrapper import instruct_wrapper |
8 | 14 |
|
9 | 15 | gte_Qwen2_7B_instruct = ModelMeta(
|
10 |
| - loader=partial( |
| 16 | + loader=partial( # type: ignore |
11 | 17 | instruct_wrapper,
|
12 | 18 | model_name_or_path="Alibaba-NLP/gte-Qwen2-7B-instruct",
|
13 |
| - instruction_template="Instruct: {instruction}\nQuery: ", |
| 19 | + instruction_template=instruction_template, |
14 | 20 | attn="cccc",
|
15 | 21 | pooling_method="lasttoken",
|
16 | 22 | mode="embedding",
|
|
33 | 39 | framework=["Sentence Transformers", "PyTorch"],
|
34 | 40 | use_instructions=True,
|
35 | 41 | )
|
| 42 | + |
| 43 | + |
| 44 | +gte_Qwen1_5_7B_instruct = ModelMeta( |
| 45 | + loader=partial( # type: ignore |
| 46 | + instruct_wrapper, |
| 47 | + model_name_or_path="Alibaba-NLP/gte-Qwen1.5-7B-instruct", |
| 48 | + instruction_template=instruction_template, |
| 49 | + attn="cccc", |
| 50 | + pooling_method="lasttoken", |
| 51 | + mode="embedding", |
| 52 | + torch_dtype="auto", |
| 53 | + normalized=True, |
| 54 | + ), |
| 55 | + name="Alibaba-NLP/gte-Qwen1.5-7B-instruct", |
| 56 | + languages=["eng_Latn"], |
| 57 | + open_weights=True, |
| 58 | + revision="07d27e5226328010336563bc1b564a5e3436a298", |
| 59 | + release_date="2024-04-20", # initial commit of hf model. |
| 60 | + n_parameters=7_720_000_000, |
| 61 | + memory_usage=None, |
| 62 | + embed_dim=4096, |
| 63 | + license="apache-2.0", |
| 64 | + max_tokens=32768, |
| 65 | + reference="https://huggingface.co/Alibaba-NLP/gte-Qwen1.5-7B-instruct", |
| 66 | + similarity_fn_name="cosine", |
| 67 | + framework=["Sentence Transformers", "PyTorch"], |
| 68 | + use_instructions=True, |
| 69 | +) |
| 70 | + |
| 71 | + |
| 72 | +gte_Qwen2_1_5B_instruct = ModelMeta( |
| 73 | + loader=partial( # type: ignore |
| 74 | + instruct_wrapper, |
| 75 | + model_name_or_path="Alibaba-NLP/gte-Qwen2-1.5B-instruct", |
| 76 | + instruction_template=instruction_template, |
| 77 | + attn="cccc", |
| 78 | + pooling_method="lasttoken", |
| 79 | + mode="embedding", |
| 80 | + torch_dtype="auto", |
| 81 | + normalized=True, |
| 82 | + ), |
| 83 | + name="Alibaba-NLP/gte-Qwen2-1.5B-instruct", |
| 84 | + languages=["eng_Latn"], |
| 85 | + open_weights=True, |
| 86 | + revision="c6c1b92f4a3e1b92b326ad29dd3c8433457df8dd", |
| 87 | + release_date="2024-07-29", # initial commit of hf model. |
| 88 | + n_parameters=1_780_000_000, |
| 89 | + memory_usage=None, |
| 90 | + embed_dim=8960, |
| 91 | + license="apache-2.0", |
| 92 | + max_tokens=131072, |
| 93 | + reference="https://huggingface.co/Alibaba-NLP/gte-Qwen2-1.5B-instruct", |
| 94 | + similarity_fn_name="cosine", |
| 95 | + framework=["Sentence Transformers", "PyTorch"], |
| 96 | + use_instructions=True, |
| 97 | +) |
0 commit comments