Downloads · 30 days
0
GloriaABK1/normistral-7b-warm-norsumm
normistral-7b-warm-norsumm is a summarization model from GloriaABK1. Use it when you need a shorter version of a longer text. It is set up for transformers.
A QLoRA fine-tune of norallm/normistral-7b-warm for abstractive summarization of Norwegian text. Given structured sentiment snippets extracted from book reviews, the model produces a fluent 3-5 sentence Norwegian pros…
Downloads · 30 days
0
Access
Public
Updated Jun 25, 2026
Repo size
877 MB
Likes
0
Public
Click a slice to open those files.
.safetensors877 MB · 100%
From the Hugging Face model README
A QLoRA fine-tune of norallm/normistral-7b-warm for abstractive summarization of Norwegian text. Given structured sentiment snippets extracted from book reviews, the model produces a fluent 3-5 sentence Norwegian prose summary of reader reception.
Generate abstractive summaries of Norwegian text. The model expects the prompt format below and outputs a short prose paragraph in Norwegian.
Originally built as part of an end-to-end Norwegian book review summarization pipeline:
The adapter can also be loaded on top of the base model for general Norwegian summarization tasks.
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16,
)
repo = "GloriaABK1/normistral-7b-warm-norsumm"
model = AutoModelForCausalLM.from_pretrained(
repo,
quantization_config=bnb_config,
device_map="auto",
low_cpu_mem_usage=True,
)
tokenizer = AutoTokenizer.from_pretrained(repo)
model.eval()
def summarize(text: str) -> str:
prompt = (
"### Instruksjon:\n"
"Du er en bokanmeldelsessammendragsgenerator. Gjor om folgende "
"Leserne likte- og Leserne mislikte-tagger til et 3-5 setningers "
"sammendrag pa norsk.\n\n"
f"### Inndata:\n{text}\n\n### Sammendrag:"
)
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=600).to(model.device)
inputs.pop("token_type_ids", None)
with torch.inference_mode():
out = model.generate(
**inputs,
max_new_tokens=120,
num_beams=4,
length_penalty=3.0,
no_repeat_ngram_size=3,
early_stopping=True,
)
return tokenizer.decode(out[0], skip_special_tokens=True).split("### Sammendrag:")[-1].strip()
text = "Leserne likte: historien, karakterene, språket. Leserne mislikte: slutten, tempoet."
print(summarize(text))
Fine-tuned on SamiaT/NorSumm, a Norwegian
summarization dataset with both Bokmål (nb) and Nynorsk (nn) subsets. Both subsets were
merged and shuffled before training. The validation split was further divided 80/20 to create
a dedicated validation set for early stopping.
| Split | Rows (approx.) |
|---|---|
| Train | ~48 |
| Validation | ~12 |
| Test | ~60 |
Each example consists of a Norwegian article and one or more reference summaries.
The summaries column was exploded so each (article, summary) pair forms its own training row.
Method: QLoRA - 4-bit quantized base model with LoRA adapters trained in bf16.
| Hyperparameter | Value |
|---|---|
| Training regime | bf16 mixed precision |
| LoRA rank (r) | 32 |
| LoRA alpha | 64 |
| LoRA dropout | 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj, lm_head |
| Quantization | 4-bit NF4 |
| Optimizer | paged_adamw_8bit |
| Learning rate | 1e-5 |
| LR scheduler | constant |
| Warmup ratio | 0.03 |
| Epochs | 4 (early stopping patience = 1 on eval ROUGE-L) |
| Per-device batch size | 4 |
| Gradient accumulation steps | 2 |
| Max gradient norm | 0.3 |
| Weight decay | 0.001 |
| Max input length | 512 tokens |
| Max target length | 120 tokens |
Evaluated on the NorSumm test split using ROUGE-L F1, computed with the evaluate library.
Early stopping during training used ROUGE-L on the validation set.
The model was also applied to the Bokelskere.no book review corpus and ROUGE-L was computed against aggregated review text as a pseudo-reference, providing a domain-specific quality signal.
| Metric | Value |
|---|---|
| ROUGE-L F1 (NorSumm test) | see trainer.evaluate() output in training notebook |
Use this model as part of a pipeline where inputs are pre-processed and validated. Do not use for summarizing personally identifiable information without appropriate data governance controls. Evaluate outputs with human review before any production deployment.
Causal language model (Mistral-7B architecture) with LoRA adapters on all attention projection
layers and MLP gate/up/down projections plus the LM head. Base weights are frozen and loaded
in 4-bit NF4 quantization via bitsandbytes. Only the LoRA adapter weights are trained.
Objective: Next-token prediction on (prompt + summary) sequences; the prompt portion is not masked during loss computation (SFTTrainer default).
Google Colab A100 (40 GB HBM2)
transformers (HuggingFace)peft (LoRA implementation)trl (SFTTrainer)bitsandbytes (4-bit quantization)evaluate (ROUGE-L metrics)