massquantity / LibRecommender

Versatile End-to-End Recommender System
https://librecommender.readthedocs.io/
MIT License
342 stars 61 forks source link

modified model with sanic serving #444

Open samruddha-kf opened 5 months ago

samruddha-kf commented 5 months ago

Hi, I needed an extra mapping of items - item_category, which I added as an attribute of the model, which I will be using later to filter the recommendations. Right now I have made no code changes to filter, only added the attribute to the model and saved it. This model after loading with libserving module, I could use with tf_serving method. i.e. I can get the logits outputs with RESTful API tf_serving predict method. But when I try to use the sanic framework to get the n recommendations I am getting an error. The error is at line 182 of tf_deploy.py. The module is not able to load the model. What can I do to rectify this? The sanic framework works when model was not modified.

requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:8000/tf/recommend Error: raise SanicException( sanic.exceptions.SanicException: Error when requesting TensorFlow Serving model: <bound method ClientResponse.text of <ClientResponse(http://localhost:8501/v1/models/deepfm:predict) [400 Bad Request]> <CIMultiDictProxy('Content-Type': 'application/json', 'Date': 'Sun, 25 Feb 2024 19:21:21 GMT', 'Content-Length': '102')>

massquantity commented 5 months ago

Maybe there is a name conflict. Please provide your code.

You can also print data here to check if it has the correct format.