Downloads · 30 days
14
13% of all-time downloads
pyteach237/multilabel_lora_distilbert_runews_classifier_tuned
multilabel_lora_distilbert_runews_classifier_tuned is a machine learning model from pyteach237. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
14
13% of all-time downloads
All-time downloads
104
Public
Repo size
2.8 MB
Likes
0
Public
Click a slice to open those files.
.safetensors2.8 MB · 74%
From the Hugging Face model README
Model Name: DistilBERT with LoRA for Text Classification
Model Type: Transformer-based Language Model
Base Model: distilbert-base-multilingual-cased
Fine-tuning Framework: LoRA (Low-Rank Adaptation of Large Language Models)
Trained By: ABODO Brice Donald
License: Apache 2.0
This model is a fine-tuned version of distilbert-base-multilingual-cased on the None dataset. It achieves the following results on the evaluation set:
This model is a fine-tuned version of distilbert-base-multilingual-cased for text classification tasks. The model has been adapted using LoRA (Low-Rank Adaptation) to efficiently train on the target dataset with fewer parameters, allowing for better performance with less computational resources.
The model was trained and evaluated on the Russian Language news dataset, which consists of news texts labeled as positive, negative or neutral. The dataset is divided into training and test sets for evaluation purposes.
This model is intended for text classification tasks, particularly multilabel sentiment analysis. It can be fine-tuned further for other classification tasks by using appropriate datasets and modifying the number of labels.
The model was evaluated using the following metrics:
DistilBertTokenizer with a maximum length of 512 tokens.The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Accuracy | F1 | Precision | Recall |
|---|---|---|---|---|---|---|---|
| No log | 1.0 | 91 | 0.5987 | 0.7634 | 0.7621 | 0.7648 | 0.7634 |
| No log | 2.0 | 182 | 0.3768 | 0.8693 | 0.8698 | 0.8767 | 0.8693 |
| No log | 3.0 | 273 | 0.2620 | 0.9065 | 0.9063 | 0.9093 | 0.9065 |
| No log | 4.0 | 364 | 0.2427 | 0.9202 | 0.9203 | 0.9220 | 0.9202 |
| No log | 5.0 | 455 | 0.2244 | 0.9367 | 0.9369 | 0.9387 | 0.9367 |
| 0.3641 | 6.0 | 546 | 0.2385 | 0.9491 | 0.9491 | 0.9495 | 0.9491 |
| 0.3641 | 7.0 | 637 | 0.2560 | 0.9464 | 0.9464 | 0.9465 | 0.9464 |
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification, Trainer, TrainingArguments
from peft import PeftConfig, PeftModel
# Load the tokenizer and model
tokenizer = DistilBertTokenizer.from_pretrained('distilbert-base-multilingual-cased')
model_id = 'pyteach237/multilabel_lora_distilbert_runews_classifier_tuned'
config = PeftConfig.from_pretrained(model_id)
# Define the model with LoRA
model = DistilBertForSequenceClassification.from_pretrained(
config.base_model_name_or_path,
num_labels=3
)
model = PeftModel.from_pretrained(model, model_id, config=config)
text = "Your text here :)"
# Tokenize input
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding='max_length', max_length=512)
# Make predictions
outputs = model(**inputs)
predictions = outputs.logits.argmax(dim=-1)
# Convert predictions to labels
labels = ['negative', 'neutral', 'positive']
predicted_label = labels[predictions.item()]
print(f'Predicted label: {predicted_label}')
This model card template was inspired by the Hugging Face model cards. Special thanks to the contributors of the Hugging Face transformers library and the LoRA adaptation framework.
For further information, please contact [Brice Donald] at [[email protected]].