Problem in XGBoost with Hosted Infernece API

I downloaded your model and created a data frame to predict with. It worked as long as the df used numerical dtypes, but when I cast it to object, it failed with the same error message as you got. So the problem is most likely that the inference API passes the data as object dtype.

One quick solution would be if it called df.convert_dtypes() on the df before calling predict, but maybe there are situations where we don’t want that. Do you have any idea @merve?

@uisikdag There is not much you can do right now until we fix it on the inference API side. If you really need it right now, you could create an sklearn Pipeline with a FunctionTransformer as a first step that calls the mentioned method on the df, and with your xgboost model as second step.

1 Like