Skip to main content

Glimo HSD privacy-preserving CSV pipeline for harmful-speech datasets.

Project description

glimo-hsd

Reusable Python package for the Glimo / PrivHSD backend pipeline. The package processes CSV files into privacy-scrubbed, classifier-ready, optionally restated outputs while keeping model weights outside the PyPI wheel.

Install

pip install glimo-hsd
pip install "glimo-hsd[hf]"  # Transformers / torch classifier support

Python API

from glimo_hsd import PipelineConfig, process_csv

result = process_csv(
    "input.csv",
    config=PipelineConfig(
        text_col="text",
        label_col="hs",
        model_id="batinium/glimo-dehatebert-hsd",
        restatement_backend="none",
        final_scrub=True,
    ),
)

print(result.restated_csv)
print(result.audit_csv)

Use classifier_backend="keyword" for offline smoke tests. Production runs should use classifier_backend="hf" with the Hugging Face model repo or a local model directory.

LLM Restatement Backend

The package does not insert instruct tokens, chat-template markers, or model-specific control text. Those are handled by the LLM provider or local runtime.

When restatement_backend is qwen or local-http, Glimo sends an OpenAI-compatible chat-completions request and requires a structured tool call with tool_choice="required". That tool contract is intentional: the restatement step needs exactly one ordered restatement per input row. Providers or runtimes used for restatement must support OpenAI-style tool calling.

CLI

glimo-hsd process input.csv \
  --text-col text \
  --label-col hs \
  --out outputs/run_001 \
  --model-id batinium/glimo-dehatebert-hsd \
  --classifier-backend hf \
  --restatement-backend none \
  --final-scrub

The process command writes deterministic artifacts:

source.csv
scrubbed.csv
dehatebert_predictions.csv
token_importances.csv
restatement_input.csv
restated.csv
final_scrubbed.csv
deviation_audit.csv
manifest.json

Model Weights

The PyPI package does not include model weights. With classifier_backend="hf", the default model ID is:

batinium/glimo-dehatebert-hsd

Pass a different model_id to use another Hugging Face repo or local model directory.

Safety

Classifier scores and restatement audits are decision-support signals. They are not appropriate for fully automated enforcement without human review. Do not publish raw challenge data, admin uploads, or generated outputs containing private source text.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glimo_hsd-0.1.1.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glimo_hsd-0.1.1-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file glimo_hsd-0.1.1.tar.gz.

File metadata

  • Download URL: glimo_hsd-0.1.1.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for glimo_hsd-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1316e6a5985581b65b70ce0cc8fed723df0fb8052d17e46a597bf7c2b744bcc7
MD5 cdc5b4d7f135a4d263ad96927a579088
BLAKE2b-256 fa18f59f32382ff11eb6f6100b3842ba98ae6acaf5d3c3db3057370bb49c3581

See more details on using hashes here.

File details

Details for the file glimo_hsd-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: glimo_hsd-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for glimo_hsd-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e45743096f496aa0dd2fbf957d80669a192d0913c3605b17b27ffa276fef17b0
MD5 f8df28ffbbc3868d87d3ada8f0a595d1
BLAKE2b-256 1cb739fc2866cb61f7f6467de4e474ece7160a701978aca0c9e28e6b10ace3ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page