automl / Auto-PyTorch

Automatic architecture search and hyperparameter optimization for PyTorch
Apache License 2.0
2.37k stars 287 forks source link

error in ../examples/basics/Auto-PyTorch Tutorial.ipynb #27

Closed develooper1994 closed 4 years ago

develooper1994 commented 4 years ago

I just downloaded and run the example. There isn't error while installation. torch=='1.4.0.dev20191207' torchvision == '0.5.0.dev20191208' Python == 3.7.5

There is tracback: First error: ...(very very very looooooong) return_dict['config_ids'].append(return_dict['config_ids'][-1]) IndexError: list index out of range list index out of range

RuntimeError Traceback (most recent call last)

in 6 max_runtime=600, 7 save_checkpoints=True, ----> 8 images_root_folders=[os.path.abspath("../../datasets/example_images")]) ~\Anaconda3\lib\site-packages\autoPyTorch\core\api.py in fit(self, X_train, Y_train, X_valid, Y_valid, refit, **autonet_config) 150 151 if "optimized_hyperparameter_config" not in self.fit_result.keys() or not self.fit_result["optimized_hyperparameter_config"]: # MODIFY --> 152 raise RuntimeError("No models fit during training, please retry with a larger max_runtime.") 153 154 if (refit): RuntimeError: No models fit during training, please retry with a larger max_runtime. *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Second error: ValueError Traceback (most recent call last) in 5 max_runtime=4000, 6 default_dataset_download_dir="./datasets", ----> 7 images_root_folders=["./datasets", "./datasets/example_images"]) ~\Anaconda3\lib\site-packages\autoPyTorch\core\api.py in fit(self, X_train, Y_train, X_valid, Y_valid, refit, **autonet_config) 142 143 self.fit_result = self.pipeline.fit_pipeline(pipeline_config=self.autonet_config, --> 144 X_train=X_train, Y_train=Y_train, X_valid=X_valid, Y_valid=Y_valid) 145 try: 146 self.dataset_info = self.pipeline[CreateDatasetInfo.get_name()].fit_output["dataset_info"] ~\Anaconda3\lib\site-packages\autoPyTorch\pipeline\base\pipeline.py in fit_pipeline(self, **kwargs) 58 59 def fit_pipeline(self, **kwargs): ---> 60 return self.root.fit_traverse(**kwargs) 61 62 def predict_pipeline(self, **kwargs): ~\Anaconda3\lib\site-packages\autoPyTorch\pipeline\base\node.py in fit_traverse(self, **kwargs) 113 114 # call fit method --> 115 node.fit_output = node.fit(**required_kwargs) 116 if (not isinstance(node.fit_output, dict)): 117 raise ValueError('Node ' + str(type(node)) + ' does not return a dictionary.') ~\Anaconda3\lib\site-packages\autoPyTorch\pipeline\nodes\image\optimization_algorithm_no_timelimit.py in fit(self, pipeline_config, X_train, Y_train, X_valid, Y_valid, refit) 74 res = None 75 ---> 76 config_space = self.pipeline.get_hyperparameter_search_space(**pipeline_config) 77 config_space, constants = remove_constant_hyperparameter(config_space) 78 config_space.seed(pipeline_config['random_seed']) ~\Anaconda3\lib\site-packages\autoPyTorch\pipeline\base\pipeline.py in get_hyperparameter_search_space(self, dataset_info, **pipeline_config) 109 for name, node in self._pipeline_nodes.items(): 110 #print("dataset_info" in pipeline_config.keys()) --> 111 config_space = node.get_hyperparameter_search_space(**pipeline_config) 112 cs.add_configuration_space(prefix=name, configuration_space=config_space, delimiter=ConfigWrapper.delimiter) 113 ~\Anaconda3\lib\site-packages\autoPyTorch\pipeline\nodes\lr_scheduler_selector.py in get_hyperparameter_search_space(self, dataset_info, **pipeline_config) 60 parent_hyperparameter={'parent': selector, 'value': lr_scheduler_name}) 61 ---> 62 self._check_search_space_updates((possible_lr_scheduler, "*")) 63 return cs 64 ~\Anaconda3\lib\site-packages\autoPyTorch\pipeline\base\pipeline_node.py in _check_search_space_updates(self, *allowed_hps) 152 if key not in exploded_allowed_hps and \ 153 ConfigWrapper.delimiter.join(key.split(ConfigWrapper.delimiter)[:-1] + ["*"]) not in exploded_allowed_hps: --> 154 raise ValueError("Invalid search space update given: %s" % key) 155 156 def _get_search_space_updates(self, prefix=None): ValueError: Invalid search space update given: step:step_size
LMZimmer commented 4 years ago

Hey there, the issue seems to be caused by the fact that the config preset "tiny_cs" does not contain step as learning rate scheduler. For now you can fix it setting

autonet_multi_image_classification = AutoNetImageClassificationMultipleDatasets(config_preset="full_cs", ...)

develooper1994 commented 4 years ago

Thank you. I will try again.