Ejemplo n.º 1
0
    def test_cwrstar(self):
        model = self.get_model(fast_test=self.fast_test)
        optimizer = SGD(model.parameters(), lr=1e-3)
        criterion = CrossEntropyLoss()

        # SIT scenario
        my_nc_scenario = self.load_scenario(fast_test=self.fast_test)
        last_fc_name, _ = get_last_fc_layer(model)
        strategy = CWRStar(model,
                           optimizer,
                           criterion,
                           last_fc_name,
                           train_mb_size=64,
                           device=self.device)
        self.run_strategy(my_nc_scenario, strategy)

        # MT scenario
        strategy = CWRStar(model,
                           optimizer,
                           criterion,
                           last_fc_name,
                           train_mb_size=64,
                           device=self.device)
        scenario = self.load_scenario(fast_test=self.fast_test,
                                      use_task_labels=True)
        self.run_strategy(scenario, strategy)
Ejemplo n.º 2
0
    def test_cwrstar(self):
        # SIT scenario
        model, optimizer, criterion, my_nc_benchmark = self.init_sit()
        last_fc_name, _ = get_last_fc_layer(model)
        strategy = CWRStar(
            model,
            optimizer,
            criterion,
            last_fc_name,
            train_mb_size=64,
            device=self.device,
        )
        self.run_strategy(my_nc_benchmark, strategy)

        # MT scenario
        strategy = CWRStar(
            model,
            optimizer,
            criterion,
            last_fc_name,
            train_mb_size=64,
            device=self.device,
        )
        benchmark = self.load_benchmark(use_task_labels=True)
        self.run_strategy(benchmark, strategy)