From 2e0a542f338ed13ded3046f4c7cd2281b5777886 Mon Sep 17 00:00:00 2001 From: josc146 Date: Fri, 22 Dec 2023 13:00:13 +0800 Subject: [PATCH] improve train_log.txt creation --- backend-golang/app.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend-golang/app.go b/backend-golang/app.go index 0a7a1ee..10b95f2 100644 --- a/backend-golang/app.go +++ b/backend-golang/app.go @@ -50,9 +50,12 @@ func (a *App) OnStartup(ctx context.Context) { os.Mkdir(a.exDir+"models", os.ModePerm) os.Mkdir(a.exDir+"lora-models", os.ModePerm) os.Mkdir(a.exDir+"finetune/json2binidx_tool/data", os.ModePerm) - f, err := os.Create(a.exDir + "lora-models/train_log.txt") - if err == nil { - f.Close() + trainLogPath := a.exDir + "lora-models/train_log.txt" + if !a.FileExists(trainLogPath) { + f, err := os.Create(trainLogPath) + if err == nil { + f.Close() + } } a.downloadLoop()