TinyTerra / ComfyUI_tinyterraNodes

A selection of nodes for Stable Diffusion ComfyUI
GNU General Public License v3.0
421 stars 45 forks source link

ttn xy plot and oipe ksampler having an issue with writing labels on the grid image #23

Closed EricRollei closed 6 months ago

EricRollei commented 1 year ago

I have a 3 node set with the ttn pipe loader, ttn xyplot, and ttn ksampler as in your demo everything works - all images are generated and can be seen in the ksampler preview window but when it comes to assembling the imagegrid and writing the labels, there's an error. None of the individual images are saved, nor is the image grid. I posted to the matrix for ComfyUI and the consensus was this maybe an error with the custom nodes so I'm posting here: Below is the error message from the console. btw - I'm using windows standalone, nightly build, windows 11, python 3.11, everything updated. Thank you - I really like your nodes, and want to use your xy plot because how nicely yours loads the xy info.

got prompt [ttN] Warning: pipeKSampler[2]: The selected latent_id (15) is out of range. [ttN] Warning: pipeKSampler[2]: Automatically setting the latent_id to the last image in the list (index: 0). [ttN] Plot Values 1/9 ->: X: pos prompt 1, Y: Favorites\deliberate_v2.safetensors 100%|##################################################################################| 20/20 [00:01<00:00, 11.99it/s] [ttN] Plot Values 2/9 ->: X: pos prompt 1, Y: NEW\epicrealism_pureEvolutionV5.safetensors 100%|##################################################################################| 20/20 [00:01<00:00, 12.06it/s] [ttN] Plot Values 3/9 ->: X: pos prompt 1, Y: NEW\dreamshaper_8.safetensors 100%|##################################################################################| 20/20 [00:01<00:00, 12.08it/s] [ttN] Plot Values 4/9 ->: X: pos prompt 2, Y: Favorites\deliberate_v2.safetensors 100%|##################################################################################| 20/20 [00:01<00:00, 12.05it/s] [ttN] Plot Values 5/9 ->: X: pos prompt 2, Y: NEW\epicrealism_pureEvolutionV5.safetensors 100%|##################################################################################| 20/20 [00:01<00:00, 12.21it/s] [ttN] Plot Values 6/9 ->: X: pos prompt 2, Y: NEW\dreamshaper_8.safetensors 100%|##################################################################################| 20/20 [00:01<00:00, 12.23it/s] [ttN] Plot Values 7/9 ->: X: pos prompt 3, Y: Favorites\deliberate_v2.safetensors 100%|##################################################################################| 20/20 [00:01<00:00, 12.12it/s] [ttN] Plot Values 8/9 ->: X: pos prompt 3, Y: NEW\epicrealism_pureEvolutionV5.safetensors 100%|##################################################################################| 20/20 [00:01<00:00, 12.24it/s] [ttN] Plot Values 9/9 ->: X: pos prompt 3, Y: NEW\dreamshaper_8.safetensors 100%|##################################################################################| 20/20 [00:01<00:00, 12.16it/s] !!! Exception during processing !!! Traceback (most recent call last): File "A:\Comfy_Aug\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\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 "A:\Comfy_Aug\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1433, in sample return ttN_TSC_pipeKSampler.sample(self, pipe, lora_name, lora_model_strength, lora_clip_strength, sampler_state, steps, cfg, sampler_name, scheduler, image_output, save_prefix, denoise, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1356, in sample return process_xyPlot(self, pipe, lora_name, lora_model_strength, lora_clip_strength, steps, cfg, sampler_name, scheduler, denoise, image_output, preview_prefix, save_prefix, prompt, extra_pnginfo, my_unique_id, preview_latent, xyPlot) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1311, in process_xyPlot label_bg = create_label(img, x_label[col_index], int(48 img.width / 512)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1220, in create_label font_size = adjusted_font_size(text, initial_font_size, label_width) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1190, in adjusted_font_size textwidth, = font.getsize(text) ^^^^^^^^^^^^ AttributeError: 'FreeTypeFont' object has no attribute 'getsize'

TinyTerra commented 1 year ago

Does this still happen with 1d0db99ec68044105682d772c53534a51747fa81?

EricRollei commented 1 year ago

Hi, thanks for the fast action on this! Just updated via the Comfy Manager and restarted. Unfortunately I think it is still happening. Error occurred when executing ttN pipeKSamplerAdvanced:

'FreeTypeFont' object has no attribute 'getsize'

File "A:\Comfy_Aug\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\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 "A:\Comfy_Aug\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(*slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1433, in sample return ttN_TSC_pipeKSampler.sample(self, pipe, lora_name, lora_model_strength, lora_clip_strength, sampler_state, steps, cfg, sampler_name, scheduler, image_output, save_prefix, denoise, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1356, in sample return process_xyPlot(self, pipe, lora_name, lora_model_strength, lora_clip_strength, steps, cfg, sampler_name, scheduler, denoise, image_output, preview_prefix, save_prefix, prompt, extra_pnginfo, my_unique_id, preview_latent, xyPlot) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1311, in process_xyPlot label_bg = create_label(img, x_label[col_index], int(48 img.width / 512)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1220, in create_label font_size = adjusted_font_size(text, initial_font_size, label_width) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "A:\Comfy_Aug\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1190, in adjusted_font_size textwidth, = font.getsize(text) ^^^^^^^^^^^^

TinyTerra commented 1 year ago

To confirm.. is there an Arial.ttf file in the ttN custom node folder now? - if not please try reinstalling the pack through git clone instead

alaturqua commented 1 year ago

I am having the same issue. There is arial.ttf in the folder but getting this error:


Error occurred when executing ttN pipeKSampler:

'FreeTypeFont' object has no attribute 'getsize'

  File "D:\Projects\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "D:\Projects\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 "D:\Projects\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 "D:\Projects\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1261, in sample
    return process_xyPlot(pipe, lora_name, lora_model_strength, lora_clip_strength, steps, cfg, sampler_name, scheduler, denoise, image_output, save_prefix, prompt, extra_pnginfo, my_unique_id, preview_latent, xyPlot)
  File "D:\Projects\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 1233, in process_xyPlot
    images = sampleXYplot.plot_images_and_labels()
  File "D:\Projects\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 682, in plot_images_and_labels
    label_bg = self.create_label(img, self.x_label[col_index], int(48 * img.width / 512))
  File "D:\Projects\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 500, in create_label
    font_size = self.adjust_font_size(text, initial_font_size, label_width)
  File "D:\Projects\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_tinyterraNodes\tinyterraNodes.py", line 488, in adjust_font_size
    text_width, _ = font.getsize(text)
Queue size: 0
Extra options
alaturqua commented 1 year ago

I solved my issue by uninstalling pillow and installing again using 9.5.0 version.

pip uninstall pillow

pip install pillow==9.5.0

PBETC commented 1 year ago

Hey,

How did you install this? direct on the python_embeded folder?

alaturqua commented 1 year ago

Hey,

How did you install this? direct on the python_embeded folder?

Yes, directly in python_embedded folder

pyhton -m <pip command>