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