Zecyel commited on
Commit
f5cb188
Β·
verified Β·
1 Parent(s): 0c434ec

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +121 -26
README.md CHANGED
@@ -1,26 +1,121 @@
1
- ---
2
- license: mit
3
- configs:
4
- - config_name: default
5
- data_files:
6
- - split: train
7
- path: data/train-*
8
- dataset_info:
9
- features:
10
- - name: homework
11
- dtype: string
12
- - name: exercise_number
13
- dtype: string
14
- - name: sub_problem
15
- dtype: string
16
- - name: content
17
- dtype: string
18
- - name: full_id
19
- dtype: string
20
- splits:
21
- - name: train
22
- num_bytes: 6972
23
- num_examples: 28
24
- download_size: 6910
25
- dataset_size: 6972
26
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LyTOC Benchmark
2
+
3
+ This repository contains a benchmark dataset extracted from homework PDFs using SimpleTex OCR API.
4
+
5
+ ## Features
6
+
7
+ - Automated PDF content extraction using SimpleTex OCR API
8
+ - Structured benchmark dataset creation
9
+ - Multiple export formats (JSON, JSONL, HuggingFace Dataset)
10
+ - Easy upload to HuggingFace Hub
11
+ - Interactive pipeline runner
12
+
13
+ ## Quick Start
14
+
15
+ ### 1. Install Dependencies
16
+
17
+ ```bash
18
+ pip install -r requirements.txt
19
+ ```
20
+
21
+ ### 2. Set Up API Keys
22
+
23
+ ```bash
24
+ cp .env.example .env
25
+ # Edit .env and add your API keys:
26
+ # - OCR_UAT: Get from https://simpletex.cn
27
+ # - HF_TOKEN: Get from https://huggingface.co/settings/tokens
28
+ ```
29
+
30
+ ### 3. Run the Pipeline
31
+
32
+ **Option A: Interactive Pipeline** (Recommended)
33
+ ```bash
34
+ python run_pipeline.py
35
+ ```
36
+
37
+ **Option B: Manual Steps**
38
+ ```bash
39
+ # Extract PDFs
40
+ python extract_pdfs.py
41
+
42
+ # Create benchmark dataset
43
+ python create_benchmark.py
44
+
45
+ # Upload to HuggingFace
46
+ python upload_to_hf.py <username/repo-name> [--private]
47
+ ```
48
+
49
+ ## Project Structure
50
+
51
+ ```
52
+ lytoc/
53
+ β”œβ”€β”€ raw/ # Source PDF files
54
+ β”œβ”€β”€ parsed_data/ # Extracted markdown content
55
+ β”‚ β”œβ”€β”€ hw*.md # Individual parsed files
56
+ β”‚ └── extraction_metadata.json # Extraction status
57
+ β”œβ”€β”€ benchmark_dataset/ # Final benchmark dataset
58
+ β”‚ β”œβ”€β”€ dataset.json # JSON format
59
+ β”‚ β”œβ”€β”€ dataset.jsonl # JSONL format
60
+ β”‚ └── huggingface_dataset/ # HuggingFace format
61
+ β”œβ”€β”€ extract_pdfs.py # PDF extraction script
62
+ β”œβ”€β”€ create_benchmark.py # Benchmark creation script
63
+ β”œβ”€β”€ upload_to_hf.py # HuggingFace upload script
64
+ β”œβ”€β”€ run_pipeline.py # Interactive pipeline runner
65
+ └── DATASET_CARD.md # Dataset documentation
66
+ ```
67
+
68
+ ## Dataset Structure
69
+
70
+ Each problem in the dataset contains:
71
+ - `homework`: Homework identifier (e.g., "hw1", "hw2")
72
+ - `problem_number`: Problem number within the homework
73
+ - `content`: Full problem text and description
74
+ - `full_id`: Unique identifier (e.g., "hw1_problem1")
75
+
76
+ Example:
77
+ ```json
78
+ {
79
+ "homework": "hw1",
80
+ "problem_number": "1",
81
+ "content": "Problem statement...",
82
+ "full_id": "hw1_problem1"
83
+ }
84
+ ```
85
+
86
+ ## Scripts
87
+
88
+ ### extract_pdfs.py
89
+ Extracts content from PDF files in the `raw/` directory using SimpleTex OCR API.
90
+ - Converts PDFs to markdown format via OCR
91
+ - Saves parsed content to `parsed_data/`
92
+ - Creates extraction metadata
93
+
94
+ ### create_benchmark.py
95
+ Processes parsed content into a structured benchmark dataset.
96
+ - Parses markdown content to extract individual problems
97
+ - Creates dataset in multiple formats
98
+ - Generates statistics and sample output
99
+
100
+ ### upload_to_hf.py
101
+ Uploads the benchmark dataset to HuggingFace Hub.
102
+ ```bash
103
+ python upload_to_hf.py username/repo-name [--private]
104
+ ```
105
+
106
+ ### run_pipeline.py
107
+ Interactive script that runs the complete pipeline with user prompts.
108
+
109
+ ## Requirements
110
+
111
+ - Python 3.8+
112
+ - SimpleTex API token (OCR_UAT)
113
+ - HuggingFace account and token (for upload)
114
+
115
+ ## License
116
+
117
+ MIT License - See LICENSE file for details
118
+
119
+ ## Contributing
120
+
121
+ Contributions are welcome! Please feel free to submit a Pull Request.