Views
No views yet
Research Paper ──► [ProphetNet-Large-Summarization] ──► Summary ──► [ProphetNet-Large-Story-Generation] ──► Story| Parameter | Value |
|---|---|
| Base model | microsoft/prophetnet-large-uncased |
| Task | Summarization |
| Max input length | 2048 tokens |
| Max target length | 256 tokens |
| Learning rate | 3e-5 |
| Batch size | 2 |
| Gradient accumulation steps | 4 |
| Warmup steps | 1500 |
| Weight decay | 0.01 |
| Fine-tuning method | LoRA (r=16, alpha=64, targets: query_proj, value_proj) |
| Quantization | 4-bit NF4 (bitsandbytes) |
1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
3tokenizer = AutoTokenizer.from_pretrained("harsharajkumar273/ProphetNet-Large-Summarization")
4model = AutoModelForSeq2SeqLM.from_pretrained("harsharajkumar273/ProphetNet-Large-Summarization")
5
6text = "Your research paper section here..."
7word_count = len(text.split())
8prompt = f"Summarize this part of the research paper to less than {word_count // 10} words:\n{text}"
9
10inputs = tokenizer(prompt, return_tensors="pt", max_length=2048, truncation=True)
11outputs = model.generate(**inputs, max_length=256, num_beams=4)
12summary = tokenizer.decode(outputs[0], skip_special_tokens=True)
13print(summary)