Repository navigation
v0.3.0
Added
dedup=True(CLI--dedup): leaves out each selected line of 100 or more characters that repeats an earlier selected line, keeping the first copy, intext,htmlandmarkdown. Lines are compared ignoring case, punctuation and markers. Lines in a<pre>are never deduped. Off by default;with_blocks=True, the model input and the predictions are unchanged.threshold=(CLI--threshold): a line is kept when its probability is above it, 0 to 1, default 0.5. Lower keeps more, higher keeps less. Only 0.5 is benchmarked.with_blocks=Truestill returns every probability.
Changed
- New mini model: the embedding table is int8 rank-128 (34.6 MB, was 768 wide and 202 MB). The release pin moves to Hub commit
a86f08a;base/is unchanged apart from its addedtokenizer.json.gz. The first mini download is ~43 MB, and base fetches the 5.4 MB gzipped tokenizer instead of the 33 MB plain one. - Dependencies now have tested bounds:
lxml>=6.0.4,<7,tokenizers>=0.21,<0.24,onnxruntime>=1.20.1,numpy>=1.26.4,huggingface-hub>=0.26.5,w3lib>=2.3.1,<3(was>=2.5,<3), and for[full]torch>=2.7.1,transformers>=5.1,<6. Tested on Linux: across these ranges the mini model gives the sametext,htmlandmarkdownon 2,040 test pages (onnxruntime before 1.30 shifts probabilities by at most 2.4e-6). The base model gives the same line selection on a 13-page sample, except that torch 2.7-2.12 shifts probabilities by up to 0.014 and can flip a line that sits right at the 0.5 threshold. lxml 5.x is excluded: its older libxml2 renders some pages differently from the libxml2 2.14 the models were trained on. CI now also runs the suite with the lowest allowed versions. - The mini model now mean-pools each block's token embeddings with one vectorized segment sum, in batches of 32,768 tokens, instead of a Python loop over blocks. Probabilities can differ from before by about 1e-6; on 2,040 test pages no block changed side of the 0.5 threshold.
- The mini model's per-page memory estimate is sized for the rank-128 table: 1 KB per distinct token id and 12 KB per block (was 12 and 21, sized at 768 wide). Pages estimated above 100 MB still give onnxruntime's arena back after they run; with the new sizes that is pages with about 8,500 or more blocks. Output is unchanged.
- The tokenizer is read from
tokenizer.json.gzwhen the bundle has one, and fromtokenizer.jsonotherwise, both from the Hub and from a local bundle folder. Pinned bundles without the gzipped file load as before.
Fixed
- A document that parses to no element (only comments, a doctype, an
<?xml?>declaration or other processing instructions; with libxml2 2.11, as in lxml's Windows wheels, also a lone BOM or leading NUL bytes) raisedlxml.etree.ParserError: Document is empty. It now returns""in every output, and([], [])withwith_blocks=True, as an empty string does. - An unknown
output(e.g.output="md") raisedValueErroronly after the model had run on the page, and not at all withwith_blocks=True. It now raises before any inference, in every case. output="html"andoutput="markdown"no longer contain text from lines the model rejected. They kept whole elements, so the text of a parent element, the text right after a kept element and the children of a kept element came back with it. They now keep exactly the text of the selected lines, asoutput="text"does. A code block (a<pre>with no block elements inside) stays whole when any of its lines is selected.textoutput, the model input and the predictions are unchanged.output="html"andoutput="markdown"no longer glue separate lines together (Personal incomePopulation) when the<br>or block element between them was not kept; a<br>takes its place.- With
base_url=(or an absolute<base href>), a relative SVGxlink:hrefstayed relative inoutput="html"on lxml < 6.1. It is now made absolute on every lxml version, as on 6.1+. - With libxml2 2.14 (lxml's Linux wheels),
output="html"andoutput="markdown"raisedValueError: All strings must be XML compatibleon pages with C0 control characters (such as\x03or) in text or attributes. The parser now removes them, as libxml2 2.11 (lxml's Windows wheels) already did. Pages without them, and every page on Windows, give the same output as before; on Linux, thetextoutput and the model input of affected pages lose the characters too. None of the 7,825 WebMainBench training and test pages contain them.
Security
output="html"andoutput="markdown"are now cleaned of active content. Kept elements could carry<script>,<style>, event handlers (onclick=),srcdocandjavascript:links, and markdown wrote[text](javascript:...). Now the elements the model never reads (script,style,title,meta,link,base) and SVG<animate>/<set>are dropped,on*andsrcdocattributes are removed, and a link or source whose scheme is nothttp,https,mailto,tel,ftpor relative loses its target (its text stays);data:image/in<img src>is kept. SVGxlink:hrefis checked the same way on every lxml version (lxml < 6.1 does not list it as a link attribute). A basic cleanup, not a guarantee.textoutput, the model input and the predictions are unchanged.
Full changelog: v0.2.1...v0.3.0