stable-diffusion-webui-Layer-Divider
stable-diffusion-webui-Layer-Divider copied to clipboard
Error while Loading SAM model! [Errno 2]
Hello! I tried testing this extension on Google Colab, but I'm getting the following errors. Apparently (I'm a complete beginner, so I may be wrong), the issue is with the slashes - the code seems to be using Windows-style path notation. I tried editing the sam.py file and modifying the path, but it didn't resolve the error. :<
Layer Divider Extension : applying configs to model..
Layer Divider Extension : Error while Loading SAM model! [Errno 2] No such file or directory: '/content/gdrive/MyDrive/sd/stable-diffusion-webui/models/sam\\sam_vit_h_4b8939.pth'
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/gradio/routes.py", line 394, in run_predict
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.9/dist-packages/gradio/blocks.py", line 1075, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.9/dist-packages/gradio/blocks.py", line 884, in call_function
prediction = await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.9/dist-packages/anyio/to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/usr/local/lib/python3.9/dist-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.9/dist-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-Layer-Divider/scripts/layer_divider_modules/sam.py", line 68, in generate_mask_app
self.set_mask_generator()
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-Layer-Divider/scripts/layer_divider_modules/sam.py", line 42, in set_mask_generator
self.mask_generator = SamAutomaticMaskGenerator(
File "/usr/local/lib/python3.9/dist-packages/segment_anything/automatic_mask_generator.py", line 123, in __init__
self.predictor = SamPredictor(model)
File "/usr/local/lib/python3.9/dist-packages/segment_anything/predictor.py", line 31, in __init__
self.transform = ResizeLongestSide(sam_model.image_encoder.img_size)
AttributeError: 'NoneType' object has no attribute 'image_encoder'
Hi, I just fixed the path bug. Please re-download the extension and let me know if you encounter same issue. Also, may I know if you are using MacOS??
Thank you very much, now there is no issue with generating, but I noticed that the .psd files are being generated in the wrong location. According to the "readme" file, the files should be placed in the *\extensions\stable-diffusion-webui-layer-divider\layer_divider_outputs\psd folder, but I see that the ones generated by me now ended up in *\extensions.
In response to your question - I am using Windows 10, but as I mentioned earlier, I am running Stable Diffusion on Google Colab, which is a Linux environment, if I am not mistaken.
I've just fixed another mistake, now the PSD file should be saved where it is intended to be. Could you re-download the extension again and check if the issue has been resolved?
Unfortunately, the file is still being created in the incorrect folder. :/
That's strange. I just tried to reproduce the bug in Colab, but the files are being saved as intended.
removing the extension and then installing it again should fix the problem.
I apologize for the late response. I decided to make a classic move and delete everything to start from scratch. Unfortunately, I encountered a new problem - the "Layer Divider" tab does not appear in the WebUI. When installing the add-on in the console, I receive the following messages:
Installing Layer Divider Extension: Installing opencv-python
Installing Layer Divider Extension: Installing pytoshop==1.1.0
Error loading script: layer_divider.py
Traceback (most recent call last):
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 256, in load_scripts
script_module = script_loading.load_module(scriptfile.path)
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
module_spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-Layer-Divider/scripts/layer_divider.py", line 2, in <module>
install_sam()
File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/stable-diffusion-webui-Layer-Divider/scripts/layer_divider_modules/installation.py", line 19, in install_sam
is_extension_there = any(filename.endswith(('.so', '.pyd')) for filename in os.listdir(pytoshop_path))
FileNotFoundError: [Errno 2] No such file or directory: '/content/gdrive/MyDrive/sd/stable-diffusion-webui/venv/Lib/site-packages/pytoshop'
I am having the same error as casidias when installing on stable diffusion the install fails : Installing Layer Divider Extension: Installing segment-anything Installing Layer Divider Extension: Installing opencv-python Installing Layer Divider Extension: Installing pycocotools Error loading script: layer_divider.py
Really looking forward to using this by the way! Have you thought about implementing inpainting for object occlusion within each layer? I think that would make this a true game changer, I've read something about it here but not sure if they have something similar with SAM https://github.com/YihongSun/Bayesian-Amodal