Open barathbheeman opened 1 year ago
Thank you for the report @barathbheeman! I believe this is due to https://github.com/huggingface/transformers/blob/b338414e614a30af5f940269484ef15bf716d078/src/transformers/pipelines/__init__.py#L87-L88 in transformers. Tensorflow is actually not used, just imported, which arguably is very bad if it is not useful.
I remember internal discussions about this issue, @Narsil is probably most familiar with.
Yes, but removing those imports are going to be tedious (I have started the work on some branch, felt like a never-ending fight to move imports around).
Thank you for the report @barathbheeman! I believe this is due to https://github.com/huggingface/transformers/blob/b338414e614a30af5f940269484ef15bf716d078/src/transformers/pipelines/__init__.py#L87-L88 in transformers. Tensorflow is actually not used, just imported, which arguably is very bad if it is not useful.
I remember internal discussions about this issue, @Narsil is probably most familiar with.
Thanks for the quick response. so the import's actually happening in transformers and not optimum. It's nice that I can force it to use torch using the 'framework=pt' argument while creating pipelines. However, it would be nice if I can completely ignore one of the frameworks.
I suppose there's no quick fix available. If you have no more comments or recommendations, feel free to close the close the issue. Thanks!
System Info
Who can help?
No response
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Following the hugginface blog tutorial on optimum here: https://huggingface.co/blog/optimum-inference
running
pip install optimum[onnxruntime-gpu]
. There were multiple connection timeouts, but that maybe a different issue.and then running the following code snippet from the tutorial
I see the follwing output in the jupyter notebook:
Expected behavior
optimum seems to use the tensorflow installed on the system. This may not be an issue per se but I have both TF and torch installed for different use cases, I want optimum to use torch, because that's what I use to train my huggingface models for mainly classification tasks. I can't seem to find a way to force optimum to use torch instead. Any help will be appreciated. Thanks.