Datasets:

ArXiv:
Elron commited on
Commit
afc257f
1 Parent(s): 93437de

Upload standard.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. standard.py +22 -2
standard.py CHANGED
@@ -14,9 +14,9 @@ from .templates import Template
14
 
15
  class StandardRecipe(Recipe, SourceSequntialOperator):
16
  card: TaskCard
17
- template: Template
18
  instruction: Instruction = None
19
- format: ICLFormat = None
20
 
21
  demos_pool_size: int = None
22
  num_demos: int = None
@@ -81,3 +81,23 @@ class StandardRecipe(Recipe, SourceSequntialOperator):
81
  postprocessors=postprocessors,
82
  )
83
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  class StandardRecipe(Recipe, SourceSequntialOperator):
16
  card: TaskCard
17
+ template: Template = None
18
  instruction: Instruction = None
19
+ format: ICLFormat = ICLFormat()
20
 
21
  demos_pool_size: int = None
22
  num_demos: int = None
 
81
  postprocessors=postprocessors,
82
  )
83
  )
84
+
85
+
86
+ class StandardRecipeWithIndexes(StandardRecipe):
87
+ instruction_card_index: int = None
88
+ template_card_index: int = None
89
+
90
+ def prepare(self):
91
+ assert (
92
+ self.template_card_index is None or self.template is None
93
+ ), "Specify either template or template_card_index"
94
+ if self.template_card_index is not None:
95
+ self.template = self.card.templates[int(self.template_card_index)]
96
+
97
+ assert (
98
+ self.instruction_card_index is None or self.instruction is None
99
+ ), "Specify either instruction or instruction_card_index"
100
+ if self.instruction_card_index is not None:
101
+ self.instruction = self.card.instructions[int(self.instruction_card_index)]
102
+
103
+ super().prepare()