(self, script_args: GRPOScriptArguments)
| 131 | """Multi-task dataset that loads samples for scoring, deficiency detection, and comparison.""" |
| 132 | |
| 133 | def __init__(self, script_args: GRPOScriptArguments): |
| 134 | super().__init__() |
| 135 | self.script_args = script_args |
| 136 | |
| 137 | self.score_samples = [] |
| 138 | self.deficiency_samples = [] |
| 139 | self.comparison_samples = [] |
| 140 | |
| 141 | dataset_config_path = getattr(script_args, "dataset_config", None) |
| 142 | if dataset_config_path: |
| 143 | print(f"Loading all datasets from unified config: {dataset_config_path}") |
| 144 | self._load_from_unified_yaml(dataset_config_path) |
| 145 | else: |
| 146 | # Fallback to individual dataset paths for backward compatibility |
| 147 | score_yaml_path = getattr(script_args, "dataset_score", None) |
| 148 | if score_yaml_path: |
| 149 | print(f"Loading score samples from {score_yaml_path}") |
| 150 | self.score_samples = self._load_samples_from_yaml(score_yaml_path) |
| 151 | |
| 152 | deficiency_yaml_path = getattr(script_args, "dataset_deficiency", None) |
| 153 | if deficiency_yaml_path: |
| 154 | print(f"Loading deficiency samples from {deficiency_yaml_path}") |
| 155 | self.deficiency_samples = self._load_samples_from_yaml(deficiency_yaml_path) |
| 156 | |
| 157 | comparison_yaml_path = getattr(script_args, "dataset_comparison", None) |
| 158 | if comparison_yaml_path: |
| 159 | print(f"Loading comparison samples from {comparison_yaml_path}") |
| 160 | self.comparison_samples = self._load_samples_from_yaml(comparison_yaml_path) |
| 161 | |
| 162 | if not self.score_samples and not self.deficiency_samples and not self.comparison_samples: |
| 163 | raise ValueError("Please provide at least one dataset: --dataset_config or individual dataset paths") |
| 164 | |
| 165 | self.total_len = len(self.score_samples) + len(self.deficiency_samples) + len(self.comparison_samples) |
| 166 | |
| 167 | prompt_file = getattr(script_args, "score_prompt_file", None) |
| 168 | if prompt_file and os.path.exists(prompt_file): |
| 169 | with open(prompt_file, "r", encoding="utf-8") as pf: |
| 170 | self.score_prompt_text = pf.read().strip() |
| 171 | else: |
| 172 | self.score_prompt_text = SCORE_QUESTION_PROMPT |
| 173 | |
| 174 | self.deficiency_prompt_text = DEFICIENCY_PROMPT |
| 175 | self.comparison_prompt_text = COMPARE_QUESTION_PROMPT |
| 176 | |
| 177 | def _load_from_unified_yaml(self, data_path: str): |
| 178 | """Load samples from unified YAML config that contains all task types.""" |
nothing calls this directly
no test coverage detected