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

Error - Upscaling triggers during Inpainting with a torch.load error (mask size is also not being detected correctly) #31

Open
dt126 opened this issue Jul 24, 2024 · 0 comments

Comments

@dt126
Copy link

dt126 commented Jul 24, 2024

Strange one. I am using your Inpainting Workflow and trying to incorporate other nodes which send the image and mask separately into the Fooocus Inpaint node. It works under some conditions but then a very slight change to the mask will trigger the following error:

!!! Exception during processing!!! 'NoneType' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead.

I will put the entire log below, but both the successful and failed runs reach the steps:
[Fooocus] Encoding negative #1 ...
[Fooocus] Image processing ...
At this point, the successful attempt will go to VAE Inpaint encoding. The failed one will attempt, "Upscaling image with shape (615, 615, 3)"

However, in both case, the image is 1024X1024, the mask is also 1024X1024, and Fooocus loader is set to 1024X1024. I made a few tests and discovered that if I take a failed mask and add something at the edge, like a gray line, then the mask processes correctly. Even when the process works correctly it often incorrectly shows the latent size - 1024 X 960 in the example below.

I think that there may two issues here. The main error is probably caused by something in my Comfyui install not allowing the Upscale to work. Hopefully you have a suggestion for me to try here.

However, I think that there also may be a bug that is causing the upscaling to begin in the first place since I am sending a 1024X1024 mask. Alternatively, your program may be trying to crop around the mask and upscale for higher resolution. If so, it's still odd that it is not detecting the sizes correctly.

I can upload an image along with working and non-working masks if you wish. Let me know what to try for the error I am getting.

Thank you:

WORKING LOG:
got prompt
[rgthree] Using rgthree's optimized recursive execution.
[Parameters] Adaptive CFG = 7.0
[Parameters] Sharpness = 2.0
[Parameters] ControlNet Softness = 0.25
[Parameters] ADM Scale = 1.5 : 0.8 : 0.3
[Parameters] CFG = 4.0
[Parameters] Seed = 827575702105265

PS: PS not connected

[Fooocus] Downloading upscale models ...
Downloading inpainter ...
[Inpaint] Current inpaint model is C:\A1111\StabilityMatrix\Packages\ComfyUI\models\inpaint\inpaint_v26.fooocus.patch
[Parameters] Sampler = dpmpp_2m_sde_gpu - karras
[Parameters] Steps = 30 - 24
[Fooocus] Initializing ...
[Fooocus] Loading models ...
Synthetic Refiner Activated
Synthetic Refiner Activated
Request to load LoRAs [] for model [C:\A1111\StabilityMatrix\Models\StableDiffusion\SDXL\juggernautXL_v8Rundiffusion.safetensors].
[Fooocus] Processing prompts ...
[Fooocus] Encoding positive #1 ...
[Fooocus] Encoding negative #1 ...
[Fooocus] Image processing ...
[Fooocus] VAE Inpaint encoding ...
[Fooocus] VAE encoding ..
Final resolution is (1024, 1024), latent is (1024, 960).
[Parameters] Denoising Strength = 1.0
[Parameters] Initial Latent shape: Image Space (1024, 960)
Preparation time: 2.88 seconds
[Fooocus] Moving model to GPU ...
Current Task 1 ……
[Sampler] refiner_swap_method = joint
[Sampler] sigma_min = 0.0291671771556139, sigma_max = 14.614643096923828
Requested to load SDXL
Loading 1 new model

FAILED LOG:
[rgthree] Using rgthree's optimized recursive execution.

PS: PS not connected

[Parameters] Adaptive CFG = 7.0
[Parameters] Sharpness = 2.0
[Parameters] ControlNet Softness = 0.25
[Parameters] ADM Scale = 1.5 : 0.8 : 0.3
[Parameters] CFG = 4.0
[Parameters] Seed = 803864263111364
[Fooocus] Downloading upscale models ...
Downloading inpainter ...
[Inpaint] Current inpaint model is C:\A1111\StabilityMatrix\Packages\ComfyUI\models\inpaint\inpaint_v26.fooocus.patch
[Parameters] Sampler = dpmpp_2m_sde_gpu - karras
[Parameters] Steps = 30 - 24
[Fooocus] Initializing ...
[Fooocus] Loading models ...
Synthetic Refiner Activated
Synthetic Refiner Activated
Request to load LoRAs [] for model [C:\A1111\StabilityMatrix\Models\StableDiffusion\SDXL\juggernautXL_v8Rundiffusion.safetensors].
Requested to load GPT2LMHeadModel
Loading 1 new model
[Fooocus Model Management] Moving model(s) has taken 0.20 seconds
[Fooocus] Processing prompts ...
[Fooocus] Encoding positive #1 ...
[Fooocus] Encoding negative #1 ...
[Fooocus] Image processing ...
Upscaling image with shape (615, 615, 3) ...
!!! Exception during processing!!! 'NoneType' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead.

Traceback (most recent call last):
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\venv\lib\site-packages\torch\serialization.py", line 531, in _check_seekable
f.seek(f.tell())
AttributeError: 'NoneType' object has no attribute 'seek'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\custom_nodes\Fooocus_Nodes\py\modules\patch.py", line 465, in loader
result = original_loader(*args, **kwargs)
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\venv\lib\site-packages\torch\serialization.py", line 986, in load
with _open_file_like(f, 'rb') as opened_file:
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\venv\lib\site-packages\torch\serialization.py", line 440, in _open_file_like
return _open_buffer_reader(name_or_buffer)
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\venv\lib\site-packages\torch\serialization.py", line 425, in init
_check_seekable(buffer)
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\venv\lib\site-packages\torch\serialization.py", line 534, in _check_seekable
raise_err_msg(["seek", "tell"], e)
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\venv\lib\site-packages\torch\serialization.py", line 527, in raise_err_msg
raise type(e)(msg)
AttributeError: 'NoneType' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "C:\A1111\StabilityMatrix\Packages\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 "C:\A1111\StabilityMatrix\Packages\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\custom_nodes\Fooocus_Nodes\py\fooocusNodes.py", line 556, in fooocus_preKSampler
inpaint_worker.current_task = inpaint_worker.InpaintWorker(
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\custom_nodes\Fooocus_Nodes\py\modules\inpaint_worker.py", line 162, in init
self.interested_image = perform_upscale(self.interested_image)
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\custom_nodes\Fooocus_Nodes\py\modules\upscaler.py", line 21, in perform_upscale
sd = torch.load(model_filename)
File "C:\A1111\StabilityMatrix\Packages\ComfyUI\custom_nodes\Fooocus_Nodes\py\modules\patch.py", line 481, in loader
raise ValueError(exp)
ValueError: 'NoneType' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load from it instead.

@dt126 dt126 changed the title Error - Upscaling triggers during Inpainting with an error (mask size is not being detected correctly) Error - Upscaling triggers during Inpainting with a torch.load error (mask size is also not being detected correctly) Jul 25, 2024
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

1 participant