generated_from_trainer

flan-t5-base-cnn-samsum-lora

This model is a fine-tuned version of braindao/flan-t5-cnn on the samsum dataset.

The base model braindao/flan-t5-cnn is a fine-tuned verstion of google/flan-t5-base on the cnn_dailymail 3.0.0 dataset.

Model API Spaces

Please visit HF Spaces sooolee/summarize-transcripts-gradio for Gradio API. This API takes YouTube 'Video_ID' as the input.

Model description

Intended uses & limitations

Summarize transcripts such as YouTube transcripts.

Training and evaluation data

Training hyperparameters

The following hyperparameters were used during training:

Training results

How to use

Note 'max_new_tokens=60' is used in the below example to control the length of the summary. FLAN-T5 model has max generation length = 200 and min generation length = 20 (default).

import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

# Load peft config for pre-trained checkpoint etc.
peft_model_id = "sooolee/flan-t5-base-cnn-samsum-lora"
config = PeftConfig.from_pretrained(peft_model_id)

# load base LLM model and tokenizer
model = AutoModelForSeq2SeqLM.from_pretrained(config.base_model_name_or_path, device_map='auto') # load_in_8bit=True, 
tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)

# Load the Lora model
model = PeftModel.from_pretrained(model, peft_model_id, device_map='auto')

# Tokenize the text inputs
texts = "<e.g. Part of YouTube Transcript>"
inputs = tokenizer(texts, return_tensors="pt", padding=True, ) # truncation=True

# Make inferences
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
with torch.no_grad():    
    output = self.model.generate(input_ids=inputs["input_ids"].to(device), max_new_tokens=60, do_sample=True, top_p=0.9)
    summary = self.tokenizer.batch_decode(output.detach().cpu().numpy(), skip_special_tokens=True)

summary

Framework versions

Other

Please check out the BART-Large-CNN-Samsum model fine-tuned for the same purpose: sooolee/bart-large-cnn-finetuned-samsum-lora