Upload fusion.py with huggingface_hub
Browse files
fusion.py
CHANGED
@@ -3,7 +3,7 @@ from abc import abstractmethod
|
|
3 |
from typing import Generator, List, Optional
|
4 |
|
5 |
from .dataclass import NonPositionalField
|
6 |
-
from .operator import SourceOperator
|
7 |
from .random_utils import new_random_generator
|
8 |
from .stream import MultiStream, Stream
|
9 |
|
@@ -15,7 +15,7 @@ class BaseFusion(SourceOperator):
|
|
15 |
include_splits: List of splits to include. If None, all splits are included.
|
16 |
"""
|
17 |
|
18 |
-
origins: List[
|
19 |
include_splits: Optional[List[str]] = NonPositionalField(default=None)
|
20 |
|
21 |
@abstractmethod
|
@@ -44,7 +44,7 @@ class FixedFusion(BaseFusion):
|
|
44 |
"""FixedFusion operator that combines multiple streams into one based on a fixed number of examples per task.
|
45 |
|
46 |
Args:
|
47 |
-
orgins: List of
|
48 |
examples_per_task: Number of examples per task. If None, all examples are returned.
|
49 |
splits: List of splits to include. If None, all splits are included.
|
50 |
"""
|
@@ -68,12 +68,12 @@ class WeightedFusion(BaseFusion):
|
|
68 |
"""Fusion operator that combines multiple streams based.
|
69 |
|
70 |
Args:
|
71 |
-
orgins: List of
|
72 |
weights: List of weights for each origin.
|
73 |
max_total_examples: Total number of examples to return. If None, all examples are returned.
|
74 |
"""
|
75 |
|
76 |
-
origins: List[
|
77 |
weights: List[float] = None
|
78 |
max_total_examples: int = None
|
79 |
|
|
|
3 |
from typing import Generator, List, Optional
|
4 |
|
5 |
from .dataclass import NonPositionalField
|
6 |
+
from .operator import SourceOperator
|
7 |
from .random_utils import new_random_generator
|
8 |
from .stream import MultiStream, Stream
|
9 |
|
|
|
15 |
include_splits: List of splits to include. If None, all splits are included.
|
16 |
"""
|
17 |
|
18 |
+
origins: List[SourceOperator]
|
19 |
include_splits: Optional[List[str]] = NonPositionalField(default=None)
|
20 |
|
21 |
@abstractmethod
|
|
|
44 |
"""FixedFusion operator that combines multiple streams into one based on a fixed number of examples per task.
|
45 |
|
46 |
Args:
|
47 |
+
orgins: List of SourceOperator objects.
|
48 |
examples_per_task: Number of examples per task. If None, all examples are returned.
|
49 |
splits: List of splits to include. If None, all splits are included.
|
50 |
"""
|
|
|
68 |
"""Fusion operator that combines multiple streams based.
|
69 |
|
70 |
Args:
|
71 |
+
orgins: List of SourceOperator objects.
|
72 |
weights: List of weights for each origin.
|
73 |
max_total_examples: Total number of examples to return. If None, all examples are returned.
|
74 |
"""
|
75 |
|
76 |
+
origins: List[SourceOperator] = None
|
77 |
weights: List[float] = None
|
78 |
max_total_examples: int = None
|
79 |
|