(self, file_path: str)
| 298 | |
| 299 | |
| 300 | def load_data(self, file_path: str): |
| 301 | with open(file_path, 'r') as f: |
| 302 | data: List[List[str]] = json.load(f) |
| 303 | |
| 304 | output: List[Tuple[List[str], str]] = [] |
| 305 | |
| 306 | for turn in data: |
| 307 | if not isinstance(turn, list) or len(turn) < 2 or not all(turn): |
| 308 | continue |
| 309 | output.append(turn) |
| 310 | |
| 311 | del data |
| 312 | return output |
| 313 | |
| 314 | def format(self, sample: Tuple[List[str], str]) -> Dict[str, Any]: |
| 315 | # original text concat special prompt: human prompt and assistant prompt |