kijai / ComfyUI-Florence2

Inference Microsoft Florence2 VLM
MIT License
773 stars 53 forks source link

Error: PyTorch SDPA requirements in Transformers are not met. Please install torch>=2.1.1. #48

Closed moviejimmy closed 3 months ago

moviejimmy commented 3 months ago

Error occurred when executing DownloadAndLoadFlorence2Model:

PyTorch SDPA requirements in Transformers are not met. Please install torch>=2.1.1.

File "C:\ComfyUI_cu121\ComfyUI\execution.py", line 152, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_cu121\ComfyUI\execution.py", line 82, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_cu121\ComfyUI\execution.py", line 75, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_cu121\ComfyUI\custom_nodes\ComfyUI-Florence2\nodes.py", line 84, in loadmodel model = AutoModelForCausalLM.from_pretrained(model_path, attn_implementation=attention, device_map=device, torch_dtype=dtype,trust_remote_code=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_cu121\python_embeded\Lib\site-packages\transformers\models\auto\auto_factory.py", line 559, in from_pretrained return model_class.from_pretrained( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_cu121\python_embeded\Lib\site-packages\transformers\modeling_utils.py", line 3704, in from_pretrained config = cls._autoset_attn_implementation( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_cu121\python_embeded\Lib\site-packages\transformers\modeling_utils.py", line 1490, in _autoset_attn_implementation config = cls._check_and_enable_sdpa( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\ComfyUI_cu121\python_embeded\Lib\site-packages\transformers\modeling_utils.py", line 1662, in _check_and_enable_sdpa raise ImportError(

moviejimmy commented 3 months ago

I have done this already:

C:\ComfyUI_cu121>python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com Requirement already satisfied: transformers>=4.39.0 in c:\comfyui_cu121\python_embeded\lib\site-packages (from -r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (4.42.4) Requirement already satisfied: matplotlib in c:\comfyui_cu121\python_embeded\lib\site-packages (from -r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 2)) (3.8.2) Requirement already satisfied: timm in c:\comfyui_cu121\python_embeded\lib\site-packages (from -r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 3)) (1.0.7) Requirement already satisfied: pillow>=10.2.0 in c:\comfyui_cu121\python_embeded\lib\site-packages (from -r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 4)) (10.4.0) Requirement already satisfied: filelock in c:\comfyui_cu121\python_embeded\lib\site-packages (from transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (3.13.1) Requirement already satisfied: huggingface-hub<1.0,>=0.23.2 in c:\comfyui_cu121\python_embeded\lib\site-packages (from transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (0.23.4) Requirement already satisfied: numpy<2.0,>=1.17 in c:\comfyui_cu121\python_embeded\lib\site-packages (from transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (1.26.4) Requirement already satisfied: packaging>=20.0 in c:\comfyui_cu121\python_embeded\lib\site-packages (from transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (23.2) Requirement already satisfied: pyyaml>=5.1 in c:\comfyui_cu121\python_embeded\lib\site-packages (from transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (6.0.1) Requirement already satisfied: regex!=2019.12.17 in c:\comfyui_cu121\python_embeded\lib\site-packages (from transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (2023.10.3) Requirement already satisfied: requests in c:\comfyui_cu121\python_embeded\lib\site-packages (from transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (2.31.0) Requirement already satisfied: safetensors>=0.4.1 in c:\comfyui_cu121\python_embeded\lib\site-packages (from transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (0.4.3) Requirement already satisfied: tokenizers<0.20,>=0.19 in c:\comfyui_cu121\python_embeded\lib\site-packages (from transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (0.19.1) Requirement already satisfied: tqdm>=4.27 in c:\comfyui_cu121\python_embeded\lib\site-packages (from transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (4.66.1) Requirement already satisfied: contourpy>=1.0.1 in c:\comfyui_cu121\python_embeded\lib\site-packages (from matplotlib->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 2)) (1.2.0) Requirement already satisfied: cycler>=0.10 in c:\comfyui_cu121\python_embeded\lib\site-packages (from matplotlib->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 2)) (0.12.1) Requirement already satisfied: fonttools>=4.22.0 in c:\comfyui_cu121\python_embeded\lib\site-packages (from matplotlib->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 2)) (4.46.0) Requirement already satisfied: kiwisolver>=1.3.1 in c:\comfyui_cu121\python_embeded\lib\site-packages (from matplotlib->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 2)) (1.4.5) Requirement already satisfied: pyparsing>=2.3.1 in c:\comfyui_cu121\python_embeded\lib\site-packages (from matplotlib->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 2)) (3.1.1) Requirement already satisfied: python-dateutil>=2.7 in c:\comfyui_cu121\python_embeded\lib\site-packages (from matplotlib->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 2)) (2.8.2) Requirement already satisfied: torch in c:\comfyui_cu121\python_embeded\lib\site-packages (from timm->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 3)) (2.1.0+cu121) Requirement already satisfied: torchvision in c:\comfyui_cu121\python_embeded\lib\site-packages (from timm->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 3)) (0.16.0+cu121) Requirement already satisfied: fsspec>=2023.5.0 in c:\comfyui_cu121\python_embeded\lib\site-packages (from huggingface-hub<1.0,>=0.23.2->transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (2023.10.0) Requirement already satisfied: typing-extensions>=3.7.4.3 in c:\comfyui_cu121\python_embeded\lib\site-packages (from huggingface-hub<1.0,>=0.23.2->transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (4.12.2) Requirement already satisfied: six>=1.5 in c:\comfyui_cu121\python_embeded\lib\site-packages (from python-dateutil>=2.7->matplotlib->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 2)) (1.16.0) Requirement already satisfied: colorama in c:\comfyui_cu121\python_embeded\lib\site-packages (from tqdm>=4.27->transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (0.4.6) Requirement already satisfied: charset-normalizer<4,>=2 in c:\comfyui_cu121\python_embeded\lib\site-packages (from requests->transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (3.3.2) Requirement already satisfied: idna<4,>=2.5 in c:\comfyui_cu121\python_embeded\lib\site-packages (from requests->transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in c:\comfyui_cu121\python_embeded\lib\site-packages (from requests->transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (1.26.18) Requirement already satisfied: certifi>=2017.4.17 in c:\comfyui_cu121\python_embeded\lib\site-packages (from requests->transformers>=4.39.0->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 1)) (2023.7.22) Requirement already satisfied: sympy in c:\comfyui_cu121\python_embeded\lib\site-packages (from torch->timm->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 3)) (1.12) Requirement already satisfied: networkx in c:\comfyui_cu121\python_embeded\lib\site-packages (from torch->timm->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 3)) (3.2.1) Requirement already satisfied: jinja2 in c:\comfyui_cu121\python_embeded\lib\site-packages (from torch->timm->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 3)) (3.1.4) Requirement already satisfied: MarkupSafe>=2.0 in c:\comfyui_cu121\python_embeded\lib\site-packages (from jinja2->torch->timm->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 3)) (2.1.5) Requirement already satisfied: mpmath>=0.19 in c:\comfyui_cu121\python_embeded\lib\site-packages (from sympy->torch->timm->-r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt (line 3)) (1.3.0)

[notice] A new release of pip is available: 24.1.1 -> 24.2 [notice] To update, run: C:\ComfyUI_cu121\python_embeded\python.exe -m pip install --upgrade pip

moviejimmy commented 3 months ago

Please help when you have a chance! EDIT: I am the same one on Reddit about the conflicted nodes issue.

kijai commented 3 months ago

How old is that ComfyUI initial install? It's saying the torch is version is older than 2.1.1, which is very old by now as ComfyUI comes with 2.4.0 now.

moviejimmy commented 3 months ago

Last November. I thought this "python_embeded\python.exe -m pip install -r ComfyUI\custom_nodes\ComfyUI-Florence2\requirements.txt" would update and upgrade everything.

kijai commented 3 months ago

It won't update the core stuff as it's generally bad idea for custom nodes to do that. To update the Comfy core dependencies, there are update scripts in the ComfyUI_windows_portable\update -folder.

moviejimmy commented 3 months ago

OK. Thanks. I am not technical at all. I will see if I manage to update it. Thanks fof your help.

moviejimmy commented 3 months ago

I ran the update_comfyui.bat file and then restarted comfyui. Same error when I ran your node. Any idea why?

moviejimmy commented 3 months ago

I notice that a "current_requirements.txt" file was created. Do I need to do anything with this file?

Content:

torch torchsde torchvision torchaudio einops transformers>=4.28.1 tokenizers>=0.13.3 sentencepiece safetensors>=0.4.2 aiohttp pyyaml Pillow scipy tqdm psutil

non essential dependencies:

kornia>=0.7.1 spandrel soundfile

kijai commented 3 months ago

Try running the other script too, which updates dependencies

moviejimmy commented 3 months ago

Thanks a lot. All good now after running the other script.

moviejimmy commented 3 months ago

Screenshot 2024-08-04 223541

wrong labels though. lol.

kijai commented 3 months ago

Screenshot 2024-08-04 223541

wrong labels though. lol.

Yeah sadly I can't do anything about that, so annoying :(