lyst / lightfm

A Python implementation of LightFM, a hybrid recommendation algorithm.
Apache License 2.0
4.73k stars 691 forks source link

Illegal Instruction (core dumped) #526

Closed bradfox2 closed 4 years ago

bradfox2 commented 4 years ago

Hi @maciejkula The code from github readme, below, (and my model code) dumps.

Running in Docker Ubuntu 16.04, on a RedHat 7 server. My model is trained on a Windows 10 machine, if it matters.

numpy 1.18.2 scipy 1.4.1

Recompiling the package whilst in a container deployed to my Redhat server does allow the following code to run. Building the whl, and rebuilding my container environment with that whl does not seem to help though. Edit: Rebuilding the whl in a deployed container does appear to work.

I'm going to take an uneducated guess and suggest that its some sort of CPU instruction set that is being passed through when the container image is build on a more modern CPU, and then fails when deployed on potentially on an older CPU in our datacenter.

from lightfm import LightFM from lightfm.datasets import fetch_movielens from lightfm.evaluation import precision_at_k

Load the MovieLens 100k dataset. Only five star ratings are treated as positive. data = fetch_movielens(min_rating=5.0)

Instantiate and train the model model = LightFM(loss='warp') model.fit(data['train'], epochs=30, num_threads=2)

Evaluate the trained model test_precision = precision_at_k(model, data['test'], k=5).mean()

maciejkula commented 4 years ago

Exactly: if you compile on a machine that supports different instruction sets than the one your run on you might have problems.