google-research / nasbench

NASBench: A Neural Architecture Search Dataset and Benchmark
Apache License 2.0
682 stars 129 forks source link

is_valid is true, query function report errors #32

Closed DaweiXi360 closed 3 years ago

DaweiXi360 commented 3 years ago

m = np.array([[0. ,1. ,0. ,1. ,0. ,1. ,1.], [0. ,0. ,0. ,0. ,1. ,1. ,1.], [0. ,0. ,0. ,1. ,0. ,1. ,1.], [0. ,0. ,0. ,0. ,0. ,1. ,1.], [0. ,0. ,0. ,0. ,0. ,0. ,0.], [0. ,0. ,0. ,0. ,0. ,0. ,1.], [0. ,0. ,0. ,0. ,0. ,0. ,0.]]) ops=['input', 'maxpool3x3', 'conv1x1-bn-relu' , 'conv3x3-bn-relu', 'conv3x3-bn-relu', 'conv3x3-bn-relu','output'] cell = api.ModelSpec(matrix=m, ops=ops) print(nasbench.is_valid(cell))

m is a matrix I searched by autoshrink, is_valid is true

And then, data = nasbench.query(cell) for k, v in data.items(): print('%s: %s' % (k, str(v)))

It will report

KeyError Traceback (most recent call last)

in () ----> 1 data = nasbench.query(cell) 2 for k, v in data.items(): 3 print('%s: %s' % (k, str(v))) ~\Downloads\ECE590 NAS\nasbench\api.py in query(self, model_spec, epochs, stop_halfway) 235 % self.valid_epochs) 236 --> 237 fixed_stat, computed_stat = self.get_metrics_from_spec(model_spec) 238 sampled_index = random.randint(0, self.config['num_repeats'] - 1) 239 computed_stat = computed_stat[epochs][sampled_index] ~\Downloads\ECE590 NAS\nasbench\api.py in get_metrics_from_spec(self, model_spec) 364 self._check_spec(model_spec) 365 module_hash = self._hash_spec(model_spec) --> 366 return self.get_metrics_from_hash(module_hash) 367 368 def _check_spec(self, model_spec): ~\Downloads\ECE590 NAS\nasbench\api.py in get_metrics_from_hash(self, module_hash) 346 fixed stats and computed stats of the model spec provided. 347 """ --> 348 fixed_stat = copy.deepcopy(self.fixed_statistics[module_hash]) 349 computed_stat = copy.deepcopy(self.computed_statistics[module_hash]) 350 return fixed_stat, computed_stat KeyError: '926a133285cb34c1a38eefe60e7586d4' How to solve this problem
DaweiXi360 commented 3 years ago

the type should be int