diff --git a/paddleslim/common/sa_controller.py b/paddleslim/common/sa_controller.py index 8a081761178c0e9ad9a9477eebda7018561abcf1..c49adb776f69a43c05d666941d043e5076bc2f99 100644 --- a/paddleslim/common/sa_controller.py +++ b/paddleslim/common/sa_controller.py @@ -137,7 +137,7 @@ class SAController(EvolutionaryController): _logger.debug("change index[{}] from {} to {}".format( index, tokens[index], new_tokens[index])) - if self._searched.has_key(str(new_tokens)): + if str(new_tokens) in self._searched.keys(): _logger.debug('get next tokens including searched tokens: {}'. format(new_tokens)) continue diff --git a/paddleslim/nas/sa_nas.py b/paddleslim/nas/sa_nas.py index 428385f54df579bef29b0be893e6272ef342fdda..73a8ecf6cf45ee7f32503dd204a3f739ca01cde6 100644 --- a/paddleslim/nas/sa_nas.py +++ b/paddleslim/nas/sa_nas.py @@ -93,7 +93,7 @@ class SANAS(object): premax_reward = scene['_max_reward'] prebest_tokens = scene['_best_tokens'] preiter = scene['_iter'] - psearched = screen['_searched'] + psearched = scene['_searched'] else: preinit_tokens = init_tokens prereward = -1 @@ -114,7 +114,7 @@ class SANAS(object): best_tokens=prebest_tokens, constrain_func=None, checkpoints=save_checkpoint, - searched = psearched) + searched=psearched) max_client_num = 100 self._controller_server = ControllerServer(