aychang's picture
Add verifyToken field to verify evaluation results are produced by Hugging Face's automatic model evaluator (#2)
26ae13e
metadata
language:
  - en
license: mit
tags:
  - text-classification
datasets:
  - trec
model-index:
  - name: aychang/bert-base-cased-trec-coarse
    results:
      - task:
          type: text-classification
          name: Text Classification
        dataset:
          name: trec
          type: trec
          config: default
          split: test
        metrics:
          - type: accuracy
            value: 0.974
            name: Accuracy
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMTUwZTU1ZGU5YTRiMzNhNmQyMjNlY2M5YjAwN2RlMmYxODI2MjFkY2Q3NWFjZDg3Zjg5ZDk1Y2I1MTUxYjFhMCIsInZlcnNpb24iOjF9.GJkxJOFhsO4UaoHpHH1136Qj_fu9UQ9o3DThtT46hvMduswkgobl9iz6ICYQ7IdYKFbh3zRTlsZzjnAlzGqdBA
          - type: precision
            value: 0.9793164100816639
            name: Precision Macro
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMTMxMjI3NWZhOGZkODJmYzkxYzdhZWIwMTBkZTg4YWZiNjcwNTVmM2RjYmQ3ZmNhZjM2MWQzYTUzNzFlMjQzOCIsInZlcnNpb24iOjF9.n45s1_gW040u5f2y-zfVx_5XU-J97dcuWlmaIZsJsCetcHtrjsbHut2gAcPxErl8UPTXSq1XDg5WWug4FPM8CQ
          - type: precision
            value: 0.974
            name: Precision Micro
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiNTY5ZTZiNmYzZDQzYWZiZDdlNDllZWQ4NTVjZWZlYWJkZDgyNGNhZjAzOTZjZDc0NDUwMTE3ODVlMjFjNTIxZCIsInZlcnNpb24iOjF9.4lR7MgvxxTblEV4LZGbko-ylIeFjcjNM5P21iYH6vkNkjItIfiXmKbL55_Zeab4oGJ5ytWz0rIdlpNnmmV29Cw
          - type: precision
            value: 0.9746805065928548
            name: Precision Weighted
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZDEzYmZmZDIyNDFmNzJmODQ2ODdhYTUyYzQyZjEzZTdhMjg3MTllOGFkNGRlMDFhYzI4ZGE5OTExNjk1ZTI5OSIsInZlcnNpb24iOjF9.Ti5gL3Tk9hCpriIUhB8ltdKRibSilvRZOxAlLCgAkrhg0dXGE5f4n8almCAjbRJEaPW6H6581PhuUfjgMqceBw
          - type: recall
            value: 0.9783617516169679
            name: Recall Macro
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiNWUwMGUwYmY3MWQwOTcwYjI2Yjc3Yzc1YWQ1YjU2ODY3MzAyMDdkNmM3MmFhZmMxZWFhMTUxNzZlNzViMDA0ZiIsInZlcnNpb24iOjF9.IWhPl9xS5pqEaFHKsBZj6JRtJRpQZQqJhQYW6zmtPi2F3speRsKc0iksfHkmPjm678v-wKUJ4zyGfRs-63HmBg
          - type: recall
            value: 0.974
            name: Recall Micro
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiNjlhMDY0MmI2NzBiMWY5NTcwYjZlYzE5ODg0ODk1ZTBjZDI4YmZiY2RmZWVlZGUxYzk2MDQ4NjRkMTQ4ZTEzZiIsInZlcnNpb24iOjF9.g5p5b0BqyZxb7Hk9DayRndhs5F0r44h8TXMJDaP6IoFdYzlBfEcZv7UkCu6s6laz9-F-hhZHUZii2ljtYasVAA
          - type: recall
            value: 0.974
            name: Recall Weighted
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiYjJjNTE2ZWFjMGYyZGUzOWI3MDRhM2I2MTRjZGNkOWZkZDJhNzQ4OTYwOTQ2NDY5OGNjZTZhOWU2MzlhNTY5YyIsInZlcnNpb24iOjF9.JnRFkZ-v-yRhCf6di7ONcy_8Tv0rNXQir1TVw-cU9fNY1c4vKRmGaKmLGeR7TxpmKzEQtikb6mFwRwhIAhl8AA
          - type: f1
            value: 0.9783635353409951
            name: F1 Macro
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiYjM2NDY3MmUyMmEyZjg5MWZhNjllOGRlNWVkYzgyYmM5ZDBmMDdhYmY5NDAxZmYwMjA0YTkzNTI2MjU0NTRlZiIsInZlcnNpb24iOjF9.HlbHjJa-bpYPjujWODpvfLVMtCnNQMDBCYpLGokfBoXibZGKfIzXcgNdXLdJ-DkmMUriX3wVZtGcRvA2ErUeDw
          - type: f1
            value: 0.974
            name: F1 Micro
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiYjMxNDE4MTBmYzU2MTllMjlhNTcwYWJhMzRkNTE2ZGFiNmQ0ZTEyOWJhMmU2ZDliYTIzNDExYTM5MTAxYjcxNSIsInZlcnNpb24iOjF9.B7G9Gs74MosZPQ16QH2k-zrmlE8KCtIFu3BcrgObYiuqOz1aFURS3IPoOynVFLp1jnJtgQAmQRY_GDumSS-oDg
          - type: f1
            value: 0.97377371266232
            name: F1 Weighted
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZmEyNjRlYmE5M2U1OWY0OGY2YjQyN2E0NmQxNjY0NTY3N2JiZmMwOWQ1ZTMzZDcwNTdjNWYwNTRiNTljNjMxMiIsInZlcnNpb24iOjF9.VryHh8G_ZvoiSm1SZRMw4kheGWuI3rQ6GUVqm2uf-kkaSU20rYMW20-VKCtwayLcrIHJ92to6YvvW7yI0Le5DA
          - type: loss
            value: 0.13812002539634705
            name: loss
            verified: true
            verifyToken: >-
              eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiNjk4MDQ5NGRiNTExYmE3NGU1ZmQ1YjUzMTQ4NzUwNWViYzFiODEzMjc2MDA2MzYyOGNjNjYxYzliNDM4Y2U0ZSIsInZlcnNpb24iOjF9.u68ogPOH6-_pb6ZVulzMVfHIfFlLwBeDp8H4iqgfBadjwj2h-aO0jzc4umWFWtzWespsZvnlDjklbhhgrd1vCQ

bert-base-cased trained on TREC 6-class task

Model description

A simple base BERT model trained on the "trec" dataset.

Intended uses & limitations

How to use

Transformers
# Load model and tokenizer
from transformers import AutoModelForSequenceClassification, AutoTokenizer

model = AutoModelForQuestionAnswering.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Use pipeline
from transformers import pipeline

model_name = "aychang/bert-base-cased-trec-coarse"

nlp = pipeline("sentiment-analysis", model=model_name, tokenizer=model_name)

results = nlp(["Where did the queen go?", "Why did the Queen hire 1000 ML Engineers?"])
AdaptNLP
from adaptnlp import EasySequenceClassifier

model_name = "aychang/bert-base-cased-trec-coarse"
texts = ["Where did the queen go?", "Why did the Queen hire 1000 ML Engineers?"]

classifer = EasySequenceClassifier
results = classifier.tag_text(text=texts, model_name_or_path=model_name, mini_batch_size=2)

Limitations and bias

This is minimal language model trained on a benchmark dataset.

Training data

TREC https://huggingface.co/datasets/trec

Training procedure

Preprocessing, hardware used, hyperparameters...

Hardware

One V100

Hyperparameters and Training Args

from transformers import TrainingArguments

training_args = TrainingArguments(
    output_dir='./models',
    num_train_epochs=2,
    per_device_train_batch_size=16,
    per_device_eval_batch_size=16,
    warmup_steps=500,
    weight_decay=0.01,
    evaluation_strategy="steps",
    logging_dir='./logs',
    save_steps=3000
)

Eval results

{'epoch': 2.0,
 'eval_accuracy': 0.974,
 'eval_f1': array([0.98181818, 0.94444444, 1.        , 0.99236641, 0.96995708,
        0.98159509]),
 'eval_loss': 0.138086199760437,
 'eval_precision': array([0.98540146, 0.98837209, 1.        , 0.98484848, 0.94166667,
        0.97560976]),
 'eval_recall': array([0.97826087, 0.90425532, 1.        , 1.        , 1.        ,
        0.98765432]),
 'eval_runtime': 1.6132,
 'eval_samples_per_second': 309.943}