Inference API broken

#1
by BenjaminB HF staff - opened
scikit-learn org

I wanted to try the inference API but got "Internal Server Error" while loading the model :/ Is there any way to see the logs?

don't hesitate to ping @Narsil and @osanseviero =)

scikit-learn org

The server ATM basically only supports models persisted with scikit-learn=0.24.2 (IIRC). Also, if there are any warnings during the inference, there will be an error, which can be anything from dtype mismatch to wrong columns. The new versions of sklearn also check if the new data has the same feature names as the one used during fit, and our code doesn't necessarily pass feature names which produces a warning.

This PR (https://github.com/huggingface/api-inference-community/pull/67) fixes some of those issues, and other issues need to be fixed in future PRs, like having a transformer at the beginning of a sklearn pipeline to do the dtype conversion and the right order of features maybe.

Another issue is that this repository is a text-classification model, but the API only supports tabular-classification for sklearn at the moment. https://github.com/huggingface/api-inference-community/tree/main/docker_images/sklearn/app/pipelines.

Now, note that this repo is tagged as generic, which means it runs the code from within https://huggingface.co./scikit-learn/sklearn-transformers/blob/main/pipeline.py to do inference. The generic API should just be used for demo purposes, not for real cases. To see the error logs, you can right click > inspect > Network. Then click "Compute" in the widget, and you get the error in the Network tab.

0: "There was an inference error: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices"

So it seems there is a bug in the pipeline.py file (cc @merve )

@BenjaminB

The easiest way to checkout what's happening is

git clone https://github.com/huggingface/api-inference-community/
cd api-inference-community
./manage.py docker scikit-learn/sklearn-transformers

This will start the exact version on the API as a docker image, on port 8000 so you can start and sending it requests.
As @osanseviero suggested, the API actually returns a warning that basically the input format is invalid (probably this repo is misconfigured)

Does that help ?

Cheers.

I do want to remind that this repo is marked as generic library, not sklearn, so this will not even go to the sklearn endpoint. We need to update https://huggingface.co./scikit-learn/sklearn-transformers/blob/main/README.md#L5 if we want this to go to the sklearn endpoint.

(The command I mentionned will launch generic yes but that's a way to debug and discover that it might be misconfigured is what I wanted to convey).

Basically it's exactly what happens on the server. That's how you get full logs. Full logs are not exposed on the API since it's tricky to expose them while making sure we're not exposing any sensitive information.

scikit-learn org

@Narsil Thanks, that's very helpful.

Sign up or log in to comment