huggingface / transformers

🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
https://huggingface.co/transformers
Apache License 2.0
135.61k stars 27.15k forks source link

importing `xgboost` before `transformers.pipeline` breaks pipeline loading for `image-feature-extraction` pipelines #33789

Closed dan-jacobson closed 3 weeks ago

dan-jacobson commented 2 months ago

System Info

Who can help?

@Rocketknight1, @amyeroberts, @qubvel

Information

Tasks

Reproduction

mkdir pipeline_test && cd pipeline_test
uv init
uv add transformers torch pillow xgboost
uv run python

import xgboost
from transformers import pipeline
pipe = pipeline(task="image-feature-extraction")

This fails silently in my terminal. For some reason I can't get a good error. In VSCode I can sometimes get: [1] 88800 segmentation fault python.

Interestingly, it's the order of xgboost/transformers import that matters. This works on my machine:

from transformers import pipeline
import xgboost

pipe = pipeline(task="image-feature-extraction")

A couple other things I noticed:

Expected behavior

I expected my pipeline to load.

LysandreJik commented 1 month ago

Hey @dan-jacobson, I'm not sure it's transformers, I have reason to believe it's torch :grin:

Can you let me know if doing import xgboost followed by import torch fails?

LysandreJik commented 1 month ago

Or, another potential thing to look into: uninstall torch and install tensorflow as a backend for pipelines; now do the same: import xgboost and pipeline. Does that still fail?

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.