kijai / ComfyUI-Florence2

Inference Microsoft Florence2 VLM
MIT License
300 stars 17 forks source link

Could not locate the configuration_florence2.py inside #7

Closed alexcc4 closed 1 week ago

alexcc4 commented 1 week ago
using flash_attention_2 for attention
Could not locate the configuration_florence2.py inside /Users/liangbinsi/Documents/ComfyUI/models/LLM/Florence-2-base.
!!! Exception during processing!!! /Users/liangbinsi/Documents/ComfyUI/models/LLM/Florence-2-base does not appear to have a file named configuration_florence2.py. Checkout 'https://huggingface.co//Users/liangbinsi/Documents/ComfyUI/models/LLM/Florence-2-base/tree/None' for available files.
Traceback (most recent call last):
  File "/Users/liangbinsi/Documents/ComfyUI/execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "/Users/liangbinsi/Documents/ComfyUI/execution.py", line 81, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "/Users/liangbinsi/Documents/ComfyUI/execution.py", line 74, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "/Users/liangbinsi/Documents/ComfyUI/custom_nodes/ComfyUI-Florence2/nodes.py", line 82, in loadmodel
    model = AutoModelForCausalLM.from_pretrained(model_path, attn_implementation=attention, device_map=device, torch_dtype=dtype,trust_remote_code=True)
  File "/Users/liangbinsi/.pyenv/versions/3.10.0/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 523, in from_pretrained
    config, kwargs = AutoConfig.from_pretrained(
  File "/Users/liangbinsi/.pyenv/versions/3.10.0/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 943, in from_pretrained
    config_class = get_class_from_dynamic_module(
  File "/Users/liangbinsi/.pyenv/versions/3.10.0/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 501, in get_class_from_dynamic_module
    final_module = get_cached_module_file(
  File "/Users/liangbinsi/.pyenv/versions/3.10.0/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 305, in get_cached_module_file
    resolved_module_file = cached_file(
  File "/Users/liangbinsi/.pyenv/versions/3.10.0/lib/python3.10/site-packages/transformers/utils/hub.py", line 370, in cached_file
    raise EnvironmentError(
OSError: /Users/liangbinsi/Documents/ComfyUI/models/LLM/Florence-2-base does not appear to have a file named configuration_florence2.py. Checkout 'https://huggingface.co//Users/liangbinsi/Documents/ComfyUI/models/LLM/Florence-2-base/tree/None' for available files.

device: Mac arm64

image
kijai commented 1 week ago

You are missing files in that folder for some reason, you need all files from here: https://huggingface.co/microsoft/Florence-2-base/tree/main

alexcc4 commented 1 week ago
image

This means I may need to download these files manually. I ran it directly according to the example process

alexcc4 commented 1 week ago
pytorch_model.bin: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 464M/464M [05:26<00:00, 1.42MB/s]
!!! Exception during processing!!! An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on.
Traceback (most recent call last):█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 464M/464M [05:26<00:00, 3.91MB/s]
  File "/Users/liangbinsi/.pyenv/versions/3.10.0/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1754, in _get_metadata_or_catch_error
    raise FileMetadataError("Distant resource does not have a Content-Length.")
huggingface_hub.utils._errors.FileMetadataError: Distant resource does not have a Content-Length.

I found a problem when running the download for the first time

RandomGitUser321 commented 1 week ago

Maybe try updating your huggingface-hub manually.

From the root comfyui folder (where you can see the comfyui and python_embedded subfolders), click on the file path at the top and type cmd to open a command window in the folder(you might be able to find it in the right click menu as well).

Run the command python_embeded\python.exe -s -m pip install huggingface-hub

alexcc4 commented 1 week ago

Maybe try updating your huggingface-hub manually.

I understand what you mean, maybe there is a problem with the huggingface dependency. I manually updated this dependency, and comfy UI is running on Mac. Still did not solve the problem.

alexcc4 commented 1 week ago

Maybe there is a problem with my download on my device. My current solution: In directoty(ComfyUI/models/LLM)

git clone https://huggingface.co/microsoft/Florence-2-base

In addition, since it seems that the node configuration style of Florence2Run has been updated recently, do you mind updating the example workflow? Thank you for your contribution.