sherpa-ai / sherpa

Hyperparameter optimization that enables researchers to experiment, visualize, and scale quickly.
http://parameter-sherpa.readthedocs.io/
GNU General Public License v3.0
333 stars 54 forks source link

Sherpa study can not find keras module #112

Closed Sshamekh closed 3 years ago

Sshamekh commented 3 years ago

Hi I have made a simple NN with sherpa. When running line: model.fit(x_train, y_train, epochs=5, batch_size=32, callbacks=[study.keras_callback(trial, objective_name='val_loss')]) study.finalize(trial) It gives me error that "No module named 'keras' " . I have tensorflow and keras installed and never get any problem loading them. but this part of core.py in sherpa seems not to find keras! here is more detail.

ModuleNotFoundError Traceback (most recent call last)

in 19 model.compile(loss='mean_squared_error', optimizer=adm, metrics=['mse']) 20 history = model.fit(x_train, y_train, epochs=10, batch_size=32, ---> 21 callbacks=[study.keras_callback(trial, objective_name='mean_squared_error')]) 22 23 print ('oh lalala') /glade/work/user/CloneSS/lib/python3.7/site-packages/sherpa/core.py in keras_callback(self, trial, objective_name, context_names) 394 monitored. 395 """ --> 396 import keras.callbacks 397 send_call = lambda epoch, logs: self.add_observation(trial=trial, 398 iteration=epoch, ModuleNotFoundError: No module named 'keras' Thank you very much for help