我的服务器配置如下:
通过使用Django框架和apache服务器,我们称之为Keras深度学习模型.在成功调用模型之后,模型一直在GPU内存中运行,这导致除了关闭apache服务器之外无法释放GPU内存.
那么,在通过Apache + Mod_wsgi + Django调用Keras模型时,有没有办法控制GPU内存的释放?
谢谢!
我使用xgboost来预测,我的主要代码如下:
params={
'booster':'gbtree',
'object':'binary:logistic',
'early_stopping_rounds':100,
'eval_metric':'auc',
'gamma':0.1,
'max_depth':8,
'lambda':550,
'subsample':0.7,
'colsample_bytree':0.2,
'min_child_weight':3,
'eta':0.02,
'seed':2,
'min_child_weight':0.5,
'scale_pos_weight':ratio,
'max_delta_step':5,
'nthread':7
}
watch_list = [(dval,'val'),(dtrain,'train')]
xgboost_model = xgb.train(params,dtrain,num_boost_round=500, evals = watch_list)
Run Code Online (Sandbox Code Playgroud)
但有一个错误:
XGBoostError: [09:48:50] /usr/local/xgboost/src/metric/metric.cc:21: Unknown metric function auc
Stack trace returned 10 entries:
[bt] (0) /usr/local/lib/python2.7/dist-packages/xgboost-0.6-
py2.7.egg/xgboost/libxgboost.so(_ZN7xgboost6Metric6CreateERKSs+0x5f7)
[0x7f0cadfff417]
[bt] (1) /usr/local/lib/python2.7/dist-packages/xgboost-0.6-
py2.7.egg/xgboost/libxgboost.so(_ZN7xgboost11LearnerImpl9ConfigureERKSt6vectorISt4pairISsSsESaIS3_EE+0x717) [0x7f0cae0bfd27]
[bt] (2) /usr/local/lib/python2.7/dist-packages/xgboost-0.6-py2.7.egg/xgboost/libxgboost.so(XGBoosterUpdateOneIter+0x5e)
[0x7f0cadf6816e]
[bt] (3) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c)
[0x7f0d3a3bcadc]
[bt] (4) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x1fc) [0x7f0d3a3bc40c]
[bt] (5) /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(_ctypes_callproc+0x48e) [0x7f0d3a5d35fe]
[bt] (6) /usr/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(+0x15f9e) [0x7f0d3a5d4f9e]
[bt] (7) /usr/bin/python(PyEval_EvalFrameEx+0x98d) [0x5244dd]
[bt] (8) /usr/bin/python(PyEval_EvalCodeEx+0x2b1) [0x555551]
[bt] …Run Code Online (Sandbox Code Playgroud)