Example #1
0
    def add_model(self, name, model, parent=None):
        """
        Propose a model as a solution to a task.

        Task  - The name of the task.  e.g. MNIST
        model - A keras model. Down the road we should support more frameworks.
        """
        task = utils.load_task(name)
        p = None
        if parent is None:
            p = task['address']
        else:
            p = parent

        model_addr = utils.keras2ipfs(model)

        update = {
            'name': name,
            'model': model_addr,
            'task': task['address'],
            'creator': self.id,
            'parent': p
        }

        update_addr = self.api.add_json(update)
        self.publish(channels.add_model(name), update_addr)
        print(f"ADDED NEW MODELS WEIGHT TO {update_addr}")
Example #2
0
    def best_models(self, task):
        self.show_models = widgets.VBox(
            [widgets.HBox([widgets.Label('Model Address')])])
        self.listen_to_channel(channels.add_model(task), self.__added_model)
        self.publish(channels.list_models, task)

        return self.show_models
Example #3
0
    def send_best_model(self, name, model_addr):
        task = utils.load_task(name)

        update = {
            'name': name,
            'model': model_addr,
            'task': task['address'],
            'creator': self.id,
            'parent': task['address']
        }

        update_addr = self.api.add_json(update)
        self.publish(channels.add_model(name), update_addr)

        print("SENDING BEST MODEL!!!!")
Example #4
0
 def listen_for_models(self, task_name):
     self.listen_to_channel(channels.add_model(task_name), self.added_model)
     self.publish(channels.list_models, task_name)