|
--- |
|
license: mit |
|
pipeline_tag: text-generation |
|
datasets: |
|
- EdinburghNLP/xsum |
|
language: |
|
- en |
|
base_model: |
|
- facebook/bart-large-xsum |
|
--- |
|
# fine-tuned-bart-xsum |
|
|
|
## Overview |
|
|
|
**fine-tuned-bart-xsum** is a fine-tuned version of the facebook/bart-large-xsum model specifically tailored for narrative text generation from given prompts. This model was trained on the xsum dataset, focusing on generating coherent and contextually appropriate text. |
|
|
|
## Model Details |
|
|
|
- **Model Type:** facebook/bart-large-xsum |
|
- **Training Dataset:** XSum (news summary dataset) |
|
- **Training Process:** |
|
- Optimized for efficiency with batch processing, mixed precision training, and dynamic padding. |
|
- Trained over 3 epochs with learning rate adjustments and evaluation every 500 steps. |
|
|
|
## Usage |
|
import torch |
|
|
|
# Check if a GPU is available |
|
device = torch.device("cuda" if torch.cuda.is_available() else "cpu") |
|
|
|
# Move the model to the device |
|
model.to(device) |
|
input_text = "tell me joke with bbc" |
|
input_ids = tokenizer(input_text, return_tensors="pt").input_ids |
|
input_ids = input_ids.to(device) |
|
|
|
# Generate summary |
|
output = model.generate(input_ids, max_length=50, num_beams=4, early_stopping=True) |
|
|
|
generated_summary = tokenizer.decode(output[0], skip_special_tokens=True) |
|
|
|
print(generated_summary) |
|
|
|
To use this model for text generation: |