Skip to content
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

Lora 加载报错 #5

Open
tolozine opened this issue Nov 2, 2024 · 4 comments
Open

Lora 加载报错 #5

tolozine opened this issue Nov 2, 2024 · 4 comments

Comments

@tolozine
Copy link

tolozine commented Nov 2, 2024

ComfyUI Error Report

Error Details

  • Node Type: QuickMfluxNode
  • Exception Type: RuntimeError
  • Exception Message: [load_safetensors] Failed to open file /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/models/loras/Flux/Hyper-FLUX.1-dev-8steps-lora.safetensors

Stack Trace

  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)

  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/Mflux-ComfyUI/Mflux_Air.py", line 194, in generate
    flux = load_or_create_flux(model, quantize, Local_model if Local_model else None, lora_paths, lora_scales, ControlNet is not None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/Mflux-ComfyUI/Mflux_Air.py", line 24, in load_or_create_flux
    flux_cache[key] = FluxClass(
                      ^^^^^^^^^^

  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/flux/flux.py", line 52, in __init__
    weights = WeightHandler(
              ^^^^^^^^^^^^^^

  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/weights/weight_handler.py", line 28, in __init__
    LoraUtil.apply_loras(self.transformer, lora_paths, lora_scales)

  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/weights/lora_util.py", line 18, in apply_loras
    LoraUtil._apply_lora(transformer, lora_file, lora_scale)

  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/weights/lora_util.py", line 36, in _apply_lora
    lora_transformer, _ = WeightHandler.load_transformer(lora_path=lora_file)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/weights/weight_handler.py", line 64, in load_transformer
    weights, quantization_level = WeightHandler._get_weights("transformer", root_path, lora_path)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/weights/weight_handler.py", line 123, in _get_weights
    weight = list(mx.load(lora_path).items())
                  ^^^^^^^^^^^^^^^^^^

System Information

  • ComfyUI Version: unknown
  • Arguments: main.py --fp16-vae --lowvram
  • OS: posix
  • Python Version: 3.12.1 | packaged by Anaconda, Inc. | (main, Jan 19 2024, 09:45:58) [Clang 14.0.6 ]
  • Embedded Python: false
  • PyTorch Version: 2.3.1

Devices

  • Name: mps
    • Type: mps
    • VRAM Total: 34359738368
    • VRAM Free: 17109286912
    • Torch VRAM Total: 34359738368
    • Torch VRAM Free: 17109286912

Logs

2024-11-02 09:59:26,655 - root - INFO - Total VRAM 32768 MB, total RAM 32768 MB
2024-11-02 09:59:26,655 - root - INFO - pytorch version: 2.3.1
2024-11-02 09:59:26,655 - root - INFO - Set vram state to: SHARED
2024-11-02 09:59:26,655 - root - INFO - Device: mps
2024-11-02 09:59:27,243 - root - INFO - Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
2024-11-02 09:59:28,031 - root - INFO - [Prompt Server] web root: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/web
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path checkpoints /Volumes/WD_Element/comfyui/models/checkpoints/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path configs /Volumes/WD_Element/comfyui/models/configs/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path clip /Volumes/WD_Element/comfyui/models/clip/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path clip_vision /Volumes/WD_Element/comfyui/models/clip_vision/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path vae /Volumes/WD_Element/comfyui/models/vae/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path Mflux /Volumes/WD_Element/comfyui/models/Mflux/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path loras /Volumes/WD_Element/comfyui/models/Loras/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path loras /Volumes/WD_Element/comfyui/models/LyCORIS/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path ESRGAN /Volumes/WD_Element/comfyui/models/ESRGAN/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path RealESRGAN /Volumes/WD_Element/comfyui/models/RealESRGAN/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path SwinIR /Volumes/WD_Element/comfyui/models/SwinIR/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path upscale_models /Volumes/WD_Element/comfyui/models/upscale_models/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path embeddings /Volumes/WD_Element/comfyui/models/embeddings/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path hypernetworks /Volumes/WD_Element/comfyui/models/hypernetworks/
2024-11-02 09:59:28,032 - root - INFO - Adding extra search path controlnet /Volumes/WD_Element/comfyui/models/ControlNet/
2024-11-02 09:59:28,033 - root - INFO - Adding extra search path controlnet /Volumes/WD_Element/comfyui/models/xlabs/controlnets/
2024-11-02 09:59:28,033 - root - INFO - Adding extra search path photomaker /Volumes/WD_Element/comfyui/models/photomaker/
2024-11-02 09:59:28,033 - root - INFO - Adding extra search path inpaint /Volumes/WD_Element/comfyui/models/inpaint/
2024-11-02 09:59:28,033 - root - INFO - Adding extra search path ipadapter /Volumes/WD_Element/comfyui/models/ipadapter/
2024-11-02 09:59:28,033 - root - INFO - Adding extra search path unet /Volumes/WD_Element/comfyui/models/unet/
2024-11-02 09:59:29,439 - root - INFO - Total VRAM 32768 MB, total RAM 32768 MB
2024-11-02 09:59:29,439 - root - INFO - pytorch version: 2.3.1
2024-11-02 09:59:29,439 - root - INFO - Set vram state to: SHARED
2024-11-02 09:59:29,439 - root - INFO - Device: mps
2024-11-02 09:59:31,542 - root - INFO - 
Import times for custom nodes:
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/websocket_image_save.py
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/Cup-ClipBoard
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/cg-use-everywhere
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI_IPAdapter_plus
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI-CUP
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/comfyui-inpaint-nodes
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI_UltimateSDUpscale
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/comfyui-tooling-nodes
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI-KJNodes
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI_bitsandbytes_NF4
2024-11-02 09:59:31,542 - root - INFO -    0.0 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI-Manager
2024-11-02 09:59:31,542 - root - INFO -    0.1 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/Mflux-ComfyUI
2024-11-02 09:59:31,542 - root - INFO -    0.2 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/comfyui_segment_anything_plus
2024-11-02 09:59:31,542 - root - INFO -    0.2 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/comfyui_controlnet_aux
2024-11-02 09:59:31,542 - root - INFO -    0.2 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/virtuoso-nodes
2024-11-02 09:59:31,542 - root - INFO -    0.3 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI-Image-Filters
2024-11-02 09:59:31,542 - root - INFO -    0.6 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUI-Easy-Use
2024-11-02 09:59:31,542 - root - INFO -    0.7 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/ComfyUi-Ollama-YN
2024-11-02 09:59:31,542 - root - INFO -    0.8 seconds: /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/was-node-suite-comfyui
2024-11-02 09:59:31,542 - root - INFO - 
2024-11-02 09:59:31,546 - root - INFO - Starting server

2024-11-02 09:59:31,546 - root - INFO - To see the GUI go to: http://127.0.0.1:8188
2024-11-02 09:59:42,910 - root - INFO - got prompt
2024-11-02 09:59:43,144 - root - ERROR - !!! Exception during processing !!! [load_safetensors] Failed to open file /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/models/loras/Flux/Hyper-FLUX.1-dev-8steps-lora.safetensors
2024-11-02 09:59:43,146 - root - ERROR - Traceback (most recent call last):
  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/Mflux-ComfyUI/Mflux_Air.py", line 194, in generate
    flux = load_or_create_flux(model, quantize, Local_model if Local_model else None, lora_paths, lora_scales, ControlNet is not None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/custom_nodes/Mflux-ComfyUI/Mflux_Air.py", line 24, in load_or_create_flux
    flux_cache[key] = FluxClass(
                      ^^^^^^^^^^
  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/flux/flux.py", line 52, in __init__
    weights = WeightHandler(
              ^^^^^^^^^^^^^^
  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/weights/weight_handler.py", line 28, in __init__
    LoraUtil.apply_loras(self.transformer, lora_paths, lora_scales)
  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/weights/lora_util.py", line 18, in apply_loras
    LoraUtil._apply_lora(transformer, lora_file, lora_scale)
  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/weights/lora_util.py", line 36, in _apply_lora
    lora_transformer, _ = WeightHandler.load_transformer(lora_path=lora_file)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/weights/weight_handler.py", line 64, in load_transformer
    weights, quantization_level = WeightHandler._get_weights("transformer", root_path, lora_path)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/wengyinghui/miniconda3/lib/python3.12/site-packages/mflux/weights/weight_handler.py", line 123, in _get_weights
    weight = list(mx.load(lora_path).items())
                  ^^^^^^^^^^^^^^^^^^
RuntimeError: [load_safetensors] Failed to open file /Users/wengyinghui/ComfyUI_windows_portable/ComfyUI/models/loras/Flux/Hyper-FLUX.1-dev-8steps-lora.safetensors

2024-11-02 09:59:43,146 - root - INFO - Prompt executed in 0.23 seconds
2024-11-02 09:59:43,291 - root - WARNING - Failed to get ComfyUI version: Command '['git', 'describe', '--tags']' returned non-zero exit status 128.

Attached Workflow

Please make sure that workflow does not contain any sensitive information such as API keys or passwords.

{"last_node_id":21,"last_link_id":15,"nodes":[{"id":3,"type":"PreviewImage","pos":{"0":1506,"1":595},"size":{"0":210,"1":246},"flags":{},"order":3,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":1}],"outputs":[],"properties":{"Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":2,"type":"QuickMfluxNode","pos":{"0":1047,"1":574},"size":{"0":400,"1":352},"flags":{},"order":2,"mode":0,"inputs":[{"name":"Local_model","type":"PATH","link":14,"shape":7},{"name":"image","type":"MfluxImagePipeline","link":null,"shape":7},{"name":"Loras","type":"MfluxLorasPipeline","link":15,"shape":7},{"name":"ControlNet","type":"MfluxControlNetPipeline","link":null,"shape":7}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[1],"slot_index":0}],"properties":{"Node name for S&R":"QuickMfluxNode"},"widgets_values":["a girl play guitar on sofa,","dev","8",1120017715420786,"randomize",1024,1024,8,3.5,true]},{"id":9,"type":"MfluxModelsLoader","pos":{"0":562,"1":566},"size":{"0":315,"1":58},"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"Local_model","type":"PATH","links":[14],"slot_index":0}],"properties":{"Node name for S&R":"MfluxModelsLoader"},"widgets_values":["MFLUX.1-dev-8-bit"]},{"id":17,"type":"MfluxLorasLoader","pos":{"0":558,"1":706},"size":{"0":393.82196044921875,"1":178},"flags":{},"order":1,"mode":0,"inputs":[{"name":"Loras","type":"MfluxLorasPipeline","link":null,"shape":7}],"outputs":[{"name":"Loras","type":"MfluxLorasPipeline","links":[15],"slot_index":0}],"properties":{"Node name for S&R":"MfluxLorasLoader"},"widgets_values":["Flux/Hyper-FLUX.1-dev-8steps-lora.safetensors",1,"None",1,"None",1]}],"links":[[1,2,0,3,0,"IMAGE"],[14,9,0,2,0,"PATH"],[15,17,0,2,2,"MfluxLorasPipeline"]],"groups":[],"config":{},"extra":{"ds":{"scale":1.4641000000000062,"offset":[-258.8469816069085,-310.0283203110333]}},"version":0.4}

Additional Context

(Please add any additional context or steps to reproduce the error here)

@tolozine
Copy link
Author

tolozine commented Nov 2, 2024

另外,设置的extra_model_paths下载模型不会放置到这个目录

@raysers
Copy link
Owner

raysers commented Nov 2, 2024

@tolozine 啊?我没有设置过extra_model_paths啊,lora一直是comfyui自带的路径,就是model/loras.只要lora放进去就可以识别,但不是所有的lora都能兼容mflux。据mflux官网的说明,应该支持比较好的是C站的大部分lora,但注意官网只说大部分,不是全部,有些不兼容的lora在运行过程中才能得知。

路径这些我在旧的说明文件中有作过说明,但这次更新图生图被我删除了,因为我看这个插件发布至今总共才百来个用户,老用户已经都熟知路径了。这是我的失误,插件比较冷清,我也有点颓丧,以为不会有多少新用户了,因此在readme里我删除了路径说明。如果这个插件仍然有新用户,我会将路径说明添加回去。

@tolozine
Copy link
Author

tolozine commented Nov 2, 2024

@tolozine 啊?我没有设置过extra_model_paths啊,lora一直是comfyui自带的路径,就是model/loras.只要lora放进去就可以识别,但不是所有的lora都能兼容mflux。据mflux官网的说明,应该支持比较好的是C站的大部分lora,但注意官网只说大部分,不是全部,有些不兼容的lora在运行过程中才能得知。

路径这些我在旧的说明文件中有作过说明,但这次更新图生图被我删除了,因为我看这个插件发布至今总共才百来个用户,老用户已经都熟知路径了。这是我的失误,插件比较冷清,我也有点颓丧,以为不会有多少新用户了,因此在readme里我删除了路径说明。如果这个插件仍然有新用户,我会将路径说明添加回去。

知道了。感谢~你可以放几个你用过的推荐lora这样会更友好

@raysers
Copy link
Owner

raysers commented Nov 2, 2024

@tolozine 可惜我不是lora重度使用者,不然我确实可以做一些推荐。其实官方就开过这种类似的兼容测试帖子,具体filipstrand/mflux#47

要是让我个人推荐,当然4步dev的lora是值得推荐的,有些lora还有现在仅支持的的controlnet canny也是只能在dev上生效的,能4步dev出图的话确实能大大节省时间,快速抽卡。我这几天在研究怎么实现实时预览,遇到了瓶颈,在实现实时预览之前,这个4步lora确实是方便的权宜选择

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