Imports a Python module from a given file path.
(program_path: str)
| 136 | |
| 137 | |
| 138 | def _import_program(program_path: str): |
| 139 | """Imports a Python module from a given file path.""" |
| 140 | spec = importlib.util.spec_from_file_location("scaling_law_module", program_path) |
| 141 | if spec is None or spec.loader is None: |
| 142 | raise ImportError(f"Could not create module spec from path: {program_path}") |
| 143 | module = importlib.util.module_from_spec(spec) |
| 144 | spec.loader.exec_module(module) |
| 145 | return module |
| 146 | |
| 147 | def resolve_task_name(program_path: str) -> str: |
| 148 | """Infers the task name from environment variables or the file path.""" |