import numpy as np
import optuna
import optunahub
def objective(trial: optuna.Trial) -> float:
x = trial.suggest_float("x", -50, -40)
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
import numpy as np | |
from datetime import datetime | |
import optuna | |
import cProfile | |
import time | |
from optuna.visualization._rank import _get_rank_info | |
def sphere(trial: optuna.Trial) -> float: | |
X = np.asarray([trial.suggest_float(f"x{i}", -5, 5) for i in range(10)]) | |
return np.sum(X ** 2) |
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
# Requirements: | |
# $ pip install optuna optuna-dashboard diffusers transformers accelerate scipy safetensors xformers botorch | |
# | |
# Process A: Launch a process that suggest new params and generate images. | |
# $ python generator.py | |
# | |
# Process B: Launch an Optuna Dashboard process. | |
# $ optuna-dashboard sqlite:///db.sqlite3 --artifact-dir ./artifact | |
import os | |
import time |
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
from __future__ import annotations | |
import os | |
import shutil | |
import uuid | |
import tempfile | |
from typing import NoReturn | |
import optuna | |
import streamlit as st |
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
import sys | |
import numpy as np | |
from kurobako import problem | |
from kurobako.problem import Problem | |
from typing import List | |
from typing import Optional | |
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
import argparse | |
import os | |
import subprocess | |
def run(args: argparse.Namespace) -> None: | |
kurobako_cmd = os.path.join(args.path_to_kurobako, "kurobako") | |
subprocess.run(f"{kurobako_cmd} --version", shell=True) | |
if not (os.path.exists(args.data_dir) and os.path.isdir(args.data_dir)): |
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
import math | |
import time | |
import optuna | |
import numpy as np | |
def objective(trial: optuna.Trial, n_params: int) -> float: | |
return sum([ | |
math.sin(trial.suggest_float('param-{}'.format(i), 0, math.pi * 2)) | |
for i in range(n_params) |
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
# Requirements: | |
# $ pip install optuna optuna-dashboard[preferential] diffusers transformers accelerate scipy safetensors xformers | |
# | |
# Process A: Launch a process that suggest new params and generate images. | |
# $ python main.py | |
# | |
# Process B: Launch an Optuna Dashboard process. | |
# $ optuna-dashboard sqlite:///db.sqlite3 --artifact-dir ./artifact | |
import time |
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
# $ docker run -d --rm --platform linux/amd64 -p 5432:5432 -e POSTGRES_USER=root -e POSTGRES_PASSWORD=root -e POSTGRES_DB=optuna --name optuna-postgres postgres:12.10 | |
# $ docker run -it --rm --platform linux/amd64 --network host -v $(pwd):/usr/src python:3.10 bash | |
# # cd /usr/src | |
# # pip install -U setuptools pip psycopg2 | |
# # pip install -e . | |
from __future__ import annotations | |
import math |
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
# docker run -d --rm -p 3306:3306 -e MYSQL_USER=optuna -e MYSQL_DATABASE=optuna -e MYSQL_PASSWORD=password -e MYSQL_ALLOW_EMPTY_PASSWORD=yes --name optuna-mysql mysql:8.0 | |
from __future__ import annotations | |
import math | |
import threading | |
import time | |
from sqlalchemy import event | |
from sqlalchemy.engine.base import Engine |
NewerOlder