コード例 #1
0
 def testTrialErrorOnStart(self):
     ray.init()
     _default_registry.register(TRAINABLE_CLASS, "asdf", None)
     trial = Trial("asdf")
     try:
         trial.start()
     except Exception as e:
         self.assertIn("a class", str(e))
コード例 #2
0
    def register_custom_model(model_name, model_class):
        """Register a custom model class by name.

        The model can be later used by specifying {"custom_model": model_name}
        in the model config.

        Args:
            model_name (str): Name to register the model under.
            model_class (type): Python class of the model.
        """
        _default_registry.register(RLLIB_MODEL, model_name, model_class)
コード例 #3
0
ファイル: catalog.py プロジェクト: adgirish/ray
    def register_custom_model(model_name, model_class):
        """Register a custom model class by name.

        The model can be later used by specifying {"custom_model": model_name}
        in the model config.

        Args:
            model_name (str): Name to register the model under.
            model_class (type): Python class of the model.
        """
        _default_registry.register(RLLIB_MODEL, model_name, model_class)
コード例 #4
0
    def register_custom_preprocessor(preprocessor_name, preprocessor_class):
        """Register a custom preprocessor class by name.

        The preprocessor can be later used by specifying
        {"custom_preprocessor": preprocesor_name} in the model config.

        Args:
            preprocessor_name (str): Name to register the preprocessor under.
            preprocessor_class (type): Python class of the preprocessor.
        """
        _default_registry.register(RLLIB_PREPROCESSOR, preprocessor_name,
                                   preprocessor_class)
コード例 #5
0
ファイル: catalog.py プロジェクト: adgirish/ray
    def register_custom_preprocessor(preprocessor_name, preprocessor_class):
        """Register a custom preprocessor class by name.

        The preprocessor can be later used by specifying
        {"custom_preprocessor": preprocesor_name} in the model config.

        Args:
            preprocessor_name (str): Name to register the preprocessor under.
            preprocessor_class (type): Python class of the preprocessor.
        """
        _default_registry.register(
            RLLIB_PREPROCESSOR, preprocessor_name, preprocessor_class)
コード例 #6
0
    def testErrorHandling(self):
        ray.init(num_cpus=4, num_gpus=2)
        runner = TrialRunner()
        kwargs = {
            "stopping_criterion": {
                "training_iteration": 1
            },
            "resources": Resources(cpu=1, gpu=1),
        }
        _default_registry.register(TRAINABLE_CLASS, "asdf", None)
        trials = [Trial("asdf", **kwargs), Trial("__fake", **kwargs)]
        for t in trials:
            runner.add_trial(t)

        runner.step()
        self.assertEqual(trials[0].status, Trial.ERROR)
        self.assertEqual(trials[1].status, Trial.PENDING)

        runner.step()
        self.assertEqual(trials[0].status, Trial.ERROR)
        self.assertEqual(trials[1].status, Trial.RUNNING)
コード例 #7
0
ファイル: registry.py プロジェクト: linshiyx/explorl
def register_model(name, model):

    _default_registry.register(RLLIB_MODEL, name, model)