Text Classification
sentence-transformers
Safetensors
Transformers
multilingual
cost_wise_gemma
text-generation
custom_code
Instructions to use BAAI/bge-reranker-v2.5-gemma2-lightweight with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use BAAI/bge-reranker-v2.5-gemma2-lightweight with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("BAAI/bge-reranker-v2.5-gemma2-lightweight", 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] - Transformers
How to use BAAI/bge-reranker-v2.5-gemma2-lightweight with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="BAAI/bge-reranker-v2.5-gemma2-lightweight", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("BAAI/bge-reranker-v2.5-gemma2-lightweight", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
找不到gemma_config.py
#2
by dunwu - opened
使用FlagEmbedding加载本地模型,报错OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like BAAI/bge-reranker-v2.5-gemma2-lightweight is not the path to a directory containing a file named gemma_config.py. 但是在模型目录下是有gemma_config.py文件的。
- make sure
gemma_config.pyandgemma_model.pyfrom BAAI/bge-reranker-v2.5-gemma2-lightweight in your local path. - modify the following part of config.json:
"auto_map": {
"AutoConfig": "gemma_config.CostWiseGemmaConfig",
"AutoModel": "gemma_model.CostWiseGemmaModel",
"AutoModelForCausalLM": "gemma_model.CostWiseGemmaForCausalLM"
},