jerryyan commited on
Commit
0ccfc3e
·
verified ·
1 Parent(s): 8c74aea

Add README

Browse files
Files changed (1) hide show
  1. README.md +77 -0
README.md ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - pretraining-data
8
+ - data-curation
9
+ - web-scraping
10
+ ---
11
+
12
+ # ReScraper
13
+
14
+ ReScraper is a 0.6B refiner that replaces the heuristic HTML-to-text stack of a pretraining
15
+ data pipeline — a rule-based scraper followed by rule-based cleaning filters — with a single
16
+ small language model.
17
+
18
+ - **Data:** [`cx-cmu/ReScraper-Data`](https://huggingface.co/datasets/cx-cmu/ReScraper-Data)
19
+ - **Code:** [`cxcscmu/ReScraper`](https://github.com/cxcscmu/ReScraper)
20
+
21
+ ## What the model does
22
+
23
+ The model reads the visible text of a raw web page, rendered one block per line with line ids
24
+ `<lid:n>`, and generates a short program:
25
+
26
+ 1. An `<extract>` block of line removals (`rm 1-4`, `rm 6`, …) that strips headers, menus,
27
+ boilerplate and other non-content lines.
28
+ 2. One operation tag for the page:
29
+
30
+ | Tag | Meaning |
31
+ |---|---|
32
+ | `<keep>` | keep the extracted text as it is |
33
+ | `<edit>` | remove further noisy lines and spans inside the page |
34
+ | `<delete>` | drop the page entirely |
35
+ | `<rewrite>` | rewrite a poorly written but informative page |
36
+
37
+ An executor applies the program to the page, so extraction and cleaning happen in one model
38
+ instead of a cascade of separate stages.
39
+
40
+ ## Files
41
+
42
+ ```
43
+ models/ReScraper/ the refiner (Stage 2 checkpoint), in Hugging Face format
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ ```python
49
+ from vllm import LLM, SamplingParams
50
+
51
+ llm = LLM(model="cx-cmu/ReScraper", dtype="bfloat16", max_model_len=32768)
52
+ params = SamplingParams(temperature=1.0, top_p=1.0, max_tokens=3072)
53
+
54
+ system = open("prompts/student_system_stage2.txt").read() # from the code repository
55
+ page = "<lid:1> ...\n<lid:2> ...\n" # rendered page, one block per line
56
+
57
+ out = llm.chat(
58
+ [[{"role": "system", "content": system}, {"role": "user", "content": page}]],
59
+ params,
60
+ )
61
+ print(out[0].outputs[0].text)
62
+ ```
63
+
64
+ The system prompt and the executor that applies the generated program are in the code
65
+ repository, together with the full pipeline (rendering, inference, post-filtering,
66
+ deduplication and tokenization).
67
+
68
+ ## Training
69
+
70
+ The model is trained in two supervised stages, distilling three teachers: a main-content
71
+ extractor, a refinement teacher that decides the operation and edits the text, and a rewriting
72
+ teacher for pages that are informative but poorly written. Both training sets are released in
73
+ [`cx-cmu/ReScraper-Data`](https://huggingface.co/datasets/cx-cmu/ReScraper-Data).
74
+
75
+ ## License
76
+
77
+ Apache 2.0.