Instructions to use mlx-community/openai-privacy-filter-5bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/openai-privacy-filter-5bit with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download mlx-community/openai-privacy-filter-5bit --local-dir openai-privacy-filter-5bit
- Transformers.js
How to use mlx-community/openai-privacy-filter-5bit with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('token-classification', 'mlx-community/openai-privacy-filter-5bit'); - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
|
Download README.md from mlx-community/openai-privacy-filter-5bit: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/mlx-community/openai-privacy-filter-5bit/resolve/main/README.md
- Command line
-
hf download hf://mlx-community/openai-privacy-filter-5bit/README.md
-
curl -L -o README.md https://huggingface.co/mlx-community/openai-privacy-filter-5bit/resolve/main/README.md
1.57 kB
metadata
license: apache-2.0
pipeline_tag: token-classification
library_name: mlx
base_model: openai/privacy-filter
tags:
- transformers.js
- mlx
- mlx-embeddings
mlx-community/openai-privacy-filter-5bit
The Model mlx-community/openai-privacy-filter-5bit was converted to MLX format from openai/privacy-filter using mlx-embeddings version 0.1.1.
openai/privacy-filter is a bidirectional 1.5B-parameter / 50M-active sparse-MoE token classifier that tags personally identifiable information (PII) with BIOES spans over 8 categories (person, email, phone, URL, address, date, account number, secret).
Use with mlx
pip install mlx-embeddings
from itertools import groupby
import mlx.core as mx
from mlx_embeddings.utils import load
model, tokenizer = load("mlx-community/openai-privacy-filter-5bit")
id2label = model.config.id2label
text = "My name is Alice Smith and my email is alice@example.com. Phone: 555-1234."
inputs = tokenizer(text, return_tensors="mlx")
outputs = model(inputs["input_ids"], attention_mask=inputs["attention_mask"])
preds = mx.argmax(outputs.logits, axis=-1)[0].tolist()
entity = lambda p: id2label[str(p)].split("-", 1)[-1] if id2label[str(p)] != "O" else None
for ent, group in groupby(zip(inputs["input_ids"][0].tolist(), preds), key=lambda x: entity(x[1])):
if ent:
span = tokenizer.decode([tid for tid, _ in group]).strip()
print(f"{ent:18s} -> {span!r}")