| 225 | } |
| 226 | |
| 227 | async function loadExistingModel(filePath: string): Promise<ExistingModel | null> { |
| 228 | try { |
| 229 | const file = Bun.file(filePath); |
| 230 | if (!(await file.exists())) { |
| 231 | return null; |
| 232 | } |
| 233 | |
| 234 | const toml = await import(filePath, { with: { type: "toml" } }).then((mod) => mod.default); |
| 235 | return toml as ExistingModel; |
| 236 | } catch (cause) { |
| 237 | console.warn(`Warning: Failed to parse existing file ${filePath}:`, cause); |
| 238 | return null; |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | function mergeModel( |
| 243 | apiModel: z.infer<typeof WandbModel>, |