Sarikaa-Sridhar commited on
Commit
a8a9d46
·
verified ·
1 Parent(s): 5a629e6

Upload 3 files

Browse files
Files changed (3) hide show
  1. config.json +285 -0
  2. processing_yield.py +37 -0
  3. processor_config.json +6 -0
config.json ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "K": 52,
3
+ "S": 66,
4
+ "W": 6,
5
+ "architectures": [
6
+ "YieldForRegression"
7
+ ],
8
+ "crop_emb_dim": 8,
9
+ "d_model": 64,
10
+ "dim_ff": 128,
11
+ "dropout": 0.4,
12
+ "dtype": "float32",
13
+ "eval_cutoffs": [
14
+ 20,
15
+ 24,
16
+ 28,
17
+ 32,
18
+ 36,
19
+ 40,
20
+ 44,
21
+ 48,
22
+ 52
23
+ ],
24
+ "model_type": "yield-weather-soil",
25
+ "nhead": 4,
26
+ "num_layers": 4,
27
+ "pool": "last",
28
+ "s_mean": [
29
+ 138.40794372558594,
30
+ 152.29786682128906,
31
+ 154.56175231933594,
32
+ 160.80038452148438,
33
+ 164.22401428222656,
34
+ 165.8285675048828,
35
+ 232.1925506591797,
36
+ 211.66586303710938,
37
+ 208.61048889160156,
38
+ 210.4038543701172,
39
+ 196.25576782226562,
40
+ 169.04379272460938,
41
+ 16.51355743408203,
42
+ 16.052227020263672,
43
+ 16.29838752746582,
44
+ 18.991479873657227,
45
+ 26.101285934448242,
46
+ 35.37116241455078,
47
+ 293.3885192871094,
48
+ 296.4434814453125,
49
+ 315.0303039550781,
50
+ 331.96435546875,
51
+ 329.5356750488281,
52
+ 309.2357177734375,
53
+ 3859.735107421875,
54
+ 2151.462158203125,
55
+ 1574.3883056640625,
56
+ 1057.6832275390625,
57
+ 792.9168090820312,
58
+ 640.056884765625,
59
+ 401.9707946777344,
60
+ 282.0995178222656,
61
+ 218.99769592285156,
62
+ 119.24910736083984,
63
+ 71.83614349365234,
64
+ 44.02671432495117,
65
+ 61.37840270996094,
66
+ 61.37840270996094,
67
+ 61.37840270996094,
68
+ 61.37840270996094,
69
+ 61.37840270996094,
70
+ 61.37840270996094,
71
+ 64.16217041015625,
72
+ 64.32339477539062,
73
+ 64.31382751464844,
74
+ 65.56702423095703,
75
+ 68.18431854248047,
76
+ 71.56515502929688,
77
+ 197.78048706054688,
78
+ 196.43638610839844,
79
+ 191.7803955078125,
80
+ 190.5934295654297,
81
+ 205.2471466064453,
82
+ 238.66366577148438,
83
+ 508.832275390625,
84
+ 507.11798095703125,
85
+ 493.1898193359375,
86
+ 477.44244384765625,
87
+ 465.2177429199219,
88
+ 452.10076904296875,
89
+ 347.4835510253906,
90
+ 207.85842895507812,
91
+ 140.189453125,
92
+ 88.9273681640625,
93
+ 50.258174896240234,
94
+ 35.850830078125
95
+ ],
96
+ "s_std": [
97
+ 5.658433437347412,
98
+ 4.963406562805176,
99
+ 4.842231273651123,
100
+ 6.4795145988464355,
101
+ 7.407203674316406,
102
+ 8.543693542480469,
103
+ 32.758174896240234,
104
+ 43.4786262512207,
105
+ 41.363216400146484,
106
+ 36.315101623535156,
107
+ 37.40601348876953,
108
+ 44.32140350341797,
109
+ 14.699563980102539,
110
+ 14.964685440063477,
111
+ 15.500894546508789,
112
+ 18.559709548950195,
113
+ 22.95189666748047,
114
+ 28.39887046813965,
115
+ 55.16016387939453,
116
+ 54.736392974853516,
117
+ 54.40840148925781,
118
+ 57.90495681762695,
119
+ 59.78011703491211,
120
+ 68.35675048828125,
121
+ 1374.9456787109375,
122
+ 633.04736328125,
123
+ 509.03704833984375,
124
+ 386.8252258300781,
125
+ 327.8870849609375,
126
+ 311.1480407714844,
127
+ 57.87489318847656,
128
+ 59.43294906616211,
129
+ 50.55767059326172,
130
+ 27.027706146240234,
131
+ 13.878527641296387,
132
+ 10.90867805480957,
133
+ 14.719537734985352,
134
+ 14.719537734985352,
135
+ 14.719537734985352,
136
+ 14.719537734985352,
137
+ 14.719537734985352,
138
+ 14.719537734985352,
139
+ 3.2984049320220947,
140
+ 3.6471333503723145,
141
+ 4.528029441833496,
142
+ 6.537323951721191,
143
+ 7.542074203491211,
144
+ 6.777342796325684,
145
+ 131.77452087402344,
146
+ 133.4365692138672,
147
+ 134.30154418945312,
148
+ 137.3269500732422,
149
+ 143.42730712890625,
150
+ 147.23556518554688,
151
+ 106.86735534667969,
152
+ 106.61359405517578,
153
+ 99.10890197753906,
154
+ 93.6629638671875,
155
+ 95.26378631591797,
156
+ 95.61508178710938,
157
+ 88.6065444946289,
158
+ 62.81496047973633,
159
+ 45.79389190673828,
160
+ 31.114017486572266,
161
+ 18.991355895996094,
162
+ 19.752763748168945
163
+ ],
164
+ "soil_vars": [
165
+ "bdod_mean_0-5cm",
166
+ "bdod_mean_5-15cm",
167
+ "bdod_mean_15-30cm",
168
+ "bdod_mean_30-60cm",
169
+ "bdod_mean_60-100cm",
170
+ "bdod_mean_100-200cm",
171
+ "cec_mean_0-5cm",
172
+ "cec_mean_5-15cm",
173
+ "cec_mean_15-30cm",
174
+ "cec_mean_30-60cm",
175
+ "cec_mean_60-100cm",
176
+ "cec_mean_100-200cm",
177
+ "cfvo_mean_0-5cm",
178
+ "cfvo_mean_5-15cm",
179
+ "cfvo_mean_15-30cm",
180
+ "cfvo_mean_30-60cm",
181
+ "cfvo_mean_60-100cm",
182
+ "cfvo_mean_100-200cm",
183
+ "clay_mean_0-5cm",
184
+ "clay_mean_5-15cm",
185
+ "clay_mean_15-30cm",
186
+ "clay_mean_30-60cm",
187
+ "clay_mean_60-100cm",
188
+ "clay_mean_100-200cm",
189
+ "nitrogen_mean_0-5cm",
190
+ "nitrogen_mean_5-15cm",
191
+ "nitrogen_mean_15-30cm",
192
+ "nitrogen_mean_30-60cm",
193
+ "nitrogen_mean_60-100cm",
194
+ "nitrogen_mean_100-200cm",
195
+ "ocd_mean_0-5cm",
196
+ "ocd_mean_5-15cm",
197
+ "ocd_mean_15-30cm",
198
+ "ocd_mean_30-60cm",
199
+ "ocd_mean_60-100cm",
200
+ "ocd_mean_100-200cm",
201
+ "ocs_mean_0-5cm",
202
+ "ocs_mean_5-15cm",
203
+ "ocs_mean_15-30cm",
204
+ "ocs_mean_30-60cm",
205
+ "ocs_mean_60-100cm",
206
+ "ocs_mean_100-200cm",
207
+ "phh2o_mean_0-5cm",
208
+ "phh2o_mean_5-15cm",
209
+ "phh2o_mean_15-30cm",
210
+ "phh2o_mean_30-60cm",
211
+ "phh2o_mean_60-100cm",
212
+ "phh2o_mean_100-200cm",
213
+ "sand_mean_0-5cm",
214
+ "sand_mean_5-15cm",
215
+ "sand_mean_15-30cm",
216
+ "sand_mean_30-60cm",
217
+ "sand_mean_60-100cm",
218
+ "sand_mean_100-200cm",
219
+ "silt_mean_0-5cm",
220
+ "silt_mean_5-15cm",
221
+ "silt_mean_15-30cm",
222
+ "silt_mean_30-60cm",
223
+ "silt_mean_60-100cm",
224
+ "silt_mean_100-200cm",
225
+ "soc_mean_0-5cm",
226
+ "soc_mean_5-15cm",
227
+ "soc_mean_15-30cm",
228
+ "soc_mean_30-60cm",
229
+ "soc_mean_60-100cm",
230
+ "soc_mean_100-200cm"
231
+ ],
232
+ "train_cutoffs": [
233
+ 20,
234
+ 24,
235
+ 28,
236
+ 32,
237
+ 36,
238
+ 40,
239
+ 44,
240
+ 48,
241
+ 52
242
+ ],
243
+ "transformers_version": "5.13.0",
244
+ "use_crop": true,
245
+ "w_mean": [
246
+ 2.6932172775268555,
247
+ 319.30352783203125,
248
+ 5.36029577255249,
249
+ 15.82466983795166,
250
+ 3.981907606124878,
251
+ 1018.5076904296875
252
+ ],
253
+ "w_std": [
254
+ 3.367875814437866,
255
+ 91.14374542236328,
256
+ 13.447235107421875,
257
+ 11.749135971069336,
258
+ 11.175808906555176,
259
+ 684.6181030273438
260
+ ],
261
+ "weather_vars": [
262
+ "prcp",
263
+ "srad",
264
+ "swe",
265
+ "tmax",
266
+ "tmin",
267
+ "vp"
268
+ ],
269
+ "y_mean": 166.3075714111328,
270
+ "y_std": 30.291048049926758,
271
+ "processor_class": "YieldProcessor",
272
+ "auto_map": {
273
+ "AutoConfig": "configuration_yield.YieldConfig",
274
+ "AutoModel": "modeling_yield.YieldForRegression",
275
+ "AutoProcessor": "processing_yield.YieldProcessor"
276
+ },
277
+ "custom_pipelines": {
278
+ "yield-estimation": {
279
+ "impl": "pipeline_yield.YieldEstimationPipeline",
280
+ "pt": [
281
+ "AutoModel"
282
+ ]
283
+ }
284
+ }
285
+ }
processing_yield.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # processing_yield.py
2
+
3
+ import json
4
+ from transformers.processing_utils import ProcessorMixin
5
+
6
+
7
+ class YieldProcessor(ProcessorMixin):
8
+ attributes = []
9
+ valid_kwargs = []
10
+
11
+ def __init__(self, **kwargs):
12
+ super().__init__()
13
+
14
+ def __call__(self, inputs=None, **kwargs):
15
+ """
16
+ Accept either:
17
+ 1. the existing dictionary input, or
18
+ 2. a JSON string containing that dictionary.
19
+ """
20
+ if inputs is None:
21
+ inputs = kwargs
22
+
23
+ if isinstance(inputs, str):
24
+ try:
25
+ inputs = json.loads(inputs)
26
+ except json.JSONDecodeError as e:
27
+ raise ValueError(
28
+ "YieldProcessor expected a JSON string "
29
+ "representing the model input."
30
+ ) from e
31
+
32
+ if not isinstance(inputs, dict):
33
+ raise ValueError(
34
+ "YieldProcessor expects a dictionary or JSON string."
35
+ )
36
+
37
+ return inputs
processor_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "processor_class": "YieldProcessor",
3
+ "auto_map": {
4
+ "AutoProcessor": "processing_yield.YieldProcessor"
5
+ }
6
+ }