mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 02:12:01 +00:00
Properly support "--no-color" for hyperopt
This commit is contained in:
parent
28f4e1c068
commit
49a60fa67f
|
@ -14,11 +14,11 @@ from pathlib import Path
|
||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
import rapidjson
|
import rapidjson
|
||||||
from colorama import init as colorama_init
|
|
||||||
from joblib import Parallel, cpu_count, delayed, dump, load, wrap_non_picklable_objects
|
from joblib import Parallel, cpu_count, delayed, dump, load, wrap_non_picklable_objects
|
||||||
from joblib.externals import cloudpickle
|
from joblib.externals import cloudpickle
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
from rich.align import Align
|
from rich.align import Align
|
||||||
|
from rich.console import Console
|
||||||
from rich.progress import (
|
from rich.progress import (
|
||||||
BarColumn,
|
BarColumn,
|
||||||
MofNCompleteColumn,
|
MofNCompleteColumn,
|
||||||
|
@ -625,13 +625,13 @@ class Hyperopt:
|
||||||
|
|
||||||
self.opt = self.get_optimizer(self.dimensions, config_jobs)
|
self.opt = self.get_optimizer(self.dimensions, config_jobs)
|
||||||
|
|
||||||
if self.print_colorized:
|
|
||||||
colorama_init(autoreset=True)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with Parallel(n_jobs=config_jobs) as parallel:
|
with Parallel(n_jobs=config_jobs) as parallel:
|
||||||
jobs = parallel._effective_n_jobs()
|
jobs = parallel._effective_n_jobs()
|
||||||
logger.info(f"Effective number of parallel workers used: {jobs}")
|
logger.info(f"Effective number of parallel workers used: {jobs}")
|
||||||
|
console = Console(
|
||||||
|
color_system="auto" if self.print_colorized else None,
|
||||||
|
)
|
||||||
|
|
||||||
# Define progressbar
|
# Define progressbar
|
||||||
with CustomProgress(
|
with CustomProgress(
|
||||||
|
@ -644,6 +644,7 @@ class Hyperopt:
|
||||||
"•",
|
"•",
|
||||||
TimeRemainingColumn(),
|
TimeRemainingColumn(),
|
||||||
expand=True,
|
expand=True,
|
||||||
|
console=console,
|
||||||
cust_objs=[Align.center(self._hyper_out.table)],
|
cust_objs=[Align.center(self._hyper_out.table)],
|
||||||
) as pbar:
|
) as pbar:
|
||||||
task = pbar.add_task("Epochs", total=self.total_epochs)
|
task = pbar.add_task("Epochs", total=self.total_epochs)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user