formatting
Browse files- cloudops_tsf.py +23 -12
cloudops_tsf.py
CHANGED
|
@@ -269,19 +269,22 @@ class CloudOpsTSF(datasets.ArrowBasedBuilder):
|
|
| 269 |
def _split_generators(self, dl_manager) -> list[datasets.SplitGenerator]:
|
| 270 |
generators = []
|
| 271 |
if self.config.train_test:
|
| 272 |
-
downloaded_files = dl_manager.download_and_extract(
|
|
|
|
|
|
|
| 273 |
generators.append(
|
| 274 |
datasets.SplitGenerator(
|
| 275 |
name=TRAIN_TEST if self.config.train_test else PRETRAIN,
|
| 276 |
-
gen_kwargs={"filepath": downloaded_files}
|
| 277 |
)
|
| 278 |
)
|
| 279 |
if self.config.pretrain:
|
| 280 |
-
downloaded_files = dl_manager.download_and_extract(
|
|
|
|
|
|
|
| 281 |
generators.append(
|
| 282 |
datasets.SplitGenerator(
|
| 283 |
-
name=PRETRAIN,
|
| 284 |
-
gen_kwargs={"filepath": downloaded_files}
|
| 285 |
)
|
| 286 |
)
|
| 287 |
return generators
|
|
@@ -294,13 +297,21 @@ class CloudOpsTSF(datasets.ArrowBasedBuilder):
|
|
| 294 |
schema = batch.schema
|
| 295 |
if self.config.include_metadata:
|
| 296 |
freq = pa.array([self.config.freq] * len(batch))
|
| 297 |
-
prediction_length = pa.array(
|
| 298 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
stride = pa.array([self.config.stride] * len(batch))
|
| 300 |
columns += [freq, prediction_length, rolling_evaluations, stride]
|
| 301 |
-
for pa_field in [
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
|
|
|
|
|
|
| 305 |
schema = schema.append(pa_field)
|
| 306 |
-
yield batch[FieldName.ITEM_ID].to_pylist(), pa.Table.from_arrays(
|
|
|
|
|
|
|
|
|
| 269 |
def _split_generators(self, dl_manager) -> list[datasets.SplitGenerator]:
|
| 270 |
generators = []
|
| 271 |
if self.config.train_test:
|
| 272 |
+
downloaded_files = dl_manager.download_and_extract(
|
| 273 |
+
f"{self.config.name}/train_test.zip"
|
| 274 |
+
)
|
| 275 |
generators.append(
|
| 276 |
datasets.SplitGenerator(
|
| 277 |
name=TRAIN_TEST if self.config.train_test else PRETRAIN,
|
| 278 |
+
gen_kwargs={"filepath": downloaded_files},
|
| 279 |
)
|
| 280 |
)
|
| 281 |
if self.config.pretrain:
|
| 282 |
+
downloaded_files = dl_manager.download_and_extract(
|
| 283 |
+
f"{self.config.name}/pretrain.zip"
|
| 284 |
+
)
|
| 285 |
generators.append(
|
| 286 |
datasets.SplitGenerator(
|
| 287 |
+
name=PRETRAIN, gen_kwargs={"filepath": downloaded_files}
|
|
|
|
| 288 |
)
|
| 289 |
)
|
| 290 |
return generators
|
|
|
|
| 297 |
schema = batch.schema
|
| 298 |
if self.config.include_metadata:
|
| 299 |
freq = pa.array([self.config.freq] * len(batch))
|
| 300 |
+
prediction_length = pa.array(
|
| 301 |
+
[self.config.prediction_length] * len(batch)
|
| 302 |
+
)
|
| 303 |
+
rolling_evaluations = pa.array(
|
| 304 |
+
[self.config.rolling_evaluations] * len(batch)
|
| 305 |
+
)
|
| 306 |
stride = pa.array([self.config.stride] * len(batch))
|
| 307 |
columns += [freq, prediction_length, rolling_evaluations, stride]
|
| 308 |
+
for pa_field in [
|
| 309 |
+
pa.field("freq", pa.string()),
|
| 310 |
+
pa.field("prediction_length", pa.int32()),
|
| 311 |
+
pa.field("rolling_evaluations", pa.int32()),
|
| 312 |
+
pa.field("stride", pa.int32()),
|
| 313 |
+
]:
|
| 314 |
schema = schema.append(pa_field)
|
| 315 |
+
yield batch[FieldName.ITEM_ID].to_pylist(), pa.Table.from_arrays(
|
| 316 |
+
columns, schema=schema
|
| 317 |
+
)
|