From 0aebb8b1b8e7e95cf749eace7e60dae0b39dd4d2 Mon Sep 17 00:00:00 2001 From: weirukai <2624411907@qq.com> Date: Tue, 26 Sep 2023 16:30:53 +0800 Subject: [PATCH] add new parameter History_path for transfer-learning-based bo tuning --- api/profile/profile.pb.go | 11 +++++++++++ api/profile/profile.proto | 2 ++ common/models/optimizer.go | 1 + common/project/project.go | 1 + common/tuning/optimizer.go | 1 + modules/client/profile/profile_tuning.go | 1 + modules/server/profile/profile.go | 1 + 7 files changed, 18 insertions(+) diff --git a/api/profile/profile.pb.go b/api/profile/profile.pb.go index 2e7827c9..d2011632 100644 --- a/api/profile/profile.pb.go +++ b/api/profile/profile.pb.go @@ -36,6 +36,7 @@ const ( TuningMessage_Threshold TuningMessageStatus = 8 TuningMessage_JobCreate TuningMessageStatus = 9 TuningMessage_GetInitialConfig TuningMessageStatus = 10 + TuningMessage_GetHistoryPath TuningMessageStatus = 11 ) var TuningMessageStatus_name = map[int32]string{ @@ -50,6 +51,7 @@ var TuningMessageStatus_name = map[int32]string{ 8: "Threshold", 9: "JobCreate", 10: "GetInitialConfig", + 11: "GetHistoryPath", } var TuningMessageStatus_value = map[string]int32{ @@ -64,6 +66,7 @@ var TuningMessageStatus_value = map[string]int32{ "Threshold": 8, "JobCreate": 9, "GetInitialConfig": 10, + "GetHistoryPath": 11, } func (x TuningMessageStatus) String() string { @@ -673,6 +676,7 @@ type TuningMessage struct { EvalFluctuation float64 `protobuf:"fixed64,14,opt,name=EvalFluctuation,proto3" json:"EvalFluctuation,omitempty"` FeatureSelector string `protobuf:"bytes,15,opt,name=FeatureSelector,proto3" json:"FeatureSelector,omitempty"` InitialConfig string `protobuf:"bytes,16,opt,name=InitialConfig,proto3" json:"InitialConfig,omitempty"` + HistoryPath []string `protobuf:"bytes,17,opt,name=HistoryPath,proto3" json:"HistoryPath,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -738,6 +742,13 @@ func (m *TuningMessage) GetRandomStarts() int32 { return 0 } +func (m *TuningMessage) GetHistoryPath() []string { + if m != nil { + return m.HistoryPath + } + return nil +} + func (m *TuningMessage) GetFeatureFilterEngine() string { if m != nil { return m.FeatureFilterEngine diff --git a/api/profile/profile.proto b/api/profile/profile.proto index c75041fb..2237573a 100755 --- a/api/profile/profile.proto +++ b/api/profile/profile.proto @@ -121,6 +121,7 @@ message TuningMessage { Threshold = 8; JobCreate = 9; GetInitialConfig = 10; + GetHistoryPath = 11; } status state = 4; int32 RandomStarts = 5; @@ -135,6 +136,7 @@ message TuningMessage { double EvalFluctuation = 14; string FeatureSelector = 15; string InitialConfig = 16; + []string HistoryPath = 17; } message TuningHistory { diff --git a/common/models/optimizer.go b/common/models/optimizer.go index a1551733..254bc07c 100644 --- a/common/models/optimizer.go +++ b/common/models/optimizer.go @@ -28,6 +28,7 @@ type OptimizerPostBody struct { Knobs []Knob `json:"knobs"` Engine string `json:"engine"` RandomStarts int32 `json:"random_starts"` + HistoryPath []string `json:"history_path"` Xref [][]string `json:"x_ref,omitempty"` Yref []string `json:"y_ref,omitempty"` FeatureFilter bool `json:"feature_filter"` diff --git a/common/project/project.go b/common/project/project.go index ab6d992e..19c7cb46 100644 --- a/common/project/project.go +++ b/common/project/project.go @@ -58,6 +58,7 @@ type YamlPrjCli struct { RandomStarts int32 `yaml:"random_starts"` Benchmark string `yaml:"benchmark"` Engine string `yaml:"engine"` + HistoryPath []string `yaml:"history_path"` FeatureFilterEngine string `yaml:"feature_filter_engine"` FeatureFilterCycle int32 `yaml:"feature_filter_cycle"` FeatureFilterIters int32 `yaml:"feature_filter_iters"` diff --git a/common/tuning/optimizer.go b/common/tuning/optimizer.go index 293ca903..44965a6c 100644 --- a/common/tuning/optimizer.go +++ b/common/tuning/optimizer.go @@ -51,6 +51,7 @@ type Optimizer struct { SplitCount int32 EvalFluctuation float64 RandomStarts int32 + HistoryPath []string OptimizerPutURL string FinalEval string Engine string diff --git a/modules/client/profile/profile_tuning.go b/modules/client/profile/profile_tuning.go index 442b06f7..2510b8df 100644 --- a/modules/client/profile/profile_tuning.go +++ b/modules/client/profile/profile_tuning.go @@ -128,6 +128,7 @@ func profileTunning(ctx *cli.Context) error { Name: ctx.String("project"), Restart: ctx.Bool("restart"), RandomStarts: prj.RandomStarts, + HistoryPath: prj.HistoryPath, Engine: prj.Engine, State: state, Content: []byte(strconv.Itoa(int(prj.Iterations))), diff --git a/modules/server/profile/profile.go b/modules/server/profile/profile.go index c6846552..a2cb503c 100644 --- a/modules/server/profile/profile.go +++ b/modules/server/profile/profile.go @@ -758,6 +758,7 @@ func (s *ProfileServer) Tuning(stream PB.ProfileMgr_TuningServer) error { optimizer.Content = reply.GetContent() optimizer.Restart = reply.GetRestart() optimizer.RandomStarts = reply.GetRandomStarts() + optimizer.HistoryPath=reply.GetHistoryPath() optimizer.FeatureFilterEngine = reply.GetFeatureFilterEngine() optimizer.FeatureFilterIters = reply.GetFeatureFilterIters() optimizer.SplitCount = reply.GetSplitCount() -- Gitee