Import error of ImportError of 'Qwen2_5_VLForConditionalGeneration' from transformers library

#17
by akbarmq01 - opened

Hi all,
I tried to install transformer package by pulling it from github and building it. its giving following error:
ImportError: cannot import name 'Qwen2_5_VLForConditionalGeneration' from 'transformers'. Can you please help?

Qwen2_5_VLForConditionalGeneration isn't in the most recent release (4.48.3). Instead, you need to install transformers directly from source until the next release: pip install git+https://github.com/huggingface/transformers.git

I am trying to build from source and transformers is not installing. Please help me resolve this issue. I am getting the following error:

kaveri@gnode008:~/LO$ python -m pip install git+https://github.com/huggingface/transformers
Collecting git+https://github.com/huggingface/transformers
  Cloning https://github.com/huggingface/transformers to /tmp/pip-req-build-bamqqjcc
  Running command git clone --filter=blob:none --quiet https://github.com/huggingface/transformers /tmp/pip-req-build-bamqqjcc
  Resolved https://github.com/huggingface/transformers to commit 2b8a15cc3f1a0c94cf817a8fd8c87bca28737e09
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: filelock in /home2/kaveri/miniconda3/envs/intent/lib/python3.8/site-packages (from transformers==4.51.0.dev0) (3.16.1)
Requirement already satisfied: huggingface-hub<1.0,>=0.26.0 in /home2/kaveri/miniconda3/envs/intent/lib/python3.8/site-packages (from transformers==4.51.0.dev0) (0.29.3)
Requirement already satisfied: numpy>=1.17 in /home2/kaveri/miniconda3/envs/intent/lib/python3.8/site-packages (from transformers==4.51.0.dev0) (1.24.4)
Requirement already satisfied: packaging>=20.0 in /home2/kaveri/miniconda3/envs/intent/lib/python3.8/site-packages (from transformers==4.51.0.dev0) (24.2)
Requirement already satisfied: pyyaml>=5.1 in /home2/kaveri/miniconda3/envs/intent/lib/python3.8/site-packages (from transformers==4.51.0.dev0) (6.0.2)
Requirement already satisfied: regex!=2019.12.17 in /home2/kaveri/miniconda3/envs/intent/lib/python3.8/site-packages (from transformers==4.51.0.dev0) (2024.11.6)
Requirement already satisfied: requests in /home2/kaveri/miniconda3/envs/intent/lib/python3.8/site-packages (from transformers==4.51.0.dev0) (2.32.3)
Collecting tokenizers<0.22,>=0.21 (from transformers==4.51.0.dev0)
  Using cached tokenizers-0.21.0.tar.gz (343 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  Γ— Preparing metadata (pyproject.toml) did not run successfully.
  β”‚ exit code: 1
  ╰─> [19 lines of output]
      Checking for Rust toolchain....
      Traceback (most recent call last):
        File "/home2/kaveri/miniconda3/envs/intent/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
        File "/home2/kaveri/miniconda3/envs/intent/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
        File "/home2/kaveri/miniconda3/envs/intent/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 175, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
        File "/tmp/pip-build-env-zfr6elsv/overlay/lib/python3.8/site-packages/maturin/__init__.py", line 171, in prepare_metadata_for_build_wheel
          output = subprocess.check_output(["cargo", "--version"]).decode("utf-8", "ignore")
        File "/home2/kaveri/miniconda3/envs/intent/lib/python3.8/subprocess.py", line 415, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/home2/kaveri/miniconda3/envs/intent/lib/python3.8/subprocess.py", line 493, in run
          with Popen(*popenargs, **kwargs) as process:
        File "/home2/kaveri/miniconda3/envs/intent/lib/python3.8/subprocess.py", line 858, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "/home2/kaveri/miniconda3/envs/intent/lib/python3.8/subprocess.py", line 1720, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      NotADirectoryError: [Errno 20] Not a directory: 'cargo'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Γ— Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Your need to confirm your account before you can post a new comment.

Sign up or log in to comment