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
Hugging Face Model
The default model ID is:
batinium/glimo-dehatebert-hsd
Export a local checkpoint with:
python scripts/export_dehatebert_for_hf.py \
--checkpoint path/to/final_model \
--out dist/hf/glimo-dehatebert-hsd
Then upload with the current Hugging Face CLI:
hf auth whoami
hf repos create batinium/glimo-dehatebert-hsd --type model --exist-ok
hf upload batinium/glimo-dehatebert-hsd dist/hf/glimo-dehatebert-hsd --type model
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file glimo_hsd-0.1.0.tar.gz.
File metadata
- Download URL: glimo_hsd-0.1.0.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0d9ffd127c7c5e38b1a7d96db87ea23d90508bcddd8f56baddea5ad09283467
|
|
| MD5 |
ba3f06b752942bab37a84a638c857bee
|
|
| BLAKE2b-256 |
03abf20a4788334735b57ef9ca87e6fdf3c1e8c404eb5a0eeb9f72e40b9cf024
|
File details
Details for the file glimo_hsd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: glimo_hsd-0.1.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d985896761e34f4fb972fc21d6f441448309ecc60ef6dabb7d9d9a27220f53f3
|
|
| MD5 |
1d253496d28a1d2af74cc196bb13cb41
|
|
| BLAKE2b-256 |
53353aa6317c1e2b5ffafb51f1263204b6c2534391574eee40650c4b399c241e
|