Exemplo n.º 1
0
    def testTBX(self):
        config = {
            "a": 2,
            "b": [1, 2],
            "c": {
                "c": {
                    "D": 123
                }
            },
            "int32": np.int32(1),
            "int64": np.int64(2),
            "bool8": np.bool8(True),
            "float32": np.float32(3),
            "float64": np.float64(4),
            "bad": np.float128(4),
        }
        t = Trial(
            evaluated_params=config, trial_id="tbx", logdir=self.test_dir)
        logger = TBXLoggerCallback()
        logger.on_trial_result(0, [], t, result(0, 4))
        logger.on_trial_result(1, [], t, result(1, 5))
        logger.on_trial_result(
            2, [], t, result(2, 6, score=[1, 2, 3], hello={"world": 1}))

        logger.on_trial_complete(3, [], t)

        self._validate_tbx_result(
            params=(b"float32", b"float64", b"int32", b"int64", b"bool8"),
            excluded_params=(b"bad", ))
Exemplo n.º 2
0
 def testBadTBX(self):
     config = {"b": (1, 2, 3)}
     t = Trial(
         evaluated_params=config, trial_id="tbx", logdir=self.test_dir)
     logger = TBXLoggerCallback()
     logger.on_trial_result(0, [], t, result(0, 4))
     logger.on_trial_result(1, [], t, result(1, 5))
     logger.on_trial_result(
         2, [], t, result(2, 6, score=[1, 2, 3], hello={"world": 1}))
     with self.assertLogs("ray.tune.logger", level="INFO") as cm:
         logger.on_trial_complete(3, [], t)
     assert "INFO" in cm.output[0]
Exemplo n.º 3
0
    def testTBX(self):
        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",
                  logdir=self.test_dir)
        logger = TBXLoggerCallback()
        logger.on_trial_result(0, [], t, result(0, 4))
        logger.on_trial_result(1, [], t, result(1, 5))
        logger.on_trial_result(
            2, [], t, result(2, 6, score=[1, 2, 3], hello={"world": 1}))

        logger.on_trial_complete(3, [], t)

        self._validate_tbx_result()