Loads data from a list of file paths.
(file_paths)
| 40 | return None |
| 41 | |
| 42 | def load_data(file_paths): |
| 43 | """ |
| 44 | Loads data from a list of file paths. |
| 45 | """ |
| 46 | data = [] |
| 47 | if not file_paths: |
| 48 | return data |
| 49 | |
| 50 | # If a single string is passed, wrap it in a list |
| 51 | if isinstance(file_paths, str): |
| 52 | file_paths = [file_paths] |
| 53 | |
| 54 | for path in file_paths: |
| 55 | try: |
| 56 | with open(path, 'r', encoding='utf-8') as f: |
| 57 | for line in f: |
| 58 | if line.strip(): |
| 59 | try: |
| 60 | data.append(json.loads(line)) |
| 61 | except json.JSONDecodeError: |
| 62 | print(f"Warning: Failed to decode line in {path}") |
| 63 | except FileNotFoundError: |
| 64 | print(f"Error: File not found {path}") |
| 65 | sys.exit(1) |
| 66 | return data |
| 67 | |
| 68 | def evaluate_model(model_items, std_by_task): |
| 69 | """ |