pii-tool-bundle / README.md
lianghsun's picture
Upload folder using huggingface_hub
cd05e6e verified
|
Raw
History Blame Contribute Delete
2.54 kB
metadata
license: apache-2.0
language:
  - zh
tags:
  - token-classification
  - pii
  - privacy
  - traditional-chinese
pipeline_tag: token-classification

privacy-filter-tw — 部署 bundle

Fine-tuned openai/privacy-filter 用於台灣 PII 去識別化的完整部署包。 含權重 + Docker images + 執行腳本,可離線在 CPU 或 CUDA GPU 上跑。

受管控 Repo(Manual Review):申請存取後由 owner 手動核准。


內容

檔案 大小 說明
model/ 2.6 GB v3 fine-tuned checkpoint (OPF-native format)
ntts_cpu_amd64.tar 320 MB Docker image (CPU-only, python:3.11-slim + torch cpu)
ntts_cuda_amd64.tar 4.0 GB Docker image (pytorch/pytorch:2.7.0-cuda12.8-cudnn9)
notes-scratch-2026/ 工具 code:main.py, runtime.py, chunker.py, Dockerfiles
debs/ python3-venv + 7zip .deb (Ubuntu 22.04/24.04) 供離線裝
RUN.sh 一鍵執行腳本(自動偵測 CPU/GPU)
pii_categories.md 19 類 PII 定義與準確度分佈

快速開始(Ubuntu 機器)

# 假設下載後放到 /home/ubuntu/pii_tool/
cd /home/ubuntu/pii_tool

# 載入 Docker image (擇一)
sudo docker load -i ntts_cuda_amd64.tar   # GPU
# 或
sudo docker load -i ntts_cpu_amd64.tar    # CPU

# 準備輸入資料在 /home/ubuntu/YOUR_INPUT_DIR/ (遞迴掃描 *.txt)

# 跑
sudo docker run --rm --gpus all \
  -v /home/ubuntu/YOUR_INPUT_DIR:/data \
  -v $(pwd)/model:/model \
  ntts:cuda /data \
    --model-dir /model \
    --chunk-size 1000 \
    --overlap 200

輸出:每個 <name>.txt → 同資料夾產生 <name>_masked.txt


CLI 參數

Flag Default 說明
<input_dir> 必填 遞迴掃描 *.txt
--model-dir DIR (none) 本地 model 路徑(離網必用)
--chunk-size N 1000 Chunk 字元數
--overlap N 200 Chunk 重疊
--no-propagate off 關閉全域 entity 傳播
--gpus auto|N|0 auto 多卡並行;0 強制 CPU

相關資源

License

Apache 2.0(繼承自 openai/privacy-filter)。