You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Helo there, I have the following code.
a global variable that num_gpu that indicates the number of gpus availavle.
If I can data() or create_mode() separate everything is fine.
But when I call optim.minimize and pass the function, it does not see the global variable and num_gpu becomes undfined.
Am I doing something wrong?
Thanks in advance.
...
from keras import backend as K
from livelossplot import PlotLossesKeras
from hyperas import optim
from hyperas.distributions import choice, uniform
from hyperopt import Trials, STATUS_OK, tpe
# Setup (multi) GPU usage with scalable VRAM
num_gpu = setup_multi_gpus()
def data():
print(num_gpu)
df, train = data_import(possible_columns)
df = prepare_data(df)
...
return X_train, y_train, X_test, y_test
def create_model(X_train, y_train, X_test, y_test):
print(num_gpu)
if __name__ == '__main__':
best_run, best_model = optim.minimize(model=create_model,
data=data,
algo=tpe.suggest,
max_evals=500,
trials=Trials(),
eval_space=True)
X_train, y_train, X_test, y_test = data()
create_model(X_train, y_train, X_test, y_test )
print(num_gpu)
The text was updated successfully, but these errors were encountered:
Helo there, I have the following code.
a global variable that num_gpu that indicates the number of gpus availavle.
If I can data() or create_mode() separate everything is fine.
But when I call optim.minimize and pass the function, it does not see the global variable and num_gpu becomes undfined.
Am I doing something wrong?
Thanks in advance.
...
The text was updated successfully, but these errors were encountered: