Feature Extraction
sentence-transformers
PyTorch
Transformers
English
Chinese
xlm-roberta
sentence-similarity
text-embeddings-inference
Instructions to use maidalun1020/bce-embedding-base_v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use maidalun1020/bce-embedding-base_v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("maidalun1020/bce-embedding-base_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
How to use maidalun1020/bce-embedding-base_v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="maidalun1020/bce-embedding-base_v1")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("maidalun1020/bce-embedding-base_v1") model = AutoModel.from_pretrained("maidalun1020/bce-embedding-base_v1", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
got 401 after grant gated access
#6
by easychen - opened
with code:
async function query(data) {
const response = await fetch(
"https://huggingface.co/proxy/api-inference.huggingface.co/models/maidalun1020/bce-embedding-base_v1",
{
headers: { Authorization: "Bearer write_token" },
method: "POST",
body: JSON.stringify(data),
}
);
const result = await response.json();
return result;
}
query({"inputs": "Today is a sunny day and I will get some ice cream."}).then((response) => {
console.log(JSON.stringify(response));
});
got error:
{"error":"401 Client Error. (Request ID: Root=1-65bf4101-4e2e911f678fb4b153366678)\n\nCannot access gated repo for url https://huggingface.co/api/models/maidalun1020/bce-embedding-base_v1.\nRepo model maidalun1020/bce-embedding-base_v1 is gated. You must be authenticated to access it."}
Not recommend to use api-inference of hugginface.
You should:
- First get your access tokens (read or write) from: https://huggingface.co/settings/tokens
huggingface-cli loginwith your access token.- Then you can load model according to the manual: https://github.com/netease-youdao/BCEmbedding/tree/master?tab=readme-ov-file#quick-start
