-
Notifications
You must be signed in to change notification settings - Fork 568
model: add kalm_models ModelMeta #2775
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
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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,109 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from functools import partial | ||
|
|
||
| from mteb.model_meta import ModelMeta | ||
| from mteb.models.instruct_wrapper import InstructSentenceTransformerWrapper | ||
|
|
||
|
|
||
| MODEL_PROMPTS = { | ||
| "Classification": "Instruct: classify the query into different classes. \n Query: ", | ||
| "MultilabelClassification": "Instruct: classify the query into different classes. \n Query: ", | ||
| "Clustering": "Instruct: classify the query into different classes. \n Query: ", | ||
| "Reranking-query": "Instruct: Given a query, retrieve documents that answer the query. \n Query: ", | ||
| "Retrieval-query": "Instruct: Given a query, retrieve documents that answer the query. \n Query: ", | ||
| } | ||
|
|
||
| kalm_training_data = { | ||
| # from technical report | ||
| # not in MTEB: | ||
| # ExpertQA | ||
| # MEDI2BGE | ||
| # OpenOrca | ||
| # PAQ | ||
| # PubMedQA | ||
| # SearchQA | ||
| # arxiv_qa | ||
| # rag-dataset-12000 | ||
| # CC-News | ||
| # SQuAD 2.0 | ||
| # TriviaQA | ||
| # WebGPT Comparisons | ||
| # MultiNLI | ||
| # NLLB | ||
| # WikiAnswers | ||
| # SimCSE NLI | ||
| # SNLI | ||
| # Aya Dataset | ||
| # eli5 | ||
| # ---- | ||
| # in MTEB: | ||
| "CodeFeedbackMT": ["train"], | ||
| "CodeFeedbackST": ["train"], | ||
| "ArxivClusteringP2P": ["train"], | ||
| "ArxivClusteringS2S": ["train"], | ||
| "ArxivClusteringP2P.v2": ["train"], | ||
| "TRECCOVID": ["train"], | ||
| "DBPedia": ["train"], | ||
| "ESCIReranking": ["train"], | ||
| "FEVER": ["train"], | ||
| "FiQA2018": ["train"], | ||
| "FEVERHardNegatives": ["train"], | ||
| "NanoFEVERRetrieval": ["train"], | ||
| "HotpotQAHardNegatives": ["train"], | ||
| "MultiLongDocRetrieval": ["train"], | ||
| "MSMARCO": ["train"], | ||
| "MSMARCOHardNegatives": ["train"], | ||
| "NanoMSMARCORetrieval": ["train"], | ||
| "MSMARCOv2": ["train"], | ||
| "NFCorpus": ["train"], | ||
| "SciFact": ["train"], | ||
| "NQ": ["train"], | ||
| "NQHardNegatives": ["train"], | ||
| "NanoNQRetrieval": ["train"], | ||
| "QuoraRetrieval": ["train"], | ||
| "NanoQuoraRetrieval": ["train"], | ||
| "BiorxivClusteringP2P.v2": ["train"], | ||
| "BiorxivClusteringS2S.v2": ["train"], | ||
| "MedrxivClusteringP2P.v2": ["train"], | ||
| "MedrxivClusteringS2S.v2": ["train"], | ||
| "Banking77Classification": ["train"], | ||
| "AmazonPolarityClassification": ["train"], | ||
| "ImdbClassification": ["train"], | ||
| "EmotionClassification": ["train"], | ||
| "TweetSentimentExtractionClassification": ["train"], | ||
| "ToxicConversationsClassification": ["train"], | ||
| "MIRACLRetrieval": ["train"], | ||
| "MIRACLRetrievalHardNegatives": ["train"], | ||
| "MIRACLReranking": ["train"], | ||
| "MrTidyRetrieval": ["train"], | ||
| "PawsXPairClassification": ["train"], | ||
| "AmazonReviewsClassification": ["train"], | ||
| "AmazonCounterfactualClassification": ["train"], | ||
| "MultilingualSentiment": ["train"], | ||
| "MassiveIntentClassification": ["train"], | ||
| "MassiveScenarioClassification": ["train"], | ||
| "MTOPDomainClassification": ["train"], | ||
| "MTOPIntentClassification": ["train"], | ||
| } | ||
|
|
||
| KaLM_Embedding_X_0605 = ModelMeta( | ||
| name="KaLM-Team/KaLM-Embedding-X-0605", | ||
| loader=None, | ||
| languages=None, | ||
| open_weights=False, | ||
| revision="1", | ||
| release_date="2025-06-05", | ||
| n_parameters=9.24 * 1e9, | ||
| memory_usage_mb=35254, | ||
| max_tokens=8192, | ||
| embed_dim=3584, | ||
| license=None, | ||
| reference="https://github.com/KaLM-Team/KaLM-Embedding-X", | ||
| similarity_fn_name="cosine", | ||
| framework=["Sentence Transformers","PyTorch"], | ||
| use_instructions=True, | ||
| public_training_code="https://github.com/HITsz-TMG/KaLM-Embedding", | ||
| public_training_data=None, | ||
| training_datasets=kalm_training_data, | ||
| ) | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add implementation of your model? If it similar to original KALM, I can push work on that PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is almost the same implementation of HIT_TMG__KaLM_embedding_multilingual_mini_instruct_v1.
Perhaps the entire set of models related to KaLM should be moved to
kalm_models.py.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will try to finish work on #2478 on weekends then
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YanshekWoo can you try to run your models with implementation from #2478? It was merged to main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Samoed OK, I will try to test it. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Samoed
I have tested the latest version of MTEB (1.38.30), and I believe its results are completely fine now.
Some of the results (from different task type) for
HIT-TMG/KaLM-embedding-multilingual-mini-instruct-v1.5are as follows:The code of evaluation is as follows: