Downloads · 30 days
16
22% of all-time downloads
yousefg/Academ-0.5
Academ-0.5 is a summarization model from yousefg. Use it when you need a shorter version of a longer text. It is set up for transformers. The card lists the license as mit.
Academ is a fine-tuned BART model for summarizing academic lectures.
Downloads · 30 days
16
22% of all-time downloads
All-time downloads
74
Public
Parameters
408M
3.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.onnx1.8 GB · 53%
From the Hugging Face model README
Academ is a fine-tuned BART model for summarizing academic lectures.
To find out how the model was fine-tuned, you can check the notebook on Kaggle: https://www.kaggle.com/code/yousefr/college-lectures-summarization-bart-unsupervised/
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
Use the code below to get started with the model.
from transformers import BartForConditionalGeneration, AutoTokenizer
model = BartForConditionalGeneration.from_pretrained('yousefg/Academ-0.5')
tokenizer = AutoTokenizer.from_pretrained('facebook/bart-large-cnn')
def get_summary(input_ids, attention_mask, context_length):
summaries = []
for i in range(0, input_ids.shape[1], context_length):
input_slice = input_ids[:, i:i + context_length] if i + context_length <= input_ids.size(1) else input_ids[:, i:]
attention_mask_slice = attention_mask[:, i:i + context_length] if i + context_length <= attention_mask.size(1) else attention_mask[:, i:]
summary = model.generate(input_slice, attention_mask = attention_mask_slice, max_new_tokens = 1654, min_new_tokens = 250, do_sample = True, renormalize_logits = True)
summaries.extend(summary[0].tolist())
summaries = tokenizer.decode(summaries, skip_special_tokens = True)
return summaries
batch = tokenizer(texts, truncation = False) # make sure to get the transcript from the lecture
input_ids = torch.tensor(batch['input_ids']).unsqueeze(0).to(device)
attention_mask = torch.tensor(batch['attention_mask']).unsqueeze(0).to(device)
summary = get_summary(input_ids, attention_mask, 1654)
print(summary)
The model's training used a custom loss function for getting the model into an optimal length (35% chosen as the optimal length).
The evaluation is based on ROUGE 1 with a change of discounting padding tokens.
The model's test dataset had 289 lectures, mainly from MIT OpenCourseWare.
<!-- This should link to a Dataset Card if possible. -->The model achieved 96% accuracy for ROUGUE 1 in the test dataset, and 93% in the evaluation dataset.
Academ is a summarization model trained on 2307 lectures, mainly from MIT OpenCourseWare. The model has a max sequence length of 1654, increasing 630 tokens from the original model.