Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- discourse-analysis
|
| 7 |
+
- deberta-v3
|
| 8 |
+
- onnx
|
| 9 |
+
- on-device
|
| 10 |
+
- browser-inference
|
| 11 |
+
library_name: onnxruntime
|
| 12 |
+
pipeline_tag: text-classification
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Pnyx Habermas - Discourse Legibility Model (v3)
|
| 16 |
+
|
| 17 |
+
Named after Jurgen Habermas's *Theory of Communicative Action* (1981). This model makes discourse structure legible by extracting two validity dimensions from text.
|
| 18 |
+
|
| 19 |
+
## Model
|
| 20 |
+
|
| 21 |
+
- **Base**: `cross-encoder/nli-deberta-v3-small` (141M params)
|
| 22 |
+
- **Format**: ONNX, FP16 (271 MB)
|
| 23 |
+
- **Performance**: F1 0.974 (0.977 claim risk, 0.972 argument quality)
|
| 24 |
+
- **Inference**: ONNX Runtime Web (WASM) for in-browser use
|
| 25 |
+
|
| 26 |
+
## Outputs
|
| 27 |
+
|
| 28 |
+
Two binary classification heads:
|
| 29 |
+
|
| 30 |
+
| Head | Validity Claim | Description |
|
| 31 |
+
|------|---------------|-------------|
|
| 32 |
+
| `claim_risk` | *Wahrheit* (Truth) | Are unsupported assertions present? |
|
| 33 |
+
| `argument_quality` | *Richtigkeit* (Rightness) | Is reasoning/evidence present? |
|
| 34 |
+
|
| 35 |
+
Apply softmax to each head's logits. The `[1]` index gives the positive class probability.
|
| 36 |
+
|
| 37 |
+
## Usage
|
| 38 |
+
|
| 39 |
+
```js
|
| 40 |
+
import * as ort from 'onnxruntime-web';
|
| 41 |
+
import { AutoTokenizer } from '@huggingface/transformers';
|
| 42 |
+
|
| 43 |
+
const tokenizer = await AutoTokenizer.from_pretrained('onblueroses/pnyx-habermas');
|
| 44 |
+
const session = await ort.InferenceSession.create('model.onnx');
|
| 45 |
+
|
| 46 |
+
const { input_ids, attention_mask } = tokenizer(text, {
|
| 47 |
+
padding: true, truncation: true, max_length: 256, return_tensors: 'np',
|
| 48 |
+
});
|
| 49 |
+
|
| 50 |
+
const output = await session.run({
|
| 51 |
+
input_ids: new ort.Tensor('int64', input_ids.data, input_ids.dims),
|
| 52 |
+
attention_mask: new ort.Tensor('int64', attention_mask.data, attention_mask.dims),
|
| 53 |
+
});
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
## Training
|
| 57 |
+
|
| 58 |
+
- 10K balanced samples (2,500 per cell) + 453 boundary examples (5x oversampled)
|
| 59 |
+
- Focal loss (gamma=2) + label smoothing (0.05)
|
| 60 |
+
- 5 epochs, lr=5e-6, batch size 32
|
| 61 |
+
- Trained on T4 GPU via Modal
|
| 62 |
+
|
| 63 |
+
## Part of Pnyx
|
| 64 |
+
|
| 65 |
+
This model powers the SEE layer of [Pnyx](https://github.com/onblueroses/pnyx), a listening infrastructure for public discourse built for the Agora Hackathon x TUM.ai E-Lab (April 2026).
|