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

Fooocus Inpaint/Input Image showing Attribute Error #2155

Closed
trialsnabhi opened this issue Feb 4, 2024 · 12 comments
Closed

Fooocus Inpaint/Input Image showing Attribute Error #2155

trialsnabhi opened this issue Feb 4, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@trialsnabhi
Copy link

Read Troubleshoot

[x] I admit that I have read the Troubleshoot before making this issue.

Describe the problem
When I use Inpainting on Fooocus, Iam getting this error offlate. Hence unable to use inpaint on Fooocus at all !

Full Console Log

Traceback (most recent call last):
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/gradio/routes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/gradio/blocks.py", line 1429, in process_api
inputs = self.preprocess_data(fn_index, inputs, state)
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/gradio/blocks.py", line 1239, in preprocess_data
processed_input.append(block.preprocess(inputs[i]))
File "/home/studio-lab-user/Fooocus-Sagemaker-Studio-Lab/Fooocus/modules/gradio_hijack.py", line 278, in preprocess
im = processing_utils.decode_base64_to_image(x)
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/gradio/processing_utils.py", line 59, in decode_base64_to_image
img = Image.open(BytesIO(base64.b64decode(image_encoded)))
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/Image.py", line 3288, in open
"""
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/Image.py", line 3274, in _open_core
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/JpegImagePlugin.py", line 799, in jpeg_factory
im = JpegImageFile(fp, filename)
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/ImageFile.py", line 116, in init
self._open()
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/JpegImagePlugin.py", line 380, in _open
handler(self, i)
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/JpegImagePlugin.py", line 211, in SOF
self.mode = "RGB"
AttributeError: can't set attribute 'mode'
Traceback (most recent call last):
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/gradio/routes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/gradio/blocks.py", line 1429, in process_api
inputs = self.preprocess_data(fn_index, inputs, state)
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/gradio/blocks.py", line 1239, in preprocess_data
processed_input.append(block.preprocess(inputs[i]))
File "/home/studio-lab-user/Fooocus-Sagemaker-Studio-Lab/Fooocus/modules/gradio_hijack.py", line 278, in preprocess
im = processing_utils.decode_base64_to_image(x)
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/gradio/processing_utils.py", line 59, in decode_base64_to_image
img = Image.open(BytesIO(base64.b64decode(image_encoded)))
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/Image.py", line 3288, in open
"""
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/Image.py", line 3274, in _open_core
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/JpegImagePlugin.py", line 799, in jpeg_factory
im = JpegImageFile(fp, filename)
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/ImageFile.py", line 116, in init
self._open()
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/JpegImagePlugin.py", line 380, in _open
handler(self, i)
File "/home/studio-lab-user/.conda/envs/fooocus/lib/python3.10/site-packages/PIL/JpegImagePlugin.py", line 211, in SOF
self.mode = "RGB"
AttributeError: can't set attribute 'mode'

@trialsnabhi
Copy link
Author

It happens when there is any sort of Input Image .. Whether an inpaint/outpaint or ImagePrompt too

@trialsnabhi trialsnabhi changed the title Fooocus Inpaint showing Attribute Error Fooocus Inpaint/Input Image showing Attribute Error Feb 4, 2024
@mashb1t mashb1t added bug Something isn't working question Further information is requested can't reproduce This can not be reproduced labels Feb 4, 2024
@mashb1t
Copy link
Collaborator

mashb1t commented Feb 4, 2024

@trialsnabhi i've checked inpainting in all modes with various jpg images and have not been able to reproduce the issue.
The issue occurs in def SOF(self, marker) of PIL JpegImagePlugin.py, where the layers are mapped and the Start of frame marker can not set the mode accordingly as in your case the object doesn't have such a property.

This is not an issue of Fooocus but most likely a parsing problem of your specific image through PIL.
Can you please attach your source jpg image to debug the layers and / or type of jpg? Thanks!

@trialsnabhi
Copy link
Author

oh this happens with any image tat I use in the image prompt/inpatinting source.. either generated image or any jpg/png . Thats why I posted.
To give you more info, I use fooocus on amazonsagemaker labs and kaggle. Both are getting into a similar issue.

@mashb1t
Copy link
Collaborator

mashb1t commented Feb 5, 2024

Interesting... I don't have access to those services, maybe somebody else can support here.

@mashb1t mashb1t added help wanted Extra attention is needed and removed question Further information is requested labels Feb 5, 2024
@dhruvchandel
Copy link

Facing Similar Issue. I was also using Sagemaker notebook to run Fooocus.

@trialsnabhi
Copy link
Author

This may be caused by an indirect early import of PIL in launch.py. The import preceds an installation of Pillow==9.2.0 and remains cached.

If Pillow has been downgraded in this way from a version >=10.1.0, the mixture of modules is obviously incompatible: python-pillow/Pillow#7307

can you help me with a solution ?

@sehajbenipal
Copy link

Similar Issue. I was also using Sagemaker and kaggle notebook to run Fooocus.

@mashb1t mashb1t removed the can't reproduce This can not be reproduced label Feb 6, 2024
@mashb1t
Copy link
Collaborator

mashb1t commented Feb 6, 2024

I think the matter has been more or less resolved,. The solution is to either use a notebook without loading libraries before loading Fooocus or restarting the instance afterwards.
Closing for now, but still feel free to provide your feedback.

@mashb1t mashb1t closed this as not planned Won't fix, can't repro, duplicate, stale Feb 6, 2024
@mashb1t mashb1t removed the help wanted Extra attention is needed label Feb 6, 2024
@mashb1t
Copy link
Collaborator

mashb1t commented Feb 6, 2024

@rsl8 sure, feel free

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants
@mashb1t @dhruvchandel @sehajbenipal @trialsnabhi and others