Skip to content

Dummy TaskPool

The DummyTaskPool is used for debugging purposes. It inherits from the base TaskPool class.

Reference

DummyTaskPool

Bases: TaskPool

This is a dummy task pool used for debugging purposes. It inherits from the base TaskPool class.

Source code in fusion_bench/taskpool/dummy.py
class DummyTaskPool(TaskPool):
    """
    This is a dummy task pool used for debugging purposes. It inherits from the base TaskPool class.
    """

    def evaluate(self, model):
        """
        Evaluate the given model.
        This method does nothing but print the parameters of the model in a human-readable format.

        Args:
            model: The model to evaluate.
        """
        print_parameters(model, is_human_readable=True)

        if self.config.get("model_save_path", None) is not None:
            model_save_path = self.config.model_save_path
            with timeit_context(f"Saving the model to {model_save_path}"):
                separate_save(model, model_save_path)

        report = {}
        training_params, all_params = count_parameters(model)
        report["model_info"] = {
            "trainable_params": training_params,
            "all_params": all_params,
            "trainable_percentage": training_params / all_params,
        }
        return report
evaluate(model)

Evaluate the given model. This method does nothing but print the parameters of the model in a human-readable format.

Parameters:

  • model

    The model to evaluate.

Source code in fusion_bench/taskpool/dummy.py
def evaluate(self, model):
    """
    Evaluate the given model.
    This method does nothing but print the parameters of the model in a human-readable format.

    Args:
        model: The model to evaluate.
    """
    print_parameters(model, is_human_readable=True)

    if self.config.get("model_save_path", None) is not None:
        model_save_path = self.config.model_save_path
        with timeit_context(f"Saving the model to {model_save_path}"):
            separate_save(model, model_save_path)

    report = {}
    training_params, all_params = count_parameters(model)
    report["model_info"] = {
        "trainable_params": training_params,
        "all_params": all_params,
        "trainable_percentage": training_params / all_params,
    }
    return report