PreferredAI / cornac

A Comparative Framework for Multimodal Recommender Systems
https://cornac.preferred.ai
Apache License 2.0
868 stars 142 forks source link

[ASK] Is there a way to find all GPU supported models? #609

Closed lgabs closed 6 months ago

lgabs commented 6 months ago

Description

I could not find easily which models support GPU (I had to search in the documentation page with ctrl+F). To check which models support GPU programmatically, one can run (not all models follow the same param name, like backend for MF and use_gpu for several other models):

from cornac.models import *

models = [
AMR(),
BaselineOnly(),
Beacon(),
BiVAECF(),
BPR(),
WBPR(),
CausalRec(),
C2PF(),
CDL(),
CDR(),
COE(),
ComparERObj(),
ComparERSub(),
ConvMF(),
CTR(),
CVAE(),
CVAECF(),
DMRL(),
DNNTSP(),
EASE(),
EFM(),
# FM(), only supported on Linux.
GCMC(),
GlobalAvg(),
GPTop(),
GRU4Rec(),
HFT(),
HPF(),
HRDR(),
HypAR(),
IBPR(),
ItemKNN(),
UserKNN(),
LightGCN(),
LRPPM(),
MCF(),
MF(),
MMMF(),
MostPop(),
MTER(),
NARRE(),
GMF(),
MLP(),
NeuMF(),
NGCF(),
NMF(),
OnlineIBPR(),
PCRL(),
PMF(),
RecVAE(),
SBPR(),
SKMeans(),
SoRec(),
SPop(),
SVD(),
TIFUKNN(),
TriRank(),
UPCF(),
VAECF(),
VBPR(),
VMF(),
WMF(),
]

gpu_models = []
for model in models:
    if hasattr(model, 'use_gpu') or hasattr(model, 'backend'):
        gpu_models.append(model.name)
print(gpu_models)

which results in the list

['AMR', 'BiVAECF', 'CausalRec', 'CVAECF', 'MF', 'GMF', 'MLP', 'NeuMF', 'SVD', 'VAECF', 'VBPR', 'VMF']

Suggestions

tqtg commented 6 months ago

Yes. We should have it added into README.