Upload configuration file
Browse files
config/textclassifier_train_on_pdfs__v2.yaml
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
operators:
|
| 2 |
+
- id: create_urls
|
| 3 |
+
config:
|
| 4 |
+
type: function
|
| 5 |
+
function: data_strategies.32b_exploit.seed_pdf_parser.utils.download_digital_corpora
|
| 6 |
+
function_config:
|
| 7 |
+
urls:
|
| 8 |
+
- "https://digitalcorpora.s3.amazonaws.com/corpora/files/CC-MAIN-2021-31-PDF-UNTRUNCATED/zipfiles/0000-0999/0000.zip"
|
| 9 |
+
- id: reduce_to_sample_pages_for_annotation
|
| 10 |
+
config:
|
| 11 |
+
type: function
|
| 12 |
+
function: data_strategies.32b_exploit.seed_pdf_parser.utils.sub_sample_page_per_url
|
| 13 |
+
input_ids:
|
| 14 |
+
- create_urls
|
| 15 |
+
- id: filter_qa_pdfs
|
| 16 |
+
config:
|
| 17 |
+
type: completions
|
| 18 |
+
model: gpt-4o-mini
|
| 19 |
+
map: binary_classifier
|
| 20 |
+
map_config:
|
| 21 |
+
user_message: |
|
| 22 |
+
Yes or No, given the sample of pages from the pdf below, will the PDF include questions involving Math, Science, or Code? Specifically we are interested in if this pdf is a textbook, solutions manual, competition exam, test, study guide, etc. such that questions like the example given may be found in the full PDF.
|
| 23 |
+
|
| 24 |
+
Example question:
|
| 25 |
+
Find the integrals: (a) ∫ sinh² x cosh² x dx; (b) ∫ dx sinh x cosh x. Find the integral ∫ sinh² x cosh² x dx.
|
| 26 |
+
|
| 27 |
+
The example is math, but we are interested in science, math, and coding questions.
|
| 28 |
+
|
| 29 |
+
Sampled PDF text:
|
| 30 |
+
{{sampled_pdf_text}}
|
| 31 |
+
output_column: contains_math_sci_code_content
|
| 32 |
+
temperature: 0.0 # From stage 1
|
| 33 |
+
top_p: 1.0
|
| 34 |
+
presence_penalty: 0.0
|
| 35 |
+
input_ids:
|
| 36 |
+
- reduce_to_sample_pages_for_annotation
|
| 37 |
+
- id: filter_out_good_pdfs
|
| 38 |
+
config:
|
| 39 |
+
type: function
|
| 40 |
+
function: data_strategies.commons.select_rows
|
| 41 |
+
function_config:
|
| 42 |
+
conditions:
|
| 43 |
+
contains_math_sci_code_content: False
|
| 44 |
+
input_ids:
|
| 45 |
+
- filter_qa_pdfs
|
| 46 |
+
- id: filter_original_pages
|
| 47 |
+
config:
|
| 48 |
+
type: function
|
| 49 |
+
function: data_strategies.32b_exploit.seed_pdf_parser.utils.filter_pdfs_by_page_classification
|
| 50 |
+
input_dataset_map:
|
| 51 |
+
dataset_with_pages: create_urls
|
| 52 |
+
dataset_of_filtered_pdfs: filter_out_good_pdfs
|
| 53 |
+
input_ids:
|
| 54 |
+
- create_urls
|
| 55 |
+
- filter_out_good_pdfs
|
| 56 |
+
- id: good_pdf_source
|
| 57 |
+
config:
|
| 58 |
+
type: hf_source
|
| 59 |
+
dataset: mlfoundations-dev/textclassifier_good_pdfs__v2
|
| 60 |
+
split: train
|
| 61 |
+
- id: rename_good_pdf_columns
|
| 62 |
+
config:
|
| 63 |
+
type: function
|
| 64 |
+
function: data_strategies.commons.force_rename_columns
|
| 65 |
+
function_config:
|
| 66 |
+
column_maps:
|
| 67 |
+
cleaned_output_extraction: cleaned_text
|
| 68 |
+
input_ids:
|
| 69 |
+
- good_pdf_source
|
| 70 |
+
- id: rename_bad_pdf_columns
|
| 71 |
+
config:
|
| 72 |
+
type: function
|
| 73 |
+
function: data_strategies.commons.force_rename_columns
|
| 74 |
+
function_config:
|
| 75 |
+
column_maps:
|
| 76 |
+
text: cleaned_text
|
| 77 |
+
input_ids:
|
| 78 |
+
- filter_original_pages
|
| 79 |
+
|
| 80 |
+
- id: train_fasttext_classifier
|
| 81 |
+
config:
|
| 82 |
+
type: train_fasttext
|
| 83 |
+
text_column: cleaned_text
|
| 84 |
+
positive_input_ids:
|
| 85 |
+
- rename_good_pdf_columns
|
| 86 |
+
negative_input_ids:
|
| 87 |
+
- rename_bad_pdf_columns
|
| 88 |
+
dim: 256
|
| 89 |
+
epoch: 3
|
| 90 |
+
lr: 0.1
|
| 91 |
+
word_ngrams: 3
|
| 92 |
+
min_count: 3
|
| 93 |
+
hf_repo_id: mlfoundations-dev/science_pdf_fasttext_classifier_v2
|
| 94 |
+
input_ids:
|
| 95 |
+
- rename_good_pdf_columns
|
| 96 |
+
- rename_bad_pdf_columns
|