Token Classification
Transformers
Safetensors
PyTorch
English
French
sixmonth_redact
feature-extraction
de-identification
deidentification
redaction
hipaa
phi
pii
clinical-notes
medical
dental
privacy
beta
cpu
custom_code
Eval Results (legacy)
Instructions to use sixmonth-ai/sixmonth-redact with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sixmonth-ai/sixmonth-redact with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="sixmonth-ai/sixmonth-redact", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("sixmonth-ai/sixmonth-redact", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download tests/test_examples.py from sixmonth-ai/sixmonth-redact: direct link, hf CLI and curl.
- Browser
- Download file 950 Bytes
-
https://huggingface.co/sixmonth-ai/sixmonth-redact/resolve/main/tests/test_examples.py
- Command line
-
hf download hf://sixmonth-ai/sixmonth-redact/tests/test_examples.py
-
curl -L -o test_examples.py https://huggingface.co/sixmonth-ai/sixmonth-redact/resolve/main/tests/test_examples.py
950 Bytes
| """Checks that the documented examples behave as described. | |
| python tests/test_examples.py | |
| """ | |
| import os | |
| from transformers import AutoModel | |
| ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| model = AutoModel.from_pretrained(ROOT, trust_remote_code=True).eval() | |
| cases = [ | |
| ("Called Mrs Johnson re: appt on March 3rd. Pt c/o pain #19. Policy no. BC-44817203.", | |
| "Called Mrs [REDACTED] re: appt on [REDACTED]. Pt c/o pain #19. Policy no. [REDACTED]."), | |
| ("Call +1 (415) 555-0100 or (617)555-0144. See https://myclinic.example.com/p/8842", | |
| "Call [REDACTED] or [REDACTED]. See [REDACTED]"), | |
| ] | |
| for text, want in cases: | |
| got = model.redact(text) | |
| assert got == want, f"\n got: {got}\nwant: {want}" | |
| for keep in ["Amoxicillin 500mg", "#14", "RCT", "tid"]: | |
| assert keep in model.redact("Rx Amoxicillin 500mg tid, #14 RCT."), keep | |
| assert sum(p.numel() for p in model.parameters()) == 5_773_706 | |
| print("examples ok") | |