예제 #1
0
    def report(self, compute_time=False):
        def show(metric):
            if 'all' in self.show_metrics or metric in self.show_metrics or metric == 'exs':
                return True
            return False

        show_metrics = self.opt.get('metrics', "all")
        self.show_metrics = show_metrics.split(',')
        metrics = {}
        for a in self.agents:
            if hasattr(a, 'report'):
                m = a.report()
                for k, v in m.items():
                    if k not in metrics:
                        # first agent gets priority in settings values for keys
                        # this way model can't e.g. override accuracy to 100%
                        if show(k):
                            metrics[k] = v
        if metrics:
            if compute_time and 'exs' in metrics:
                self.total_exs += metrics['exs']
                time_metrics = compute_time_metrics(self,
                                                    self.opt['max_train_time'])
                metrics.update(time_metrics)
            return metrics
예제 #2
0
 def report(self, compute_time=False):
     metrics = self.agents[0].report()
     if compute_time:
         self.total_exs += metrics['total']
         time_metrics = compute_time_metrics(self, self.opt['max_train_time'])
         metrics.update(time_metrics)
     return metrics
예제 #3
0
 def report(self, compute_time=False):
     metrics = aggregate_metrics(self.worlds)
     if compute_time:
         self.total_exs += metrics['total']
         time_metrics = compute_time_metrics(self, self.opt['max_train_time'])
         metrics.update(time_metrics)
     return metrics
예제 #4
0
파일: worlds.py 프로젝트: ahiroto/ParlAI
 def report(self, compute_time=False):
     metrics = aggregate_metrics(self.worlds)
     if compute_time:
         self.total_exs += metrics['total']
         time_metrics = compute_time_metrics(self, self.opt['max_train_time'])
         metrics.update(time_metrics)
     return metrics
예제 #5
0
파일: worlds.py 프로젝트: ahiroto/ParlAI
 def report(self, compute_time=False):
     metrics = self.agents[0].report()
     if compute_time:
         self.total_exs += metrics['total']
         time_metrics = compute_time_metrics(self, self.opt['max_train_time'])
         metrics.update(time_metrics)
     return metrics
예제 #6
0
 def report(self, compute_time=False):
     metrics = aggregate_metrics(self.worlds)
     if compute_time:
         self.total_exs += metrics['total']
         if self.num_examples() is not None and self.num_examples() > 0:
             self.total_epochs = int(self.total_exs / self.num_examples())
         time_metrics = compute_time_metrics(self,
                                             self.opt['max_train_time'])
         metrics.update(time_metrics)
     return metrics
예제 #7
0
 def report(self, compute_time=False):
     if hasattr(self.agents[0], 'report'):
         metrics = self.agents[0].report()
         if compute_time:
             self.total_exs += metrics['total']
             if self.num_examples() is not None and self.num_examples() > 0:
                 self.total_epochs = int(self.total_exs /
                                         self.num_examples())
             time_metrics = compute_time_metrics(self,
                                                 self.opt['max_train_time'])
             metrics.update(time_metrics)
         return metrics
예제 #8
0
파일: worlds.py 프로젝트: windweller/ParlAI
 def report(self, compute_time=False):
     metrics = {}
     for a in self.agents:
         if hasattr(a, 'report'):
             m = a.report()
             for k, v in m.items():
                 if k not in metrics:
                     # first agent gets priority in settings values for keys
                     # this way model can't e.g. override accuracy to 100%
                     metrics[k] = v
     if metrics:
         if compute_time and 'exs' in metrics:
             self.total_exs += metrics['exs']
             time_metrics = compute_time_metrics(self, self.opt['max_train_time'])
             metrics.update(time_metrics)
         return metrics