Xtra-Computing / thundersvm

ThunderSVM: A Fast SVM Library on GPUs and CPUs
Apache License 2.0
1.57k stars 217 forks source link

scikit wrapper memory leaks with sklearn's cv #131

Closed Naich closed 5 years ago

Naich commented 5 years ago

When I used the scikit wrapper with sklearn's Gridsearchcv, the script ate up all the memory .

Here is my test code:

import sklearn.svm
import sklearn.model_selection
import thundersvmScikit
import numpy as np

%load_ext memory_profiler

X = np.random.normal(0,1,(1000,100))
y = np.random.normal(0,1, 1000)

model_sklearn = sklearn.svm.SVR(C = 1.0, gamma=0.01)
model_thunder = thundersvmScikit.SVR(C = 1.0, gamma=0.01)

Then when sklearn.model_selection.cross_validate is used and ran for many times:

%memit rst = sklearn.model_selection.cross_validate(model_sklearn, X, y, cv=5, return_train_score=False)
peak memory: 535.94 MiB, increment: 0.00 MiB
%memit rst = sklearn.model_selection.cross_validate(model_thunder, X, y, cv=5, return_train_score=False)
peak memory: 545.70 MiB, increment: 3.40 MiB

Any idea what this memory problem is?

zeyiwen commented 5 years ago

Thanks. We will look at it, and get back to you as soon as we can.

QinbinLi commented 5 years ago

Hi, @Naich We have fixed the memory issue. You can update the codes and try again. Thanks.

Naich commented 5 years ago

Thanks, it works fine now.