Bert Mini Reranker En Pt
cnmoroIntroduction
The BERTMINI-RERANKER-ENPT model by CNMORO is designed to rank documents based on their relevance to a given query. It leverages a mini-version of the BERT model, making it efficient for tasks involving both the English and Portuguese languages.
Architecture
The model is based on the google/bert_uncased_L-4_H-256_A-4
architecture. It uses a sequence classification approach with two labels, allowing it to determine the relevance of a document in relation to a query.
Training
The model employs a pre-trained BERT architecture fine-tuned for sequence classification, making it effective for re-ranking tasks. It uses a binary classification setup to predict the relevance of each document to the query, adjusting confidences accordingly.
Guide: Running Locally
To run the model locally, follow these basic steps:
-
Install Dependencies: Ensure Python and PyTorch are installed. Install the
transformers
library:pip install transformers torch
-
Load the Model: Use the following Python code to load the model and tokenizer:
from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch model_id = "cnmoro/BertMini-Reranker-EnPt" model = AutoModelForSequenceClassification.from_pretrained(model_id, num_labels=2) tokenizer = AutoTokenizer.from_pretrained(model_id) device = torch.device("cuda" if torch.cuda.is_available() else "cpu") model.to(device)
-
Run Inference: Use the
rank
function provided in the model's code to rank documents based on a query. -
Cloud GPUs: For improved performance, especially with large datasets, consider using cloud GPUs from providers like AWS, Google Cloud, or Azure.
License
This model is licensed under the MIT License, allowing for extensive reuse and modification with minimal restrictions.