EtashGuha commited on
Commit
4b46d15
·
verified ·
1 Parent(s): 896f87b

Upload configuration file

Browse files
config/textclassifier_inference_cc_safe__v2.yaml CHANGED
@@ -1,110 +1,105 @@
1
  operators:
2
  - id: create_urls
3
  config:
4
- type: function
5
- function: data_strategies.32b_exploit.seed_pdf_parser.utils.make_cc_safe_untruncated_zip_file_urls
 
6
  function_config:
7
- urls:
8
- - "https://digitalcorpora.s3.amazonaws.com/corpora/files/CC-MAIN-2021-31-PDF-UNTRUNCATED/zipfiles/0000-0999;;0:2"
9
- - id: download_pdfs__v2
10
- config:
11
- type: function
12
- function: data_strategies.32b_exploit.seed_pdf_parser.utils.download_cc_safe_untruncated_zip_files_from_dataset
13
- input_ids:
14
- - create_urls
15
- - id: classify_fasttext
16
- config:
17
- type: fasttext
18
- hf_repo_id: mlfoundations-dev/science_pdf_fasttext_classifier_v2
19
- input_column: text
20
- target_label: "__label__QA_doc"
21
- filter_threshold: 0.5
22
- input_ids:
23
- - download_pdfs__v2
24
- - id: filter_pdfs
25
- config:
26
- type: function
27
- function: data_strategies.commons.filter_dataset_if_value_exists
28
- function_config:
29
- to_filter_column: pdf_file
30
- value_column: pdf_file
31
- input_dataset_map:
32
- to_filter_dataset: download_pdfs__v2
33
- values_dataset: classify_fasttext
34
- input_ids:
35
- - download_pdfs__v2
36
- - classify_fasttext
37
- - id: remove_non_english_pages
38
- config:
39
- type: function
40
- function: data_strategies.32b_exploit.seed_pdf_parser.utils.flag_english_pages
41
- input_ids:
42
- - filter_pdfs
43
- - id: reduce_to_sample_pages_for_annotation
44
- config:
45
- type: function
46
- function: data_strategies.32b_exploit.seed_pdf_parser.utils.sub_sample_page_per_url
47
- input_ids:
48
- - remove_non_english_pages
49
- - id: filter_qa_pdfs
50
- config:
51
- type: completions
52
- model: gpt-4o-mini
53
- map: binary_classifier
54
- map_config:
55
- user_message: |
56
- Yes or No, does this pdf contain multiple choice, short answer, or long answer questions?
57
 
58
- Below is a sampling of a subset of pages from the pdf, determine if there are questions in it. Specifically, questions from a textbook or exams that may appear on homework or tests.
59
 
60
- We are not interested in rhetorical questions or scientific writing etc. We want actual questions that a student could solve.
61
 
62
- These questions must be science questions. Specifically involving Physics, Chemistry, or Biology.
63
 
64
- We provide examples of questions below:
65
 
66
- ## Example 1
67
- To evaluate the integral of the form I, we have: I = ∫ dx / √(5 + 2x + x²). We can rewrite the expression under the square root as follows: 5 + 2x + x² = 4 + (x + 1)². Thus, we can substitute x + 1 = t, transforming the integral: I = ∫ dt / √(4 + t²). This leads to the substitution of t = 2 tan z. What is the integral of the form I when given I = ∫ dx / √(5 + 2x + x²)?
68
 
69
- ## Example 2
70
- A tin chloride Q undergoes the following reactions (not balanced): Q + Cl → X, Q + Me3N → Y, Q + CuCl2 → Z + CuCl. X is a monoanion having pyramidal geometry. Both Y and Z are neutral compounds. Choose the correct option(s): (A) The central atom in X is sp³ hybridized (B) There is a coordinate bond in Y (C) The oxidation state of the central atom in Z is +2 (D) The central atom in Z has one lone pair of electrons.
71
 
72
- ## Example 3
73
- An optical bench has a 1.5 m long scale having four equal divisions in each cm. While measuring the focal length of a convex lens, the lens is kept at the 75 cm mark of the scale and the object pin is kept at the 45 cm mark. The image of the object pin on the other side of the lens overlaps with the image pin that is kept at the 135 cm mark. In this experiment, what is the percentage error in the measurement of the focal length of the lens?
74
 
75
- ## Example 4
76
- A uniformly charged thin spherical shell of radius R carries uniform surface charge density of σ per unit area. It is made of two hemispherical shells, held together by pressing them with force F (see figure). F is proportional to: A) \(\frac{1}{\varepsilon_0}\sigma^2 R^2\) B) \(\frac{1}{\varepsilon_0}\sigma^2 R\) C) \(\frac{1}{\varepsilon_0 R}\sigma^2\) D) \(\frac{1}{\varepsilon_0 R^2}\sigma^2\) What is F proportional to?
77
 
78
- ## Example 5
79
- Termites are to termites as gut microbes are to plants. * <bold>A.</bold> Cellulose molecules, water molecules * <bold>B.</bold> Gut microbes, mycorrhizal fungi * <bold>C.</bold> Gut microbes, water molecules * <bold>D.</bold> Hours of darkness, hours of light * <bold>E.</bold> Predators, prey Termites are to termites as [blank] are to plants.
80
 
81
- ## Your task
82
- Does the below PDF contain questions similar to the examples?
83
 
84
- ## Sampled PDF text
85
- {{sampled_pdf_text}}
86
- output_column: contains_math_sci_code_content
87
- temperature: 0.0 # From stage 1
88
- top_p: 1.0
89
- presence_penalty: 0.0
90
- input_ids:
91
- - reduce_to_sample_pages_for_annotation
92
- - id: filter_to_good_pdfs
93
- config:
94
- type: function
95
- function: data_strategies.commons.select_rows
96
- function_config:
97
- conditions:
98
- contains_math_sci_code_content: True
99
- input_ids:
100
- - filter_qa_pdfs
101
- - id: filter_original_pages
102
- config:
103
- type: function
104
- function: data_strategies.32b_exploit.seed_pdf_parser.utils.filter_pdfs_by_page_classification
105
- input_dataset_map:
106
- dataset_with_pages: filter_pdfs
107
- dataset_of_filtered_pdfs: filter_to_good_pdfs
108
- input_ids:
109
- - filter_pdfs
110
- - filter_to_good_pdfs
 
1
  operators:
2
  - id: create_urls
3
  config:
4
+ type: cpu_function
5
+ num_cpus: 1
6
+ function: data_strategies.32b_exploit.seed_pdf_parser.utils_commoncrawl.download_digital_corpora
7
  function_config:
8
+ s3_urls:
9
+ - s3://digitalcorpora/corpora/files/CC-MAIN-2021-31-PDF-UNTRUNCATED/zipfiles/0000-0999/0000.zip
10
+ # - id: classify_fasttext
11
+ # config:
12
+ # type: fasttext
13
+ # hf_repo_id: mlfoundations-dev/science_pdf_fasttext_classifier_v2
14
+ # input_column: text
15
+ # target_label: "__label__QA_doc"
16
+ # filter_threshold: 0.5
17
+ # input_ids:
18
+ # - create_urls
19
+ # - id: filter_pdfs
20
+ # config:
21
+ # type: function
22
+ # function: data_strategies.commons.filter_dataset_if_value_exists
23
+ # function_config:
24
+ # to_filter_column: pdf_file
25
+ # value_column: pdf_file
26
+ # input_dataset_map:
27
+ # to_filter_dataset: create_urls
28
+ # values_dataset: classify_fasttext
29
+ # input_ids:
30
+ # - create_urls
31
+ # - classify_fasttext
32
+ # - id: remove_non_english_pages
33
+ # config:
34
+ # type: function
35
+ # function: data_strategies.32b_exploit.seed_pdf_parser.utils.flag_english_pages
36
+ # input_ids:
37
+ # - filter_pdfs
38
+ # - id: reduce_to_sample_pages_for_annotation
39
+ # config:
40
+ # type: function
41
+ # function: data_strategies.32b_exploit.seed_pdf_parser.utils.sub_sample_page_per_url
42
+ # input_ids:
43
+ # - remove_non_english_pages
44
+ # - id: filter_qa_pdfs
45
+ # config:
46
+ # type: completions
47
+ # model: gpt-4o-mini
48
+ # map: binary_classifier
49
+ # map_config:
50
+ # user_message: |
51
+ # Yes or No, does this pdf contain multiple choice, short answer, or long answer questions?
 
 
 
 
 
 
52
 
53
+ # Below is a sampling of a subset of pages from the pdf, determine if there are questions in it. Specifically, questions from a textbook or exams that may appear on homework or tests.
54
 
55
+ # We are not interested in rhetorical questions or scientific writing etc. We want actual questions that a student could solve.
56
 
57
+ # These questions must be science questions. Specifically involving Physics, Chemistry, or Biology.
58
 
59
+ # We provide examples of questions below:
60
 
61
+ # ## Example 1
62
+ # To evaluate the integral of the form I, we have: I = ∫ dx / √(5 + 2x + x²). We can rewrite the expression under the square root as follows: 5 + 2x + x² = 4 + (x + 1)². Thus, we can substitute x + 1 = t, transforming the integral: I = ∫ dt / √(4 + t²). This leads to the substitution of t = 2 tan z. What is the integral of the form I when given I = ∫ dx / √(5 + 2x + x²)?
63
 
64
+ # ## Example 2
65
+ # A tin chloride Q undergoes the following reactions (not balanced): Q + Cl → X, Q + Me3N → Y, Q + CuCl2 → Z + CuCl. X is a monoanion having pyramidal geometry. Both Y and Z are neutral compounds. Choose the correct option(s): (A) The central atom in X is sp³ hybridized (B) There is a coordinate bond in Y (C) The oxidation state of the central atom in Z is +2 (D) The central atom in Z has one lone pair of electrons.
66
 
67
+ # ## Example 3
68
+ # An optical bench has a 1.5 m long scale having four equal divisions in each cm. While measuring the focal length of a convex lens, the lens is kept at the 75 cm mark of the scale and the object pin is kept at the 45 cm mark. The image of the object pin on the other side of the lens overlaps with the image pin that is kept at the 135 cm mark. In this experiment, what is the percentage error in the measurement of the focal length of the lens?
69
 
70
+ # ## Example 4
71
+ # A uniformly charged thin spherical shell of radius R carries uniform surface charge density of σ per unit area. It is made of two hemispherical shells, held together by pressing them with force F (see figure). F is proportional to: A) \(\frac{1}{\varepsilon_0}\sigma^2 R^2\) B) \(\frac{1}{\varepsilon_0}\sigma^2 R\) C) \(\frac{1}{\varepsilon_0 R}\sigma^2\) D) \(\frac{1}{\varepsilon_0 R^2}\sigma^2\) What is F proportional to?
72
 
73
+ # ## Example 5
74
+ # Termites are to termites as gut microbes are to plants. * <bold>A.</bold> Cellulose molecules, water molecules * <bold>B.</bold> Gut microbes, mycorrhizal fungi * <bold>C.</bold> Gut microbes, water molecules * <bold>D.</bold> Hours of darkness, hours of light * <bold>E.</bold> Predators, prey Termites are to termites as [blank] are to plants.
75
 
76
+ # ## Your task
77
+ # Does the below PDF contain questions similar to the examples?
78
 
79
+ # ## Sampled PDF text
80
+ # {{sampled_pdf_text}}
81
+ # output_column: contains_math_sci_code_content
82
+ # temperature: 0.0 # From stage 1
83
+ # top_p: 1.0
84
+ # presence_penalty: 0.0
85
+ # input_ids:
86
+ # - reduce_to_sample_pages_for_annotation
87
+ # - id: filter_to_good_pdfs
88
+ # config:
89
+ # type: function
90
+ # function: data_strategies.commons.select_rows
91
+ # function_config:
92
+ # conditions:
93
+ # contains_math_sci_code_content: True
94
+ # input_ids:
95
+ # - filter_qa_pdfs
96
+ # - id: filter_original_pages
97
+ # config:
98
+ # type: function
99
+ # function: data_strategies.32b_exploit.seed_pdf_parser.utils.filter_pdfs_by_page_classification
100
+ # input_dataset_map:
101
+ # dataset_with_pages: filter_pdfs
102
+ # dataset_of_filtered_pdfs: filter_to_good_pdfs
103
+ # input_ids:
104
+ # - filter_pdfs
105
+ # - filter_to_good_pdfs