hf_mirrors/T5-base-finetuned-cuad
Model Introduction
Files & versions
Analysis

T5-base fine-tuned on CUAD for Legal Contract Review (via QA)

This model is a fine-tuned version of t5-base on the cuad dataset. It achieves the following results on the evaluation set:

  • Loss: 0.2209

how to use

from openmind import pipeline
from openmind import is_torch_npu_available
import torch
import argparse
import torch.nn.functional as F
import time

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--model_name_or_path",
        type=str,
        help="Path to model",
        default="zhouhui/T5-base-finetuned-cuad",
    )
    args = parser.parse_args()
    return args

def main():
    args = parse_args()
    model_path = args.model_name_or_path

    if is_torch_npu_available():
        device = "npu:0"
    else:
        device = "cpu"   
    #device = "cpu"
    start_time = time.time()
    generator = pipeline('text2text-generation', model= model_path , device=device,trust_remote_code=True)
    output = generator("They were there to enjoy us and they were there to pray for us.", do_sample=True, min_length=50)
    print(f">>>output={output}")
    end_time = time.time()
    print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")

if __name__ == "__main__":
    main()

Model description

More information needed

Intended uses & limitations

More information needed

Training and evaluation data

More information needed

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 5e-05
  • train_batch_size: 4
  • eval_batch_size: 4
  • seed: 42
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • num_epochs: 10

Training results

Training LossEpochStepValidation Loss
0.28091.027950.2331
0.24592.055900.2253
0.23553.083850.2220
0.22124.0111800.2203
0.20685.0139750.2197
0.20856.0167700.2194
0.19687.0195650.2199
0.19068.0223600.2200
0.19099.0251550.2208
0.178810.0279500.2209

Framework versions

  • Transformers 4.16.0.dev0
  • Pytorch 1.10.0+cu111
  • Datasets 1.17.0
  • Tokenizers 0.10.3