hyperas: OSError while executing sample code

The sample code given on hyperas homepage ends up in the following error stack trace:

OSError                                   Traceback (most recent call last)
<ipython-input-15-871ae3941e46> in <module>()
     76                                           algo=tpe.suggest,
     77                                           max_evals=5,
---> 78                                           trials=Trials())
     79     X_train, Y_train, X_test, Y_test = data()
     80     print("Evalutation of best performing model:")

G:\Programs\anaconda3\envs\py35\lib\site-packages\hyperas\optim.py in minimize(model, data, algo, max_evals, trials, functions, rseed, notebook_name, verbose, eval_space, return_space)
     65                                      full_model_string=None,
     66                                      notebook_name=notebook_name,
---> 67                                      verbose=verbose)
     68 
     69     best_model = None

G:\Programs\anaconda3\envs\py35\lib\site-packages\hyperas\optim.py in base_minimizer(model, data, functions, algo, max_evals, trials, rseed, full_model_string, notebook_name, verbose, stack)
     94         model_str = full_model_string
     95     else:
---> 96         model_str = get_hyperopt_model_string(model, data, functions, notebook_name, verbose, stack)
     97     temp_file = './temp_model.py'
     98     write_temp_files(model_str, temp_file)

G:\Programs\anaconda3\envs\py35\lib\site-packages\hyperas\optim.py in get_hyperopt_model_string(model, data, functions, notebook_name, verbose, stack)
    176     else:
    177         calling_script_file = os.path.abspath(inspect.stack()[stack][1])
--> 178         with open(calling_script_file, 'r') as f:
    179             source = f.read()
    180 

OSError: [Errno 22] Invalid argument: 'path\\to\\working\\directory\\<ipython-input-15-871ae3941e46>'

I am now able to understand the cause of the error. I am using Python 3.5.3 (Anaconda virtual environment) on Windows 10. Please help me resolve it. If I am creating a redundant issue, I apologise for the same.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@daas-ankur-shukla it seems you’re using hyperas from within ipython. that doesn’t work, unfortunately. just save your code in a .py file and run it with python from command line.

can you run the example I linked you to? If so, ask how your example differs from that. not me. yourself

Can support for ipython be worked upon? I would like to volunteer with some help from more informed people.

That would be incredibly useful @daas-ankur-shukla. I hope that’s being worked on. 🥇