[tune] Add np.bool8 and np.int to allowed HPARAMS types (#9297)

This commit is contained in:
David Fidalgo
2020-07-04 03:34:45 +02:00
committed by GitHub
parent 851d02463b
commit c0ba337fe0
2 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -187,7 +187,7 @@ class TBXLogger(Logger):
"""
# NoneType is not supported on the last TBX release yet.
VALID_HPARAMS = (str, bool, int, float, list)
VALID_HPARAMS = (str, bool, np.bool8, int, np.integer, float, list)
def _init(self):
try:
+12 -1
View File
@@ -2,6 +2,7 @@ from collections import namedtuple
import unittest
import tempfile
import shutil
import numpy as np
from ray.tune.logger import JsonLogger, CSVLogger, TBXLogger
@@ -46,7 +47,17 @@ class LoggerSuite(unittest.TestCase):
logger.close()
def testTBX(self):
config = {"a": 2, "b": [1, 2], "c": {"c": {"D": 123}}}
config = {
"a": 2,
"b": [1, 2],
"c": {
"c": {
"D": 123
}
},
"d": np.int64(1),
"e": np.bool8(True)
}
t = Trial(evaluated_params=config, trial_id="tbx")
logger = TBXLogger(config=config, logdir=self.test_dir, trial=t)
logger.on_result(result(0, 4))