Skip to content

Using HuggingFace Transformers pipeline? #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Dijkie85 opened this issue Oct 20, 2022 · 4 comments
Closed

Using HuggingFace Transformers pipeline? #236

Dijkie85 opened this issue Oct 20, 2022 · 4 comments

Comments

@Dijkie85
Copy link

Hi! Trying to port a Python project into Julia. Julia's Transformers.jl library, however, doesn't seem to support HuggingFace pipelines, so I'm turning to PythonCall in order to use the Python package transformers. I can import it ok with transformers = pyimport("transformers"), but I get the following error when trying to actually call transformers.pipeline:

julia> pos = transformers.pipeline("token-classification", model="PlanTL-GOB-ES/roberta-large-bne-capitel-pos")
ERROR: Python: RuntimeError: Failed to import transformers.pipelines because of the following error (look up to see its traceback):
/home/dijkie/packages/julias/julia-1.8/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/dijkie/miniconda3/envs/ds/lib/python3.10/site-packages/scipy/optimize/_highs/_highs_wrapper.cpython-310-x86_64-linux-gnu.so)
Python stacktrace:
 [1] _get_module
   @ transformers.file_utils ~/miniconda3/envs/ds/lib/python3.10/site-packages/transformers/file_utils.py:2779
 [2] __getattr__
   @ transformers.file_utils ~/miniconda3/envs/ds/lib/python3.10/site-packages/transformers/file_utils.py:2767
Stacktrace:
 [1] pythrow()
   @ PythonCall ~/.julia/packages/PythonCall/eU0yr/src/err.jl:94
 [2] errcheck
   @ ~/.julia/packages/PythonCall/eU0yr/src/err.jl:10 [inlined]
 [3] pygetattr(x::Py, k::String)
   @ PythonCall ~/.julia/packages/PythonCall/eU0yr/src/abstract/object.jl:60
 [4] getproperty(x::Py, k::Symbol)
   @ PythonCall ~/.julia/packages/PythonCall/eU0yr/src/Py.jl:272
 [5] top-level scope
   @ REPL[7]:1

So, there seems to be a problem with GLIBCXX_3.4.30 which I cannot decipher, much less correct.
Any ideas?

@cjdoris
Copy link
Collaborator

cjdoris commented Oct 20, 2022

I thought I fixed this a while ago. Can you try upgrading?

@Dijkie85
Copy link
Author

I thought I fixed this a while ago. Can you try upgrading?

Thank you for your quick reply!
What should I upgrade, and how?
I'm using Julia v. 1.8 and Python v. 3.10. Just installed PythonCall with ] add PythonCall a couple of hours ago...

@cjdoris
Copy link
Collaborator

cjdoris commented Oct 21, 2022

If you haven't configured anything, then PythonCall should automatically install a version of glibcxx compatible with Julia. Are you setting any env vars to do with PythonCall or CondaPkg?

@Dijkie85
Copy link
Author

Thank you again for taking the time to reply. Yes, I'musing PythonCall ENV["JULIA_CONDAPKG_BACKEND"] = "Current" to use my usual NLP environment. I ended up copying my system's libstdc++.so.6 to the Julia folder which includes the most up-to-date version of GLIBCXX and it worked. Kinda hacky though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants