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:
|
5 |
-
|
|
|
6 |
function_config:
|
7 |
-
|
8 |
-
-
|
9 |
-
- id:
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
- id:
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
- id:
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
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 |
-
|
59 |
|
60 |
-
|
61 |
|
62 |
-
|
63 |
|
64 |
-
|
65 |
|
66 |
-
|
67 |
-
|
68 |
|
69 |
-
|
70 |
-
|
71 |
|
72 |
-
|
73 |
-
|
74 |
|
75 |
-
|
76 |
-
|
77 |
|
78 |
-
|
79 |
-
|
80 |
|
81 |
-
|
82 |
-
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
- id: filter_to_good_pdfs
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
- id: filter_original_pages
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
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
|