mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
move delayed and wrap_non_picklable_objects from hyperopt to hyperopt_optimizer
This commit is contained in:
@@ -14,7 +14,7 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import rapidjson
|
||||
from joblib import Parallel, cpu_count, delayed, wrap_non_picklable_objects
|
||||
from joblib import Parallel, cpu_count
|
||||
|
||||
from freqtrade.constants import FTHYPT_FILEVERSION, LAST_BT_RESULT_FN, Config
|
||||
from freqtrade.enums import HyperoptState
|
||||
@@ -160,9 +160,7 @@ class Hyperopt:
|
||||
|
||||
return self.hyperopter.generate_optimizer(*args, **kwargs)
|
||||
|
||||
return parallel(
|
||||
delayed(wrap_non_picklable_objects(optimizer_wrapper))(v) for v in asked
|
||||
)
|
||||
return parallel(optimizer_wrapper(v) for v in asked)
|
||||
|
||||
def _set_random_state(self, random_state: int | None) -> int:
|
||||
return random_state or random.randint(1, 2**16 - 1) # noqa: S311
|
||||
|
||||
@@ -11,7 +11,7 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import optuna
|
||||
from joblib import dump, load
|
||||
from joblib import dump, load, delayed, wrap_non_picklable_objects
|
||||
from joblib.externals import cloudpickle
|
||||
from optuna.exceptions import ExperimentalWarning
|
||||
from pandas import DataFrame
|
||||
@@ -260,6 +260,8 @@ class HyperOptimizer:
|
||||
# noinspection PyProtectedMember
|
||||
attr.value = params_dict[attr_name]
|
||||
|
||||
@delayed
|
||||
@wrap_non_picklable_objects
|
||||
def generate_optimizer(self, raw_params: dict[str, Any]) -> dict[str, Any]:
|
||||
"""
|
||||
Used Optimize function.
|
||||
|
||||
Reference in New Issue
Block a user