Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ classifiers=[

dependencies = [
"numpy >=1.18.1, <3.0.0",
"tqdm >=4.48.0, <5.0.0",
"pandas <3.0.0",
"gradient-free-optimizers >=1.2.4, <2.0.0",
]
Expand Down
11 changes: 3 additions & 8 deletions src/hyperactive/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
# License: MIT License

from sys import platform
from tqdm import tqdm

if platform.startswith("linux"):
initializer = tqdm.set_lock
initargs = (tqdm.get_lock(),)
else:
initializer = None
initargs = ()

initializer = None
initargs = ()


def single_process(process_func, process_infos):
Expand Down
2 changes: 1 addition & 1 deletion src/hyperactive/optimizers/hyper_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def _setup_process(self, nth_process):

self.conv = self.gfo_optimizer.conv

def search(self, nth_process, p_bar):
def search(self, nth_process, p_bar=None):
self._setup_process(nth_process)

gfo_wrapper_model = ObjectiveFunction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def max_time(self, value):
for optimizer_setup in self.optimizer_setup_l:
optimizer_setup["optimizer"].max_time = value

def search(self, nth_process, p_bar):
def search(self, nth_process, p_bar=None):
for optimizer_setup in self.optimizer_setup_l:
hyper_opt = optimizer_setup["optimizer"]
duration = optimizer_setup["duration"]
Expand Down
14 changes: 2 additions & 12 deletions src/hyperactive/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,9 @@
# License: MIT License


from tqdm import tqdm


def _process_(nth_process, optimizer):
if "progress_bar" in optimizer.verbosity:
p_bar = tqdm(
position=nth_process,
total=optimizer.n_iter,
ascii=" ─",
colour="Yellow",
)
else:
p_bar = None

p_bar = None

optimizer.search(nth_process, p_bar)

Expand Down
14 changes: 0 additions & 14 deletions tests/test_distribution.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import numpy as np
from tqdm import tqdm
from hyperactive import Hyperactive


Expand Down Expand Up @@ -77,19 +76,6 @@ def test_multiprocessing_0():
hyper.run()


def test_multiprocessing_1():
hyper = Hyperactive(
distribution={
"multiprocessing": {
"initializer": tqdm.set_lock,
"initargs": (tqdm.get_lock(),),
}
},
)
hyper.add_search(objective_function, search_space, n_iter=15, n_jobs=2)
hyper.run()


def test_joblib_0():
hyper = Hyperactive(distribution="joblib")
hyper.add_search(objective_function, search_space, n_iter=15, n_jobs=2)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_optimizers/test_gfo_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pytest
import numpy as np

from tqdm import tqdm
from ._parametrize import optimizers
from hyperactive.search_space import SearchSpace

Expand Down Expand Up @@ -99,6 +98,6 @@ def test_gfo_opt_wrapper_0(Optimizer, search_space, objective):
verbosity=verbosity,
)
opt.max_time = None
opt.search(nth_process=0, p_bar=tqdm(total=n_iter))
opt.search(nth_process=0)

assert opt.best_score == objective_function(opt.best_para)
Loading