chore: added config file and fixed updates not showing while training
This commit is contained in:
@@ -244,6 +244,7 @@ func trainDefinition(c *Context, model *BaseModel, definition_id string, load_pr
|
||||
"SaveModelPath": path.Join(getDir(), result_path),
|
||||
"Depth": classCount,
|
||||
"StartPoint": 0,
|
||||
"Host": (*c.Handle).Config.Hostname,
|
||||
}); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -292,9 +293,9 @@ func generateCvsExpandExp(c *Context, run_path string, model_id string, offset i
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
c.Logger.Info("test here", "count", co)
|
||||
c.Logger.Info("test here", "count", co)
|
||||
count_re = co.Count
|
||||
count := co.Count
|
||||
count := co.Count
|
||||
|
||||
if count == 0 {
|
||||
err = setModelClassStatus(c, MODEL_CLASS_STATUS_TRAINING, "model_id=$1 and status=$2;", model_id, MODEL_CLASS_STATUS_TO_TRAIN)
|
||||
@@ -416,7 +417,7 @@ func trainDefinitionExpandExp(c *Context, model *BaseModel, definition_id string
|
||||
var last *layerrow = nil
|
||||
got_2 := false
|
||||
|
||||
var first *layerrow = nil
|
||||
var first *layerrow = nil
|
||||
|
||||
for layers.Next() {
|
||||
var row = layerrow{}
|
||||
@@ -424,10 +425,10 @@ func trainDefinitionExpandExp(c *Context, model *BaseModel, definition_id string
|
||||
return
|
||||
}
|
||||
|
||||
// Keep track of the first layer so we can keep the size of the image
|
||||
if first == nil {
|
||||
first = &row
|
||||
}
|
||||
// Keep track of the first layer so we can keep the size of the image
|
||||
if first == nil {
|
||||
first = &row
|
||||
}
|
||||
|
||||
row.LayerNum = i
|
||||
row.Shape = shapeToSize(row.Shape)
|
||||
@@ -500,6 +501,7 @@ func trainDefinitionExpandExp(c *Context, model *BaseModel, definition_id string
|
||||
"SaveModelPath": path.Join(getDir(), result_path, "head", exp.Id),
|
||||
"Depth": classCount,
|
||||
"StartPoint": 0,
|
||||
"Host": (*c.Handle).Config.Hostname,
|
||||
}); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -648,6 +650,7 @@ func trainDefinitionExp(c *Context, model *BaseModel, definition_id string, load
|
||||
"SaveModelPath": path.Join(getDir(), result_path),
|
||||
"Depth": classCount,
|
||||
"StartPoint": 0,
|
||||
"Host": (*c.Handle).Config.Hostname,
|
||||
}); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -1618,8 +1621,8 @@ func trainExpandable(c *Context, model *BaseModel) {
|
||||
}
|
||||
|
||||
func trainRetrain(c *Context, model *BaseModel, defId string) {
|
||||
var err error
|
||||
|
||||
var err error
|
||||
|
||||
failed := func() {
|
||||
ResetClasses(c, model)
|
||||
ModelUpdateStatus(c, model.Id, READY_RETRAIN_FAILED)
|
||||
@@ -1631,27 +1634,27 @@ func trainRetrain(c *Context, model *BaseModel, defId string) {
|
||||
acc, err := trainDefinitionExpandExp(c, model, defId, false)
|
||||
if err != nil {
|
||||
c.Logger.Error("Failed to retrain the model", "err", err)
|
||||
failed()
|
||||
return
|
||||
failed()
|
||||
return
|
||||
|
||||
}
|
||||
c.Logger.Info("Retrained model", "accuracy", acc)
|
||||
|
||||
// TODO check accuracy
|
||||
// TODO check accuracy
|
||||
|
||||
err = UpdateStatus(c, "models", model.Id, READY)
|
||||
if err != nil {
|
||||
failed()
|
||||
return
|
||||
}
|
||||
err = UpdateStatus(c, "models", model.Id, READY)
|
||||
if err != nil {
|
||||
failed()
|
||||
return
|
||||
}
|
||||
|
||||
c.Logger.Info("model updaded")
|
||||
c.Logger.Info("model updaded")
|
||||
|
||||
_, err = c.Db.Exec("update model_classes set status=$1 where status=$2 and model_id=$3", MODEL_CLASS_STATUS_TRAINED, MODEL_CLASS_STATUS_TRAINING, model.Id)
|
||||
if err != nil {
|
||||
c.Logger.Error("Error while updating the classes", "error", err)
|
||||
failed()
|
||||
return
|
||||
failed()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user