BlenderNeko / ComfyUI_TiledKSampler

Tiled samplers for ComfyUI
GNU General Public License v3.0
327 stars 18 forks source link

Entire extension broken by ComfyUI sample.py refactor from 3 days ago #42

Closed clockworkwhale closed 5 months ago

clockworkwhale commented 6 months ago

Relevant commit: https://github.com/comfyanonymous/ComfyUI/commit/0542088ef895b4825df80fd3babf91513441af65

The linked commit above from 3 days ago that refactored sample.py has broken this extension.

Traceback (most recent call last): File "C:\comfy\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\comfy\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\comfy\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\comfy\custom_nodes\ComfyUI_TiledKSampler-master\nodes.py", line 320, in sample return sample_common(model, 'enable', seed, tile_width, tile_height, tiling_strategy, steps_total, cfg, sampler_name, scheduler, positive, negative, latent_image, steps_total-steps, steps_total, 'disable', denoise=1.0, preview=True)

File "C:\comfy\custom_nodes\ComfyUI_TiledKSampler-master\nodes.py", line 124, in sample_common positive_copy = comfy.sample.convert_cond(positive) ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'comfy.sample' has no attribute 'convert_cond'

TheBill2001 commented 6 months ago

I have not tested it, but after brief look over the code, it seems that the function is move to another file. The line: https://github.com/BlenderNeko/ComfyUI_TiledKSampler/blob/4fcc003f62efdbdec2f79eab37e1fb8dd84bac64/nodes.py#L124-L125 Should be change to:

    positive_copy = comfy.sampler_helpers.convert_cond(positive)
    negative_copy = comfy.sampler_helpers.convert_cond(negative) 
TheBill2001 commented 6 months ago

Well, I tried! There are more changes that are outside my level.

cubiq commented 6 months ago

I believe the worst offender is:

https://github.com/BlenderNeko/ComfyUI_TiledKSampler/blob/4fcc003f62efdbdec2f79eab37e1fb8dd84bac64/nodes.py#L129-L131

KSampler now expects model_patcher and not the model.

I don't use this extension but I had a similar issue with another code. Something like this should fix the problem, but there might be other small things to fix

model_patcher = comfy.model_patcher.ModelPatcher(model.model, load_device=device, offload_device=comfy.model_management.unet_offload_device())

sampler = comfy.samplers.KSampler(model_patcher, steps=steps, device=device, sampler=sampler_name, scheduler=scheduler, denoise=denoise, model_options=model.model_options)

hope it helps, good luck

clockworkwhale commented 5 months ago

Closing my issue as BlenderNeko has pushed a new version and the extension's working again 👍