Feature Extraction
Transformers
Safetensors
sentence-transformers
minicpm
mteb
custom_code
Eval Results (legacy)
Instructions to use openbmb/MiniCPM-Embedding-Light with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/MiniCPM-Embedding-Light with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="openbmb/MiniCPM-Embedding-Light", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("openbmb/MiniCPM-Embedding-Light", trust_remote_code=True, dtype="auto") - sentence-transformers
How to use openbmb/MiniCPM-Embedding-Light with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("openbmb/MiniCPM-Embedding-Light", trust_remote_code=True) sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Update scripts/infinity_demo.py
Browse files- scripts/infinity_demo.py +1 -1
scripts/infinity_demo.py
CHANGED
|
@@ -3,7 +3,7 @@ from infinity_emb import AsyncEngineArray, EngineArgs, AsyncEmbeddingEngine
|
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
array = AsyncEngineArray.from_args([
|
| 6 |
-
EngineArgs(model_name_or_path = "
|
| 7 |
])
|
| 8 |
queries = ["中国的首都是哪里?"] # "What is the capital of China?"
|
| 9 |
passages = ["beijing", "shanghai"] # "北京", "上海"
|
|
|
|
| 3 |
import numpy as np
|
| 4 |
|
| 5 |
array = AsyncEngineArray.from_args([
|
| 6 |
+
EngineArgs(model_name_or_path = "openbmb/MiniCPM-Embedding-Light", engine="torch", dtype="float16", bettertransformer=False, pooling_method="mean", trust_remote_code=True),
|
| 7 |
])
|
| 8 |
queries = ["中国的首都是哪里?"] # "What is the capital of China?"
|
| 9 |
passages = ["beijing", "shanghai"] # "北京", "上海"
|