Text Classification
Transformers
ONNX
Safetensors
English
bert
political-discourse
media-bias
wording
contextual-review
text-embeddings-inference
Instructions to use Giuliocc/doxa-wording-encoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Giuliocc/doxa-wording-encoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Giuliocc/doxa-wording-encoder")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Giuliocc/doxa-wording-encoder") model = AutoModelForSequenceClassification.from_pretrained("Giuliocc/doxa-wording-encoder", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from Giuliocc/doxa-wording-encoder: direct link, hf CLI and curl.
- Browser
- Download file 6.06 kB
-
https://huggingface.co/Giuliocc/doxa-wording-encoder/resolve/main/README.md
- Command line
-
hf download hf://Giuliocc/doxa-wording-encoder/README.md
-
curl -L -o README.md https://huggingface.co/Giuliocc/doxa-wording-encoder/resolve/main/README.md
6.06 kB
| language: en | |
| license: apache-2.0 | |
| library_name: transformers | |
| pipeline_tag: text-classification | |
| base_model: sentence-transformers/all-MiniLM-L6-v2 | |
| datasets: | |
| - Giuliocc/doxa-wording-benchmark | |
| tags: | |
| - political-discourse | |
| - media-bias | |
| - wording | |
| - onnx | |
| - contextual-review | |
| # DOXA contextual wording encoder | |
| Check wording in a supplied English passage with a compact contextual model, | |
| then read the speaker, evidence and surrounding context. The selected model | |
| uses full encoder and classification head fine-tuning. Its original source task is BABE's expert-majority word-choice | |
| bias judgment. It returns a wording flag, no wording flag or an unresolved | |
| result under the published uncertainty threshold. | |
| [Use DOXA](https://doxa.tacitus.me/) 路 [TACITUS](https://tacitus.me/doxa/) | |
| 路 [GitHub](https://github.com/sargonxg/DOXA-by-TACITUS) | |
| 路 [Benchmark](https://huggingface.co/datasets/Giuliocc/doxa-wording-benchmark) | |
| 路 [Evaluation and limits](EVALUATION.md) | |
| The selected native pipeline reached **0.789 macro-F1** | |
| on 384 judgments from held-out source groups. Its gain over the strongest lexical | |
| or current DOXA control was 0.047, with paired | |
| 95% group-bootstrap interval [0.003, 0.092]. The | |
| quantized model reached 0.784. Inspect the complete | |
| control table, failures and coverage in the evaluation report. | |
| The quantized export's own 95% gain interval includes zero; its point gain | |
| and native-model parity support a provisional wording screen, with further | |
| independent evaluation needed. | |
| ## Local inference | |
| The browser uses the checked quantized ONNX graph and tokenizer, totaling | |
| about 23.2 MB of model weights. | |
| Inference runs locally after the public asset download. The Python | |
| `inference.py` helper uses ONNX Runtime and the published runtime manifest. | |
| The native Transformer head returns two class logits. The helper and browser | |
| apply the validation temperature and uncertainty threshold, and retain input | |
| limits in their structured result. | |
| ```python | |
| from inference import WordingModel | |
| model = WordingModel("path/to/downloaded/model") | |
| result = model.check("The committee voted six to four to approve the policy.") | |
| print(result) | |
| ``` | |
| `model_score` is the positive wording class's score after validation | |
| temperature scaling. The output records that calibration method, resolution | |
| threshold and actual token count. Input longer than 256 tokens is unresolved. | |
| Long documents require passage selection and source context, as in DOXA Lab. | |
| The [fictional illustrations](illustrations.json) contain actual outputs and | |
| retain their authored provenance. | |
| ## Training and source provenance | |
| The benchmark's 3,639 admitted judgments retain original expert votes, | |
| strict majority admission and source-group roles. Article text was restored | |
| locally from the pinned upstream source for training. Public model artifacts | |
| contain IDs and predictions in place of article excerpts. The original | |
| source's licenses and article rights are documented by the benchmark. | |
| The base encoder is pinned at | |
| `1110a243fdf4706b3f48f1d95db1a4f5529b4d41` under Apache-2.0. Training used | |
| local CPU compute, seed 1729 and zero new spend. The registration, amendment, | |
| export plan, training history and code are included. Reproduction needs the | |
| DOXA project source, the benchmark restoration recipe and the pinned Python | |
| dependencies. Keep restored article text in the local benchmark workspace. | |
| See [REPRODUCE.md](REPRODUCE.md) for the complete experiment and export steps. | |
| The public benchmark release is pinned at | |
| `bea9a3f2d53b03069b0d814094ea860d75f1c322` (tag `v0.1.0`). | |
| The admitted split contains 2,950 training, 305 validation and 384 held-out | |
| judgments. Fixed search used learning rates 2e-5 and 5e-5, three epochs | |
| each, AdamW, balanced cross entropy and 256-token input. Validation selected | |
| learning rate 5e-5 at epoch 2. Candidate and frozen controls use the passage | |
| text alone; annotator votes, source, outlet and topic stay outside features. | |
| ## Scope | |
| This is a provisional wording screen for contextual review. Its evaluated | |
| genre is sampled English news. Academic papers and other domains need | |
| separate validation. A positive wording judgment can occur in legitimate | |
| criticism, declared advocacy or attributed speech. Read the original source | |
| and preserve supported political meaning when considering a revision. | |
| The current dataset supports a binary wording task. Other prejudice, | |
| research-validity and comparative-bias questions need their own evidence | |
| and labels. The same news outlets can occur in training and test roles, and | |
| known source-URL imperfections remain documented. Additional independent | |
| evaluation is needed before broad service-quality claims. | |
| ## Local SDK and provenance contract | |
| The [DOXA Methods foundation](https://huggingface.co/datasets/Giuliocc/doxa-methods) supplies a common local request/result envelope, exact-commit asset loader and checked source/reviewer schemas. This model retains its native task and output labels: `biased_wording`. Its recorded portfolio status is `qualified_news_wording_research`. | |
| The [task manifest](portfolio-task.json) pins the existing inference artifact and expected hashes. Run it with the Methods SDK using `doxa portfolio fetch` and `doxa portfolio run`. Document text stays local; fetching public weights does not provide hosted inference. This update changes documentation and contracts; learned parameters are unchanged. | |
| Scope boundaries: | |
| - English news wording task. | |
| - No supervised surrounding-article context. | |
| - Input above256tokens unresolved. | |
| - Browser improvement interval includes zero. | |
| - Academic/prejudice/whole-document conclusions require separate validation. | |
| Source judgments, model predictions and actual human review remain separate. The production new-reviewer registry starts empty. This model does not certify political neutrality, infer a person's beliefs or supply an overall political-bias percentage. See the [research foundation guide](https://huggingface.co/spaces/Giuliocc/doxa-lab/blob/main/RESEARCH_FOUNDATION.md) for data roles and independent evaluation requirements. | |