Upload standard.py with huggingface_hub
Browse files- standard.py +6 -3
standard.py
CHANGED
@@ -187,6 +187,11 @@ class BaseRecipe(Recipe, SourceSequentialOperator):
|
|
187 |
return list(multi_stream["__inference__"])
|
188 |
|
189 |
def prepare(self):
|
|
|
|
|
|
|
|
|
|
|
190 |
self.set_pipelines()
|
191 |
|
192 |
loader = self.card.loader
|
@@ -220,7 +225,7 @@ class BaseRecipe(Recipe, SourceSequentialOperator):
|
|
220 |
self.augmentor.set_task_input_fields(self.card.task.augmentable_inputs)
|
221 |
self.processing.steps.append(self.augmentor)
|
222 |
|
223 |
-
if self.
|
224 |
self.processing.steps.append(
|
225 |
CreateDemosPool(
|
226 |
from_split=self.demos_taken_from,
|
@@ -229,8 +234,6 @@ class BaseRecipe(Recipe, SourceSequentialOperator):
|
|
229 |
remove_targets_from_source_split=self.demos_removed_from_data,
|
230 |
)
|
231 |
)
|
232 |
-
|
233 |
-
if self.num_demos > 0:
|
234 |
if self.sampler is None:
|
235 |
if self.card.sampler is None:
|
236 |
raise ValueError(
|
|
|
187 |
return list(multi_stream["__inference__"])
|
188 |
|
189 |
def prepare(self):
|
190 |
+
# To avoid the Python's mutable default list trap, we set the default value to None
|
191 |
+
# and then set it to an empty list if it is None.
|
192 |
+
if self.card.preprocess_steps is None:
|
193 |
+
self.card.preprocess_steps = []
|
194 |
+
|
195 |
self.set_pipelines()
|
196 |
|
197 |
loader = self.card.loader
|
|
|
225 |
self.augmentor.set_task_input_fields(self.card.task.augmentable_inputs)
|
226 |
self.processing.steps.append(self.augmentor)
|
227 |
|
228 |
+
if self.num_demos > 0:
|
229 |
self.processing.steps.append(
|
230 |
CreateDemosPool(
|
231 |
from_split=self.demos_taken_from,
|
|
|
234 |
remove_targets_from_source_split=self.demos_removed_from_data,
|
235 |
)
|
236 |
)
|
|
|
|
|
237 |
if self.sampler is None:
|
238 |
if self.card.sampler is None:
|
239 |
raise ValueError(
|