sherpa-ai/sherpa

Sherpa study can not find keras module

Sshamekh opened this issue · 0 comments

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