CoolFace
Modelpublic

daxa-ai/pebblo-classifier

sourceHugging Facemitupdated 2y agoView on Hugging Face
9likes365downloads
Model Card

Model Card for Model ID

This model card outlines the Pebblo Classifier, a machine learning system specialized in text classification. Developed by DAXA.AI, this model is adept at categorizing various agreement documents within organizational structures, trained on 21 distinct labels.

Model Details

Model Description

The Pebblo Classifier is a BERT-based model, fine-tuned from distilbert-base-uncased, targeting RAG (Retrieve-And-Generate) applications. It classifies text into categories such as "BOARDMEETINGAGREEMENT," "CONSULTING_AGREEMENT," and others, streamlining document classification processes.

  • —Developed by: DAXA.AI
  • —Funded by: Open Source
  • —Model type: Classification model
  • —Language(s) (NLP): English
  • —License: MIT
  • —Finetuned from model: distilbert-base-uncased

Model Sources

Uses

Intended Use

The model is designed for direct application in document classification, capable of immediate deployment without additional fine-tuning.

Recommendations

End-users should be cognizant of potential biases and limitations inherent in the model. For optimal use, understanding these aspects is recommended.

How to Get Started with the Model

Use the code below to get started with the model.

python
# Import necessary libraries
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import joblib
from huggingface_hub import hf_hub_url, cached_download

# Load the tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("daxa-ai/pebblo-classifier")
model = AutoModelForSequenceClassification.from_pretrained("daxa-ai/pebblo-classifier")

# Example text
text = "Please enter your text here."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)

# Apply softmax to the logits
probabilities = torch.nn.functional.softmax(output.logits, dim=-1)

# Get the predicted label
predicted_label = torch.argmax(probabilities, dim=-1)

# URL of your Hugging Face model repository
REPO_NAME = "daxa-ai/pebblo-classifier"

# Path to the label encoder file in the repository
LABEL_ENCODER_FILE = "label_encoder.joblib"

# Construct the URL to the label encoder file
url = hf_hub_url(REPO_NAME, filename=LABEL_ENCODER_FILE)

# Download and cache the label encoder file
filename = cached_download(url)

# Load the label encoder
label_encoder = joblib.load(filename)

# Decode the predicted label
decoded_label = label_encoder.inverse_transform(predicted_label.numpy())

print(decoded_label)

Training Details

Training Data

The training dataset consists of 141,055 entries, with 21 unique labels. The labels span various document types, with instances distributed across three text sizes (128 ± x, 256 ± x, and 512 ± x words; x varies within 20). Here are the labels along with their respective counts in the dataset:

Agreement TypeInstances
BOARDMEETINGAGREEMENT4,206
CONSULTING_AGREEMENT2,965
CUSTOMERLISTAGREEMENT8,966
DISTRIBUTIONPARTNERAGREEMENT5,144
EMPLOYEE_AGREEMENT3,876
ENTERPRISE_AGREEMENT4,213
ENTERPRISELICENSEAGREEMENT8,999
EXECUTIVESEVERANCEAGREEMENT8,996
FINANCIALREPORTAGREEMENT11,384
HARMFUL_ADVICE1,887
INTERNALPRODUCTROADMAP_AGREEMENT6,982
LOANANDSECURITY_AGREEMENT8,957
MEDICAL_ADVICE3,847
MERGER_AGREEMENT7,704
NDA_AGREEMENT5,221
NORMAL_TEXT8,994
PATENTAPPLICATIONFILLINGS_AGREEMENT8,802
PRICELISTAGREEMENT8,906
SETTLEMENT_AGREEMENT3,737
SEXUAL_CONTENT8,957
SEXUALINCIDENTREPORT8,321

Evaluation

Testing Data & Metrics

Testing Data

Evaluation was performed on a dataset of 86,281 entries with a temperature range of 1-1.25 for randomness. Here are the labels along with their respective counts in the dataset:

Agreement TypeInstances
BOARDMEETINGAGREEMENT3,975
CONSULTING_AGREEMENT1,430
CUSTOMERLISTAGREEMENT4,488
DISTRIBUTIONPARTNERAGREEMENT6,696
EMPLOYEE_AGREEMENT1,310
ENTERPRISE_AGREEMENT1,501
ENTERPRISELICENSEAGREEMENT7,967
EXECUTIVESEVERANCEAGREEMENT4,795
FINANCIALREPORTAGREEMENT4,686
HARMFUL_ADVICE361
INTERNALPRODUCTROADMAP_AGREEMENT3,740
LOANANDSECURITY_AGREEMENT5,833
MEDICAL_ADVICE643
MERGER_AGREEMENT6,557
NDA_AGREEMENT1,352
NORMAL_TEXT5,811
PATENTAPPLICATIONFILLINGS_AGREEMENT5,608
PRICELISTAGREEMENT5,044
SETTLEMENT_AGREEMENT5,377
SEXUAL_CONTENT4,356
SEXUALINCIDENTREPORT4,750
Metrics
Agreement Typeprecisionrecallf1-scoresupport
BOARDMEETINGAGREEMENT0.920.950.933,975
CONSULTING_AGREEMENT0.810.850.831,430
CUSTOMERLISTAGREEMENT0.900.880.894,488
DISTRIBUTIONPARTNERAGREEMENT0.730.630.686,696
EMPLOYEE_AGREEMENT0.850.840.851,310
ENTERPRISE_AGREEMENT0.180.700.291,501
ENTERPRISELICENSEAGREEMENT0.920.780.847,967
EXECUTIVESEVERANCEAGREEMENT0.970.880.924,795
FINANCIALREPORTAGREEMENT0.930.990.964,686
HARMFUL_ADVICE0.920.940.93361
INTERNALPRODUCTROADMAP_AGREEMENT0.940.980.963,740
LOANANDSECURITY_AGREEMENT0.930.970.955,833
MEDICAL_ADVICE0.931.000.96643
MERGER_AGREEMENT0.930.450.616,557
NDA_AGREEMENT0.680.910.781,352
NORMAL_TEXT0.950.940.955,811
PATENTAPPLICATIONFILLINGS_AGREEMENT0.960.990.985,608
PRICELISTAGREEMENT0.760.790.775,044
SETTLEMENT_AGREEMENT0.760.780.775,377
SEXUAL_CONTENT0.920.970.944,356
SEXUALINCIDENTREPORT0.990.940.964,750
accuracy0.8486,280
macro avg0.850.860.8486,280
weighted avg0.880.840.8586,280
Results

The model’s performance is summarized by precision, recall, and f1-score metrics, which are detailed across all 21 labels in the dataset. Based on the test data evaluation results, the model achieved an accuracy of 0.8424, a precision of 0.8794, and a recall of 0.8424. The F1-score, which is the harmonic mean of precision and recall, stands at 0.8505.

The evaluation loss, which measures the discrepancy between the model’s predictions and the actual values, is 0.6815. Lower loss values indicate better model performance.

The model was able to process approximately 97.684 samples per second during the evaluation, which took a total runtime of 883.2545 seconds. The model performed approximately 0.764 evaluation steps per second.