feat: started working on the head part of the split models

This commit is contained in:
2024-02-14 15:11:45 +00:00
parent 508d43bc2f
commit b5a28a0bdb
4 changed files with 196 additions and 84 deletions

View File

@@ -784,23 +784,31 @@ func trainModelExp(c *Context, model *BaseModel) {
failed("Failed to split the model")
return
}
// There should only be one def availabale
def := JustId{}
if err = GetDBOnce(c, &def, "model_definition where model_id=$1", model.Id); err != nil {
return
}
// Remove the base model
c.Logger.Warn("Removing base model for", "model", model.Id, "def", def.Id)
os.RemoveAll(path.Join("savedData", model.Id, "defs", def.Id, "model"))
os.RemoveAll(path.Join("savedData", model.Id, "defs", def.Id, "model.keras"))
ModelUpdateStatus(c, model.Id, READY)
}
func splitModel(c *Context, model *BaseModel) (err error) {
type Def struct {
Id string
}
def := Def{}
def := JustId{}
if err = GetDBOnce(c, &def, "model_definition where model_id=$1", model.Id); err != nil {
return
}
head := Def{}
head := JustId{}
if err = GetDBOnce(c, &head, "exp_model_head where def_id=$1", def.Id); err != nil {
return
@@ -887,8 +895,6 @@ func splitModel(c *Context, model *BaseModel) (err error) {
return
}
func removeFailedDataPoints(c *Context, model *BaseModel) (err error) {
rows, err := c.Db.Query("select mdp.id from model_data_point as mdp join model_classes as mc on mc.id=mdp.class_id where mc.model_id=$1 and mdp.status=-1;", model.Id)
if err != nil {