-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from hrntsm/develop
Release v0.10.0
- Loading branch information
Showing
41 changed files
with
17,172 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: dotnet optuna tests | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: "7.0.x" | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build | ||
- name: Test with the dotnet CLI | ||
run: dotnet test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -460,3 +460,4 @@ $RECYCLE.BIN/ | |
## add by me | ||
Tunny/Lib/python.zip | ||
Tunny/Lib/whl.zip | ||
!OptunaTests/TestFile/*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.IO; | ||
|
||
namespace Optuna.Dashboard | ||
{ | ||
public class Handler | ||
{ | ||
private readonly string _dashboardPath; | ||
private readonly string _storage; | ||
private readonly string _host; | ||
private readonly string _port; | ||
private readonly string _artifactDir; | ||
|
||
public Handler(string dashboardPath, string storagePath, string artifactDir = null, string host = "127.0.0.1", string port = "8080") | ||
{ | ||
_dashboardPath = dashboardPath; | ||
_storage = GetStorageArgument(storagePath); | ||
_host = host; | ||
_port = port; | ||
_artifactDir = artifactDir ?? Path.GetDirectoryName(storagePath) + "/artifacts"; | ||
if (!Directory.Exists(_artifactDir)) | ||
{ | ||
Directory.CreateDirectory(_artifactDir); | ||
} | ||
} | ||
|
||
private static string GetStorageArgument(string path) | ||
{ | ||
switch (Path.GetExtension(path)) | ||
{ | ||
case ".sqlite3": | ||
case ".db": | ||
return @"sqlite:///" + $"\"{path}\""; | ||
case ".log": | ||
return $"\"{path}\""; | ||
default: | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
|
||
public void Run() | ||
{ | ||
CheckExistDashboardProcess(); | ||
string argument = $"{_storage} --host {_host} --port {_port} --artifact-dir {_artifactDir}"; | ||
|
||
var dashboard = new Process(); | ||
dashboard.StartInfo.FileName = _dashboardPath; | ||
dashboard.StartInfo.Arguments = argument; | ||
dashboard.StartInfo.UseShellExecute = false; | ||
dashboard.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; | ||
dashboard.Start(); | ||
|
||
var browser = new Process(); | ||
browser.StartInfo.FileName = $@"http://{_host}:{_port}/"; | ||
browser.StartInfo.UseShellExecute = true; | ||
browser.Start(); | ||
} | ||
|
||
private static void CheckExistDashboardProcess() | ||
{ | ||
Process[] dashboardProcess = Process.GetProcessesByName("optuna-dashboard"); | ||
if (dashboardProcess.Length > 0) | ||
{ | ||
foreach (Process p in dashboardProcess) | ||
{ | ||
p.Kill(); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net48</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Collections.Generic; | ||
|
||
using Optuna.Study; | ||
using Optuna.Trial; | ||
|
||
namespace Optuna.Storage | ||
{ | ||
public abstract class BaseStorage | ||
{ | ||
// Basic study manipulation | ||
public abstract int CreateNewStudy(StudyDirection[] studyDirections, string studyName); | ||
public abstract void DeleteStudy(int studyId); | ||
public abstract void SetStudyUserAttr(int studyId, string key, object value); | ||
public abstract void SetStudySystemAttr(int studyId, string key, object value); | ||
|
||
// Basic study access | ||
public abstract int GetStudyIdFromName(string studyName); | ||
public abstract string GetStudyNameFromId(int studyId); | ||
public abstract StudyDirection[] GetStudyDirections(int studyId); | ||
public abstract Dictionary<string, object> GetStudyUserAttrs(int studyId); | ||
public abstract Dictionary<string, object> GetStudySystemAttrs(int studyId); | ||
public abstract Study.Study[] GetAllStudies(); | ||
|
||
// Basic trial manipulation | ||
public abstract int CreateNewTrial(int studyId, Trial.Trial templateTrial = null); | ||
public abstract void SetTrailParam(int trialId, string paramName, double paramValueInternal, object distribution); | ||
public abstract int GetTrialIdFromStudyIdTrialNumber(int studyId, int trialNumber); | ||
public abstract int GetTrialNumberFromId(int trialId); | ||
public abstract double GetTrialParam(int trialId, string paramName); | ||
public abstract bool SetTrialStateValue(int trialId, TrialState state, double[] values = null); | ||
public abstract void SetTrialIntermediateValue(int trialId, int step, double intermediateValue); | ||
public abstract void SetTrialUserAttr(int trialId, string key, object value); | ||
public abstract void SetTrialSystemAttr(int trialId, string key, object value); | ||
|
||
// Basic trial access | ||
public abstract Trial.Trial GetTrial(int trialId); | ||
public abstract Trial.Trial[] GetAllTrials(int studyId, bool deepcopy = true); | ||
public abstract int GetNTrials(int studyId); | ||
public abstract Trial.Trial GetBestTrial(int studyId); | ||
public abstract Dictionary<string, object> GetTrialParams(int trialId); | ||
public abstract Dictionary<string, object> GetTrialUserAttrs(int trialId); | ||
public abstract Dictionary<string, object> GetTrialSystemAttrs(int trialId); | ||
public abstract void RemoveSession(); | ||
public abstract void CheckTrialIsUpdatable(int trialId, TrialState trialState); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Optuna.Storage.Journal | ||
{ | ||
public enum JournalOperation | ||
{ | ||
CreateStudy = 0, | ||
DeleteStudy = 1, | ||
SetStudyUserAttr = 2, | ||
SetStudySystemAttr = 3, | ||
CreateTrial = 4, | ||
SetTrialParam = 5, | ||
SetTrialStateValues = 6, | ||
SetTrialIntermediateValue = 7, | ||
SetTrialUserAttr = 8, | ||
SetTrialSystemAttr = 9, | ||
} | ||
} |
Oops, something went wrong.