-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
319 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
import dataclasses | ||
from enum import Enum | ||
from typing import List, Optional | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class StopStrategy(str, Enum): | ||
FIRST_EXHAUSTED = "first_exhausted" | ||
LAST_EXHAUSTED = "last_exhausted" | ||
NEVER_STOP = "never_stop" | ||
|
||
|
||
class DataDictConfig(BaseModel): | ||
# Path to the dataset, or huggingface dataset id | ||
path: str | ||
# Name of the dataset, or huggingface dataset config/subset | ||
path: str # Name of the dataset, or huggingface dataset config/subset | ||
name: Optional[str] = None | ||
splits: List[str] = dataclasses.field(default_factory=list) | ||
num_samples: Optional[int] = None | ||
total_samples: int = 1 | ||
multiplier: float = 1.0 | ||
streaming: bool = True | ||
user_template: str = "<|audio|>" | ||
assistant_template: str = "{{text}}" | ||
transcript_template: str = "{{text}}" | ||
|
||
def __post_init__(self): | ||
def post_init(self): | ||
if not self.splits: | ||
raise ValueError("At least one split must be provided") | ||
|
||
|
||
class DatasetMultiplier(BaseModel): | ||
dataset: DataDictConfig | ||
multiplier: float | ||
|
||
|
||
class InterleaveDataConfig(BaseModel): | ||
# In InterleaveDataset, when to stop interleave: choose from last_exhausted (default), first_exhausted, or never_stop | ||
stop_strategy: StopStrategy = StopStrategy.LAST_EXHAUSTED | ||
datasets_with_multiplier: List[DatasetMultiplier] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.