Mike0021 commited on
Commit
403290b
·
verified ·
1 Parent(s): 78b487c

Clean up README formatting

Browse files
Files changed (1) hide show
  1. README.md +38 -43
README.md CHANGED
@@ -11,82 +11,77 @@ tags:
11
  - pulpie
12
  ---
13
 
14
- # Pulpie Orange Small GGUF
15
 
16
- GGUF conversion of `feyninc/pulpie-orange-small`, a 210M parameter EuroBERT token-classification model for Pulpie HTML main-content extraction.
17
 
18
- This is an encoder classifier, not a causal language model. The GGUF files expose raw per-token `other/main` classifier logits through `llama-embedding --pooling none --embd-normalize -1`.
19
 
20
- ## Files
21
 
22
- | File | Size MB | Avg GGUF subprocess latency s | Max abs diff vs PyTorch |
23
- |---|---:|---:|---:|
24
- | `pulpie-orange-small-F16.gguf` | 431.40 | 2.550 | 0.06980780208435067 |
25
- | `pulpie-orange-small-Q2_K.gguf` | 130.18 | 14.049 | |
26
- | `pulpie-orange-small-Q3_K_M.gguf` | 143.15 | 11.036 | |
27
- | `pulpie-orange-small-Q4_K_M.gguf` | 156.97 | 7.651 | |
28
- | `pulpie-orange-small-Q5_K_M.gguf` | 168.91 | 2.640 | |
29
- | `pulpie-orange-small-Q6_K.gguf` | 181.60 | 2.614 | |
30
- | `pulpie-orange-small-Q8_0.gguf` | 232.89 | 2.630 | 0.0720623857818603 |
31
 
32
- PyTorch baseline latency samples: `[0.1122, 0.1968, 0.1134, 0.1765, 0.1171]` seconds.
 
 
 
 
 
 
 
 
33
 
34
  ## Verification
35
 
36
- - F16 max abs diff: `0.06980780208435067`
37
- - Q8_0 max abs diff: `0.0720623857818603`
38
- - F16 extraction non-empty: `True`, main blocks: `3`, markdown: `<html><body>
39
- <main><h1 _item_id="1">Orange harvest report</h1>
40
- <p _item_id="2">The main article explains how growers sort oranges after harvest.</p>
41
- <p _item_id="3">It includes storage notes and quality checks for shipment.</p>
42
- </main></body></html>`
43
- - Q8_0 extraction non-empty: `True`, main blocks: `3`, markdown: `<html><body>
44
- <main><h1 _item_id="1">Orange harvest report</h1>
45
- <p _item_id="2">The main article explains how growers sort oranges after harvest.</p>
46
- <p _item_id="3">It includes storage notes and quality checks for shipment.</p>
47
- </main></body></html>`
48
 
49
- Full machine-readable results are in `verification_report.json`.
50
 
51
- ## llama.cpp Usage
 
 
52
 
53
  ```bash
54
  llama-embedding \
55
  --model pulpie-orange-small-Q8_0.gguf \
56
- --prompt '<html><body><p _item_id="0">Main text.</p></body></html><|sep|>' \
57
  --pooling none \
58
  --embd-normalize -1 \
59
  --embd-output-format json
60
  ```
61
 
62
- Each returned embedding row is `[other_logit, main_logit]`. Pulpie classifies each block at the `<|sep|>` token position and keeps blocks where `main_logit > other_logit`.
63
 
64
- `llama-cli` can load the files, but it is a generation frontend and these GGUFs do not contain a causal LM head.
65
 
66
- ## Python Sketch
67
 
68
  ```python
69
  import json, re, subprocess
70
 
71
- cmd = [
72
  "llama-embedding", "-m", "pulpie-orange-small-Q8_0.gguf",
73
  "-p", html_chunk,
74
  "--pooling", "none",
75
  "--embd-normalize", "-1",
76
  "--embd-output-format", "json",
77
- ]
78
- out = subprocess.check_output(cmd, text=True)
79
- data = json.loads(re.search(r'\{\s*"object".*', out, re.S).group(0))
80
  logits = [row["embedding"] for row in data["data"]]
81
  ```
82
 
83
- ## Conversion Method
84
 
85
- Current llama.cpp supports the EuroBERT encoder architecture but not the `EuroBertForTokenClassification` dispatch/head directly. The conversion used a small llama.cpp patch that:
86
 
87
- - registers `EuroBertForTokenClassification` in the HF converter,
88
- - maps `classifier.weight` and `classifier.bias` to GGUF `cls.output.*`,
89
- - writes classifier output labels `["other", "main"]` and `embedding_length_out=2`,
90
- - applies the classifier head in the EuroBERT runtime graph and returns per-token logits as embeddings.
91
 
92
- Quantization was performed with `llama-quantize` from the patched llama.cpp build.
 
11
  - pulpie
12
  ---
13
 
14
+ # Pulpie Orange Small GGUF
15
 
16
+ GGUF conversion of [feyninc/pulpie-orange-small](https://huggingface.co/feyninc/pulpie-orange-small), a 210M parameter EuroBERT token-classification model for Pulpie HTML main-content extraction.
17
 
18
+ ## ⚠️ Not a language model
19
 
20
+ This is an **encoder classifier**, not a causal LM. The GGUF files expose per-token `other`/`main` classifier logits via `llama-embedding`, not `llama-cli` generation.
21
 
22
+ ## Files
 
 
 
 
 
 
 
 
23
 
24
+ | Quant | Size | Notes |
25
+ |-------|------|-------|
26
+ | F16 | 431 MB | Full precision baseline |
27
+ | Q8_0 | 233 MB | 8-bit, verified accurate |
28
+ | Q6_K | 182 MB | |
29
+ | Q5_K_M | 169 MB | |
30
+ | Q4_K_M | 157 MB | |
31
+ | Q3_K_M | 143 MB | |
32
+ | Q2_K | 130 MB | Most aggressive quantization |
33
 
34
  ## Verification
35
 
36
+ | Variant | Max diff vs PyTorch | E2E extraction | Prediction agreement |
37
+ |---------|--------------------|-----------------|---------------------|
38
+ | F16 | 0.070 | ✅ 3 main blocks | 100% |
39
+ | Q8_0 | 0.072 | ✅ 3 main blocks | 100% |
40
+ | Q6_K Q2_K | not tested | not tested | — |
 
 
 
 
 
 
 
41
 
42
+ > **Note:** Only F16 and Q8_0 were numerically verified against the original PyTorch model. Lower quants (Q6_K → Q2_K) passed load + inference checks but output consistency was not validated. Use F16 or Q8_0 for production.
43
 
44
+ Full results: [`verification_report.json`](./verification_report.json)
45
+
46
+ ## Usage
47
 
48
  ```bash
49
  llama-embedding \
50
  --model pulpie-orange-small-Q8_0.gguf \
51
+ --prompt "<html><body><p>Hello world</p></body></html><|sep|>" \
52
  --pooling none \
53
  --embd-normalize -1 \
54
  --embd-output-format json
55
  ```
56
 
57
+ Each output row is `[other_logit, main_logit]`. Pulpie classifies at `<|sep|>` token positions and keeps blocks where `main_logit > other_logit`.
58
 
59
+ `llama-cli` can load the files but cannot generate these GGUFs have no causal LM head.
60
 
61
+ ## Python example
62
 
63
  ```python
64
  import json, re, subprocess
65
 
66
+ out = subprocess.check_output([
67
  "llama-embedding", "-m", "pulpie-orange-small-Q8_0.gguf",
68
  "-p", html_chunk,
69
  "--pooling", "none",
70
  "--embd-normalize", "-1",
71
  "--embd-output-format", "json",
72
+ ], text=True)
73
+
74
+ data = json.loads(re.search(r'\{.*\}', out, re.S).group(0))
75
  logits = [row["embedding"] for row in data["data"]]
76
  ```
77
 
78
+ ## Conversion notes
79
 
80
+ Stock llama.cpp supports EuroBERT embeddings but not `EuroBertForTokenClassification`. A 103-line patch was applied to:
81
 
82
+ - Register `EuroBertForTokenClassification` in the HF converter
83
+ - Map `classifier.weight`/`classifier.bias` GGUF `cls.output.*`
84
+ - Write classifier labels `["other", "main"]` with `embedding_length_out=2`
85
+ - Apply the classifier head in the EuroBERT runtime graph
86
 
87
+ Quantization was done with `llama-quantize` from the patched build.