Model Card for Model ID

Source code: Google Colab

Model Details

Model Description

Can do abstractive summarization of legal/contractual documents. Fine tuned on BART-LARGE-CNN.

Uses

  • Abstractive summarization for legal docs (Banking, Legal, Contractual, etc.)

Sample Usage

Load model config and safetensors:

from transformers import BartForConditionalGeneration, BartTokenizer
import torch


model_name = "siddheshtv/bart-multi-lexsum"

model = BartForConditionalGeneration.from_pretrained(model_name)
tokenizer = BartTokenizer.from_pretrained(model_name)

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = model.to(device)

Generate Summary Function

def generate_summary(model, tokenizer, text, max_length=512):
    device = next(model.parameters()).device
    inputs = tokenizer.encode("summarize: " + text, return_tensors="pt", max_length=1024, truncation=True)
    inputs = inputs.to(device)
    summary_ids = model.generate(
        inputs,
        max_length=max_length,
        min_length=40,
        length_penalty=2.0,
        num_beams=4,
        early_stopping=True,
        no_repeat_ngram_size=3,
        forced_bos_token_id=0,
        forced_eos_token_id=2
    )
    summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
    return summary

Generate summary

generated_summary = generate_summary(model, tokenizer, example_text)
print("Generated Summary:")
print(generated_summary)

Training Data

Downloads last month
118
Safetensors
Model size
406M params
Tensor type
F32
·
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.