Text Generation
Transformers
PyTorch
Safetensors
English
llama
text-generation-inference
trl
conversational
Instructions to use mlninad/PII-Shield with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlninad/PII-Shield with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlninad/PII-Shield") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mlninad/PII-Shield") model = AutoModelForCausalLM.from_pretrained("mlninad/PII-Shield", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mlninad/PII-Shield with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlninad/PII-Shield" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlninad/PII-Shield", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mlninad/PII-Shield
- SGLang
How to use mlninad/PII-Shield with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "mlninad/PII-Shield" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlninad/PII-Shield", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "mlninad/PII-Shield" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlninad/PII-Shield", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mlninad/PII-Shield with Docker Model Runner:
docker model run hf.co/mlninad/PII-Shield
metadata
tags:
- text-generation-inference
- transformers
- llama
- trl
license: apache-2.0
language:
- en
base_model:
- meta-llama/Llama-3.2-3B-Instruct
๐ก๏ธ PII-Shield
Your Intelligent Guardian for Personal Data Protection
๐ What is PII-Shield?
PII-Shield is your cutting-edge solution for protecting sensitive information in text data. Powered by advanced transformer architecture, it's your first line of defense against unintended PII exposure.
๐ฏ Core Capabilities
๐ Smart Detection
"Regular text with sarah.smith@email.com" โ "Regular text with [EMAIL_1]"
๐ญ Intelligent Masking
"Call John at (555) 123-4567" โ "Call [PERSON_1] at [PHONE_1]"
๐ Structured Mapping
Original โ Masked โ JSON Mapping
๐ Model Architecture
๐ง Two-Stage Intelligence
โก Supported PII Categories
| Category | Icon | Example |
|---|---|---|
| Names | ๐ค | John Smith |
| Emails | ๐ง | user@domain.com |
| Phones | ๐ฑ | (555) 123-4567 |
| Addresses | ๐ | 123 Privacy St |
| SSN | ๐ข | XXX-XX-XXXX |
| Credit Cards | ๐ณ | XXXX-XXXX-XXXX |
| DOB | ๐ | MM/DD/YYYY |
| IPs | ๐ | 192.168.1.1 |
๐ซ How It Works
๐ฏ Detection Phase
def detect_pii(text: str) -> List[Entity]:
"""
๐ Intelligent PII detection
Returns list of identified entities
"""
pass
๐ญ Masking Phase
def mask_pii(text: str, entities: List[Entity]) -> Dict:
"""
๐ก๏ธ Smart PII masking
Returns masked text and mapping
"""
pass
๐ฎ Input/Output
๐ฅ Input Format
{
"text": "Your sensitive text here",
"options": {
"mask_format": "[TYPE_INDEX]",
"return_mapping": true
}
}
๐ค Output Format
{
"masked_text": "Your [TYPE_1] text here",
"pii_mapping": [
{
"label": "TYPE",
"value": "sensitive",
"index": 1
}
]
}
๐ฆ Performance Stats
| Metric | Score | Trend |
|---|---|---|
| Precision | 98.5% | โฌ๏ธ |
| Recall | 97.8% | โฌ๏ธ |
| Speed | 2ms/req | โฌ๏ธ |
| Accuracy | 99.1% | โก๏ธ |
๐ ๏ธ Technical Requirements
- ๐ฅ๏ธ CUDA-capable GPU
- ๐พ 8GB+ VRAM
- ๐ Python 3.8+
- ๐ง PyTorch 2.0+
๐ Security First
๐ฏ Best Practices
- ๐ Never store raw PII
- ๐พ Process in-memory only
- ๐งน Clear cache regularly
- ๐ Enable access logging
- ๐ Regular updates
โ ๏ธ Known Limitations
- ๐ Max 2048 tokens
- ๐ฃ๏ธ English-primary
- ๐ก Domain adaptation needed
- ๐พ GPU memory bound
๐ License
Apache License 2.0 โข Made with โค๏ธ for Privacy
๐ค Support & Community
- ๐ฌ LinkedIn
- ๐ง Email Support

