Downloads · 30 days
4
11% of all-time downloads
akaraangov/bggpt-gdpr-lora-v2
bggpt-gdpr-lora-v2 is a text generation model from akaraangov. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as gemma.
A LoRA adapter for INSAIT-Institute/BgGPT-Gemma-3-4B-IT, fine-tuned to detect and mask personal data (PII) in free-form Bulgarian text and return the result as structured JSON.
Downloads · 30 days
4
11% of all-time downloads
All-time downloads
35
Public
Repo size
99.1 MB
Likes
0
Public
Click a slice to open those files.
.safetensors65.7 MB · 66%
From the Hugging Face model README
A LoRA adapter for INSAIT-Institute/BgGPT-Gemma-3-4B-IT, fine-tuned to detect and mask personal data (PII) in free-form Bulgarian text and return the result as structured JSON.
It is the AI component of a larger hybrid anonymizer that pairs this model with a deterministic regex + checksum layer (for ЕГН, IBAN, phone, email). 👉 Full project & code: https://github.com/akaraangov/bg-gdpr-anonymizer
Given Bulgarian text, the model returns JSON like:
{
"masked_text": "Казвам се [ИМЕ], живея в [ГРАД] на [АДРЕС].",
"extracted_entities": {"ИМЕ": ["..."], "ГРАД": ["..."], "АДРЕС": ["..."]}
}
Tags: ИМЕ, ГРАД, АДРЕС, ЕГН, IBAN, ТЕЛЕФОН, ИМЕЙЛ, РЕГ_НОМЕР.
In the hybrid pipeline the model focuses on names, cities and addresses, while IDs with a checksum (ЕГН, IBAN) and strict-format data (phone, email) are handled by the deterministic regex layer.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
BASE = "INSAIT-Institute/BgGPT-Gemma-3-4B-IT" # or unsloth/gemma-3-4b-it
ADAPTER = "akaraangov/bggpt-gdpr-lora-v2"
tok = AutoTokenizer.from_pretrained(ADAPTER)
base = AutoModelForCausalLM.from_pretrained(BASE, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, ADAPTER).eval()
sys = ("Ти си асистент за анонимизация на лични данни (PII) в български текст "
"съгласно GDPR. Връщаш само валиден JSON с полета \"masked_text\" и "
"\"extracted_entities\".")
text = "Анонимизирай следния български текст по GDPR стандарти: 'Иван Петров от Пловдив се обади.'"
msgs = [{"role": "user", "content": sys + "\n\n" + text}]
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, tokenize=True,
return_dict=True, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Governed by the Gemma Terms of Use (inherited from the base model). Project code is MIT-licensed.