Instructions to use mixedbread-ai/mxbai-embed-large-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use mixedbread-ai/mxbai-embed-large-v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("mixedbread-ai/mxbai-embed-large-v1") 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] - Transformers.js
How to use mixedbread-ai/mxbai-embed-large-v1 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('feature-extraction', 'mixedbread-ai/mxbai-embed-large-v1'); - Transformers
How to use mixedbread-ai/mxbai-embed-large-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="mixedbread-ai/mxbai-embed-large-v1")# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("mixedbread-ai/mxbai-embed-large-v1") model = AutoModel.from_pretrained("mixedbread-ai/mxbai-embed-large-v1", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mixedbread-ai/mxbai-embed-large-v1 with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf mixedbread-ai/mxbai-embed-large-v1:F16 # Run inference directly in the terminal: llama cli -hf mixedbread-ai/mxbai-embed-large-v1:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mixedbread-ai/mxbai-embed-large-v1:F16 # Run inference directly in the terminal: llama cli -hf mixedbread-ai/mxbai-embed-large-v1:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf mixedbread-ai/mxbai-embed-large-v1:F16 # Run inference directly in the terminal: ./llama-cli -hf mixedbread-ai/mxbai-embed-large-v1:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf mixedbread-ai/mxbai-embed-large-v1:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf mixedbread-ai/mxbai-embed-large-v1:F16
Use Docker
docker model run hf.co/mixedbread-ai/mxbai-embed-large-v1:F16
- LM Studio
- Jan
- Ollama
How to use mixedbread-ai/mxbai-embed-large-v1 with Ollama:
ollama run hf.co/mixedbread-ai/mxbai-embed-large-v1:F16
- Unsloth Studio
How to use mixedbread-ai/mxbai-embed-large-v1 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for mixedbread-ai/mxbai-embed-large-v1 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for mixedbread-ai/mxbai-embed-large-v1 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for mixedbread-ai/mxbai-embed-large-v1 to start chatting
- Docker Model Runner
How to use mixedbread-ai/mxbai-embed-large-v1 with Docker Model Runner:
docker model run hf.co/mixedbread-ai/mxbai-embed-large-v1:F16
- Lemonade
How to use mixedbread-ai/mxbai-embed-large-v1 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mixedbread-ai/mxbai-embed-large-v1:F16
Run and chat with the model
lemonade run user.mxbai-embed-large-v1-F16
List all available models
lemonade list
- Atomic Chat
Upload ONNX weights + add transformers.js code/tags (#2)
Browse files- Upload ONNX weights (7a055cbd36c0b250e778017460b956afe6a15c83)
- Add transformers.js sample code + tags (affc1c96c21894a0ebf5ad0d68aa0544d0e02943)
- Update README.md (38287a9818172d5ebac83a92cd611b2252beea6b)
Co-authored-by: Joshua <Xenova@users.noreply.huggingface.co>
- README.md +34 -0
- onnx/model.onnx +3 -0
- onnx/model_quantized.onnx +3 -0
|
@@ -1,6 +1,7 @@
|
|
| 1 |
---
|
| 2 |
tags:
|
| 3 |
- mteb
|
|
|
|
| 4 |
model-index:
|
| 5 |
- name: mxbai-angle-large-v1
|
| 6 |
results:
|
|
@@ -2703,6 +2704,39 @@ similarities = cos_sim(embeddings[0], embeddings[1:])
|
|
| 2703 |
print('similarities:', similarities)
|
| 2704 |
```
|
| 2705 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2706 |
### Using API
|
| 2707 |
|
| 2708 |
You’ll be able to use the models through our API as well. The API is coming soon and will have some exciting features. Stay tuned!
|
|
|
|
| 1 |
---
|
| 2 |
tags:
|
| 3 |
- mteb
|
| 4 |
+
- transformers.js
|
| 5 |
model-index:
|
| 6 |
- name: mxbai-angle-large-v1
|
| 7 |
results:
|
|
|
|
| 2704 |
print('similarities:', similarities)
|
| 2705 |
```
|
| 2706 |
|
| 2707 |
+
### Transformers.js
|
| 2708 |
+
|
| 2709 |
+
If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@xenova/transformers) using:
|
| 2710 |
+
```bash
|
| 2711 |
+
npm i @xenova/transformers
|
| 2712 |
+
```
|
| 2713 |
+
|
| 2714 |
+
You can then use the model to compute embeddings like this:
|
| 2715 |
+
|
| 2716 |
+
```js
|
| 2717 |
+
import { pipeline, cos_sim } from '@xenova/transformers';
|
| 2718 |
+
|
| 2719 |
+
// Create a feature extraction pipeline
|
| 2720 |
+
const extractor = await pipeline('feature-extraction', 'mixedbread-ai/mxbai-embed-large-v1', {
|
| 2721 |
+
quantized: false, // Comment out this line to use the quantized version
|
| 2722 |
+
});
|
| 2723 |
+
|
| 2724 |
+
// Generate sentence embeddings
|
| 2725 |
+
const docs = [
|
| 2726 |
+
'Represent this sentence for searching relevant passages: A man is eating a piece of bread',
|
| 2727 |
+
'A man is eating food.',
|
| 2728 |
+
'A man is eating pasta.',
|
| 2729 |
+
'The girl is carrying a baby.',
|
| 2730 |
+
'A man is riding a horse.',
|
| 2731 |
+
]
|
| 2732 |
+
const output = await extractor(docs, { pooling: 'cls' });
|
| 2733 |
+
|
| 2734 |
+
// Compute similarity scores
|
| 2735 |
+
const [source_embeddings, ...document_embeddings ] = output.tolist();
|
| 2736 |
+
const similarities = document_embeddings.map(x => cos_sim(source_embeddings, x));
|
| 2737 |
+
console.log(similarities); // [0.7919578577247139, 0.6369278664248345, 0.16512018371357193, 0.3620778366720027]
|
| 2738 |
+
```
|
| 2739 |
+
|
| 2740 |
### Using API
|
| 2741 |
|
| 2742 |
You’ll be able to use the models through our API as well. The API is coming soon and will have some exciting features. Stay tuned!
|
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:adb53ed475faa339bfad3bd2bdb7e6a30b4f47280ade9811f81bef7953f9ab77
|
| 3 |
+
size 1336854282
|
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:11bda26d2ee754b20d46c90d0fae7eb5a71e0f947e74261afd6ad640ebbcfa7f
|
| 3 |
+
size 336983163
|