Downloads · 30 days
47
17% of all-time downloads
thiagoambiel/sonar_municipal_ptt5_ementa2action
sonar_municipal_ptt5_ementa2action is a summarization model from thiagoambiel. Use it when you need a shorter version of a longer text. It is set up for transformers. The card lists the license as apache-2.0.
T5 model (PTT5 base, 220M params) fine-tuned for semantic textualization of Brazilian municipal legislative bill summaries (ementas) into a direct, imperative action form (ação). Fine-tuned with LoRA (PEFT) and distri…
Downloads · 30 days
47
17% of all-time downloads
All-time downloads
283
Public
Parameters
223M
1.7 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors559 MB · 99%
How the weights are stored.
F16166M · 75%
From the Hugging Face model README
T5 model (PTT5 base, 220M params) fine-tuned for semantic textualization of Brazilian municipal legislative bill summaries (ementas) into a direct, imperative action form (ação). Fine-tuned with LoRA (PEFT) and distributed as a merged checkpoint — no peft dependency required at inference time. Base: unicamp-dl/ptt5-base-portuguese-vocab (Apache-2.0).
Companion to the ICMC-USP undergraduate thesis "Mineração de Dados e Busca Semântica Aplicadas à Análise de Projetos de Lei Municipais" (Sonar Municipal project). Archival mirror with DOI: 10.5281/zenodo.20564326.
Converts Portuguese municipal bill ementas into action-form summaries suitable for semantic search, policy diffusion analysis, and topic clustering. Key behaviors learned during fine-tuning:
E DÁ OUTRAS PROVIDÊNCIAS, Dispõe sobre, Autoriza o Poder Executivo a, etc.).MUNICÍPIO DE MARABÁ → município), except where the locale is policy-relevant (e.g., bairro São Félix preserved).| Attribute | Value |
|---|---|
| Developed by | Thiago Ambiel (ICMC-USP) |
| Supervised by | Prof. André C. P. L. F. de Carvalho (ICMC-USP) |
| Supported by | AI4PEP — Artificial Intelligence for Public Health Emergency Preparedness network (acknowledgement only; no structured grant identifier) |
| Model type | T5 seq2seq (merged LoRA fine-tune; distributed as full checkpoint) |
| Language | Portuguese (pt-BR) |
| License | Apache-2.0 (inherits from base PTT5) |
| Finetuned from | unicamp-dl/ptt5-base-portuguese-vocab (220M params) |
| Tokenizer | Redistributed verbatim from the base under Apache-2.0 |
import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, GenerationConfig
torch.manual_seed(42)
REPO = "thiagoambiel/sonar_municipal_ptt5_ementa2action"
INSTR_PROMPT = (
"Converta a ementa de projeto de lei em uma recomendação de ação "
"imperativa, curta e fiel ao texto; {texto}\nSaída:"
)
model = AutoModelForSeq2SeqLM.from_pretrained(REPO).eval()
tokenizer = AutoTokenizer.from_pretrained(REPO)
gen_config = GenerationConfig.from_pretrained(REPO) # generation_config.json
ementa = "DISPÕE SOBRE A IMPLANTAÇÃO DE ESTUFAS COM HORTAS PRODUZIDAS COM GARRAFAS PET NAS ESCOLAS MUNICIPAIS DE MARABÁ E DA OUTRAS PROVIDÊNCIAS."
prompt = INSTR_PROMPT.format(texto=ementa.lower())
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=256)
out = model.generate(**inputs, generation_config=gen_config)
print(tokenizer.decode(out[0], skip_special_tokens=True))
# → "Instalar estufas com hortas produzidas com garrafas pet nas escolas municipais."
A complete inference_example.py is bundled in this repo.
Real pairs from the published 241k corpus, showcasing the learned behaviors:
| Ementa (input) | Ação (output) |
|---|---|
DISPÕE SOBRE A IMPLANTAÇÃO DE ESTUFAS COM HORTAS PRODUZIDAS COM GARRAFAS PET NAS ESCOLAS MUNICIPAIS DE MARABÁ E DA OUTRAS PROVIDÊNCIAS. | Instalar estufas com hortas produzidas com garrafas pet nas escolas municipais. |
INSTITUI A INCLUSÃO DA LÍNGUA BRASILEIRA DE SINAIS – LIBRAS, NO CURRÍCULO ESCOLAR NO ÂMBITO DA REDE MUNICIPAL DE EDUCAÇÃO DO MUNICÍPIO DE MARABÁ E DÁ OUTRAS PROVIDÊNCIAS. | Incluir a Língua Brasileira de Sinais (LIBRAS) no currículo escolar da rede municipal de ensino. |
AUTORIZA O PODER EXECUTIVO A INSTITUIR TARIFA ZERO PARA O TRANSPORTE COLETIVO URBANO NO MUNICÍPIO, E DÁ OUTRAS PROVIDÊNCIAS | Implantar tarifa zero para o transporte coletivo urbano no município. |
Dispõe sobre a implementação do programa de castração de cães e gatos por meio de Unidade Móvel (Castramóvel) no Município de Marabá, Estado do Pará, visando o controle populacional e a promoção da saúde animal. | Implementar programa de castração de cães e gatos por meio de unidade móvel (Castramóvel) no município. |
A full table of 16 canonical examples is in the Zenodo bundle (MODEL_CARD.md). 20 additional examples for regression testing are in examples/ementas.jsonl paired with examples/expected_outputs.jsonl.
thiagoambiel/sonar-municipal-pl-actions and the dataset DOI for full provenance.42).| Hyperparameter | Value |
|---|---|
| Optimizer | AdamW |
| Learning rate | 3e-4 |
| Scheduler | Cosine with 3% warmup |
| Batch size | 16 × gradient_accumulation 2 (effective 32) |
| Epochs | 30 |
| Weight decay | 0.01 |
| Seed | 42 |
| Mixed precision | bf16 |
| LoRA rank (r) | 16 |
| LoRA alpha (α) | 32 |
| LoRA dropout | 0.05 |
| LoRA target modules | q, v, k, o, wi, wo |
| Quantization | 4-bit NF4 with double-quantization |
| Trainable params | ≈ 6.5M (~2.95% of 220M) |
The public training notebook (shipped in the source-code companion) demonstrates the pipeline on a smaller subset (~835 pairs, 752/83 split) due to free-tier GPU constraints on Colab/Kaggle. The model published here was trained on the full 999/900-99 set.
42).pt).Surface-overlap metrics (ROUGE-L, BLEU) are deliberately not reported: the task is paraphrase-style rewriting, for which n-gram overlap is a weak proxy. BERTScore is the single appropriate metric here.
The LoRA fine-tune ran ≈ 17 min on a single NVIDIA Tesla T4 (~2.42×10¹⁸ FLOPs, 30 epochs): estimated ≈ 0.02–0.03 kWh, ≈ 0.01 kgCO₂eq — a negligible footprint for parameter-efficient fine-tuning (estimated via the ML CO2 Impact methodology).
@software{ambiel_sonar_municipal_model_2026,
title = {Sonar Municipal PTT5 base fine-tuned (LoRA, merged) for ementa-to-action textualization},
author = {Ambiel, Thiago},
year = 2026,
publisher = {Zenodo},
doi = {10.5281/zenodo.20564326},
version = {1.0.0},
note = {Mirror on Hugging Face Hub: thiagoambiel/sonar\_municipal\_ptt5\_ementa2action.}
}
ABNT NBR 6023 (PT-BR):
AMBIEL, Thiago. Sonar Municipal: PTT5 base ajustado (LoRA, mergeado) para textualização ementa→ação (versão 1.0.0). [Modelo]. Zenodo, 2026. DOI: 10.5281/zenodo.20564326.
This model was developed with support from the AI4PEP network (Artificial Intelligence for Public Health Emergency Preparedness), funded by the International Development Research Centre (IDRC, Canada). Special thanks to Prof. André C. P. L. F. de Carvalho (ICMC-USP) for academic supervision, and to Unicamp-DL for the open release of the base PTT5 model.
Tokenizer files in this repository are redistributed verbatim from unicamp-dl/ptt5-base-portuguese-vocab (Apache-2.0).
Thiago Ambiel — [email protected]