Text Classification
Transformers
TensorBoard
Safetensors
distilbert
Generated from Trainer
text-embeddings-inference
Instructions to use AndresR2909/finetuning_bert_text_classification with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AndresR2909/finetuning_bert_text_classification with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="AndresR2909/finetuning_bert_text_classification")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("AndresR2909/finetuning_bert_text_classification") model = AutoModelForSequenceClassification.from_pretrained("AndresR2909/finetuning_bert_text_classification", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update handler.py
Browse files- handler.py +6 -1
handler.py
CHANGED
|
@@ -9,7 +9,12 @@ logger = logging.getLogger(__name__)
|
|
| 9 |
class EndpointHandler():
|
| 10 |
def __init__(self, path="AndresR2909/finetuning-bert-text-classification"):
|
| 11 |
logger.info(f"Modelo cargado desde el path: {path}")
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
|
|
| 9 |
class EndpointHandler():
|
| 10 |
def __init__(self, path="AndresR2909/finetuning-bert-text-classification"):
|
| 11 |
logger.info(f"Modelo cargado desde el path: {path}")
|
| 12 |
+
# Cargar el pipeline con el modelo especificado
|
| 13 |
+
try:
|
| 14 |
+
self.pipeline = pipeline(model=path, truncation=True)
|
| 15 |
+
except Exception as e:
|
| 16 |
+
logger.exception(f"Error cargando el modelo desde el path {path}: {e}")
|
| 17 |
+
raise
|
| 18 |
|
| 19 |
|
| 20 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|