hustille / ComfyUI_Fooocus_KSampler

Fooocus KSamplerWithRefiner as a ComfyUI node
GNU General Public License v3.0
60 stars 11 forks source link

installation instructions? #1

Closed tastez closed 1 year ago

tastez commented 1 year ago

hi, does this differ from regular custom nodes installation? Im getting an import error Would be great to have an example node setup too as an image

toyxyz commented 1 year ago

I had the following error:

Traceback (most recent call last): File "C:\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1688, in load_custom_node module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Fooocus_KSampler__init__.py", line 1, in from .sampler.nodes import KSamplerWithRefiner File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Fooocus_KSampler\sampler\nodes.py", line 7, in from .Fooocus import core File "C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Fooocus_KSampler\sampler\Fooocus\core.py", line 13, in from comfy.sample import prepare_mask, broadcast_cond, load_additional_models, cleanup_additional_models ImportError: cannot import name 'load_additional_models' from 'comfy.sample' (C:\ComfyUI_windows_portable\ComfyUI\comfy\sample.py)

Cannot import C:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Fooocus_KSampler module for custom nodes: cannot import name 'load_additional_models' from 'comfy.sample' (C:\ComfyUI_windows_portable\ComfyUI\comfy\sample.py)

hustille commented 1 year ago

I've seen that error once on one machine, but am struggling to reproduce it - working on it ...

hustille commented 1 year ago

Ok, the last revision of ComfyUI renamed load_additional_models to get_additional_models. The portable windows version has not been updated yet. Unsure how to resolve this ...

hustille commented 1 year ago

I patched it. Please pull the new version and check whether this works.

tastez commented 1 year ago

great it loads! thank you for patching. I have 0 idea how to wire it up however so an example would be great. My own attempt caused errors, but i didnt use a refiner and just plugged in the same sdxl model

hustille commented 1 year ago

There already is an example. Look for test ksampler refiner.json in the module dir.

tastez commented 1 year ago

There already is an example. Look for test ksampler refiner.json in the module dir.

cool - was expecting a screenshot and forgot jsons work too. I dragged it in, it loaded everything up - i changed some models but got an error

 Prompt outputs failed validation
CLIPTextEncodeSDXL:
- Return type mismatch between linked nodes: text_g, ASCII != STRING
- Return type mismatch between linked nodes: text_l, ASCII != STRING
CLIPTextEncodeSDXL:
- Return type mismatch between linked nodes: text_g, ASCII != STRING
- Return type mismatch between linked nodes: text_l, ASCII != STRING
CLIPTextEncodeSDXLRefiner:
- Return type mismatch between linked nodes: text, ASCII != STRING
jepjoo commented 1 year ago

I had the import error aswell on Windows. Fixed by update, however, I get this error when using "test ksampler refiner.json"

100%|█████████████████████████████████████████████████████████████████████████| 30/30 [00:05<00:00, 5.38it/s] !!! Exception during processing !!! Traceback (most recent call last): File "G:\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "G:\ComfyUI_windows_portable\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 "G:\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) File "G:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Fooocus_KSampler\sampler\nodes.py", line 49, in sample return (core.ksampler_with_refiner(model, positive, negative, refiner_model, refiner_positive, refiner_negative, latent_image, noise_seed, steps, refiner_switch_step, cfg, sampler_name, scheduler, denoise=denoise, disable_noise=disable_noise, start_step=start_at_step, last_step=end_at_step, force_full_denoise=force_full_denoise), ) File "G:\ComfyUI_windows_portable\python_embeded\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context return func(args, **kwargs) File "G:\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_Fooocus_KSampler\sampler\Fooocus\core.py", line 252, in ksampler_with_refiner comfy.sample.cleanup_additional_modelsst_cond(models) AttributeError: module 'comfy.sample' has no attribute 'cleanup_additional_modelsst_cond'

Prompt executed in 11.56 seconds

hustille commented 1 year ago

Both problems should be fixed now. Please try again.

jepjoo commented 1 year ago

Both problems should be fixed now. Please try again.

Works now with test ksampler refiner.json

Thanks!

tastez commented 1 year ago

still blowing up here for some reason - using test json


Failed to validate prompt for output 9:
* CLIPTextEncodeSDXL 17:
  - Return type mismatch between linked nodes: text_g, ASCII != STRING
  - Return type mismatch between linked nodes: text_l, ASCII != STRING
* CLIPTextEncodeSDXL 22:
  - Return type mismatch between linked nodes: text_g, ASCII != STRING
  - Return type mismatch between linked nodes: text_l, ASCII != STRING
* CLIPTextEncodeSDXLRefiner 23:
  - Return type mismatch between linked nodes: text, ASCII != STRING
Output will be ignored
invalid prompt: {'type': 'prompt_outputs_failed_validation', 'message': 'Prompt outputs failed validation', 'details': '', 'extra_info': {}}
tastez commented 1 year ago

ended up rewiring some things and the node is working really well!