cyrilzhang
commited on
Commit
·
87d59b4
1
Parent(s):
0a3368a
Update automata.py
Browse files- automata.py +4 -2
automata.py
CHANGED
@@ -17,6 +17,7 @@
|
|
17 |
import csv
|
18 |
import json
|
19 |
import os
|
|
|
20 |
|
21 |
import datasets
|
22 |
import numpy as np
|
@@ -55,7 +56,6 @@ class MockupDataset(datasets.GeneratorBasedBuilder):
|
|
55 |
data_config['size'] = 100
|
56 |
|
57 |
self.data_config = data_config
|
58 |
-
# self.sampler = AutomatonSampler(name, data_config)
|
59 |
self.sampler = dataset_map[name](data_config)
|
60 |
|
61 |
def _info(self):
|
@@ -86,7 +86,9 @@ class MockupDataset(datasets.GeneratorBasedBuilder):
|
|
86 |
|
87 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
88 |
def _generate_examples(self, split):
|
89 |
-
for i in
|
|
|
|
|
90 |
x, y = self.sampler.sample()
|
91 |
yield i, {
|
92 |
"input_ids": x,
|
|
|
17 |
import csv
|
18 |
import json
|
19 |
import os
|
20 |
+
import itertools
|
21 |
|
22 |
import datasets
|
23 |
import numpy as np
|
|
|
56 |
data_config['size'] = 100
|
57 |
|
58 |
self.data_config = data_config
|
|
|
59 |
self.sampler = dataset_map[name](data_config)
|
60 |
|
61 |
def _info(self):
|
|
|
86 |
|
87 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
88 |
def _generate_examples(self, split):
|
89 |
+
for i in itertools.count(start=0):
|
90 |
+
if i == range(self.data_config['size']:
|
91 |
+
break
|
92 |
x, y = self.sampler.sample()
|
93 |
yield i, {
|
94 |
"input_ids": x,
|