Upload common.py with huggingface_hub
Browse files
common.py
CHANGED
|
@@ -11,6 +11,7 @@ from typing import Union
|
|
| 11 |
|
| 12 |
|
| 13 |
class CommonRecipe(Recipe, SourceOperator):
|
|
|
|
| 14 |
card: TaskCard
|
| 15 |
demos_pool_name: str = "demos_pool"
|
| 16 |
demos_pool_size: int = None
|
|
@@ -37,8 +38,8 @@ class CommonRecipe(Recipe, SourceOperator):
|
|
| 37 |
steps.append(
|
| 38 |
SliceSplit(
|
| 39 |
slices={
|
| 40 |
-
self.demos_pool_name: f"train[:{self.demos_pool_size}]",
|
| 41 |
-
"train": f"train[{self.demos_pool_size}:]",
|
| 42 |
"validation": "validation",
|
| 43 |
"test": "test",
|
| 44 |
}
|
|
@@ -47,7 +48,7 @@ class CommonRecipe(Recipe, SourceOperator):
|
|
| 47 |
|
| 48 |
if self.num_demos is not None:
|
| 49 |
if self.sampler_type == "random":
|
| 50 |
-
sampler = RandomSampler(sample_size=self.num_demos)
|
| 51 |
|
| 52 |
steps.append(
|
| 53 |
SpreadSplit(
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
class CommonRecipe(Recipe, SourceOperator):
|
| 14 |
+
|
| 15 |
card: TaskCard
|
| 16 |
demos_pool_name: str = "demos_pool"
|
| 17 |
demos_pool_size: int = None
|
|
|
|
| 38 |
steps.append(
|
| 39 |
SliceSplit(
|
| 40 |
slices={
|
| 41 |
+
self.demos_pool_name: f"train[:{int(self.demos_pool_size)}]",
|
| 42 |
+
"train": f"train[{int(self.demos_pool_size)}:]",
|
| 43 |
"validation": "validation",
|
| 44 |
"test": "test",
|
| 45 |
}
|
|
|
|
| 48 |
|
| 49 |
if self.num_demos is not None:
|
| 50 |
if self.sampler_type == "random":
|
| 51 |
+
sampler = RandomSampler(sample_size=int(self.num_demos))
|
| 52 |
|
| 53 |
steps.append(
|
| 54 |
SpreadSplit(
|