Giter Site home page Giter Site logo

jhj0517 / stable-diffusion-webui-layer-divider Goto Github PK

View Code? Open in Web Editor NEW
155.0 5.0 13.0 1.56 MB

Layer-Divider, an extension for stable-diffusion-webui using the segment-anything model (SAM)

License: Apache License 2.0

Python 100.00%
ai open-source stable-diffusion stable-diffusion-webui-plugin gradio python

stable-diffusion-webui-layer-divider's Introduction

Layer-Divider

This is an implementaion of the SAM (Segment-Anything Model) within the SD WebUI.

Divide layers in the SD WebUI and save them as PSD files.

screenshot1

screenshot2

If you want a dedicated WebUI specifically for this, rather than as an extension, please visit this repository

Installation

git clone https://github.com/jhj0517/stable-diffusion-webui-Layer-Divider.git to your stable-diffusion-webui extensions folder.

or alternatively, download and unzip the repository in your extensions folder!

How to use

Adjust the parameters and click "Generate". The output will be displayed below, and a PSD file will be saved in the extensions\stable-diffusion-webui-layer-divider\layer_divider_outputs\psd folder.

Explanation of Parameters

Parameter Description
points_per_side The number of points to be sampled along one side of the image. The total number of points is points_per_side**2. If None, 'point_grids' must provide explicit point sampling.
pred_iou_thresh A filtering threshold in [0,1], using the model's predicted mask quality.
stability_score_thresh A filtering threshold in [0,1], using the stability of the mask under changes to the cutoff used to binarize the model's mask predictions.
crops_n_layers If >0, mask prediction will be run again on crops of the image. Sets the number of layers to run, where each layer has 2**i_layer number of image crops.
crop_n_points_downscale_factor The number of points-per-side sampled in layer n is scaled down by crop_n_points_downscale_factor**n.
min_mask_region_area If >0, postprocessing will be applied to remove disconnected regions and holes in masks with area smaller than min_mask_region_area. Requires opencv.

stable-diffusion-webui-layer-divider's People

Contributors

changesong avatar jhj0517 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

stable-diffusion-webui-layer-divider's Issues

Can't Export Results as .PSD

Whenever I click the folder icon labelled "(PSD)", I receive a popup that says "the system cannot find C:\Users\silve\Documents\AI". I also receive a message in the Auto1111 command prompt that says the same.

I have my Auto1111 installation inside of a folder called "AI Art". Could the space be causing an error? Or does it need a specific folder called "AI" in the Documents folder to export?

As an aside, it would be nice if you could set the export directory somehow. Either in an explorer menu or in a settings tab for the extension.

Download the psd file from the webui server to local.

Hi, thanks for the awesome plugin.

I'm currently using webui on a server. And this is a great plugin! But if you don't mind, I'd like to talk about a problem I'm having.
Since the created psd file is stored on the server and there is no way to download to client on webui, it is inconvenient to move it from the server every time. Images can be downloaded with a right-click in the webui, which is much easier.

I wish there was a way to save the psd files on client side.
Could you please implement this feature? thank you.

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'

memory leak?

I found that after I generated a psd, the vram is not released, the only way to release it is re-run the webui.

OS: windows 10
GPU: RTX 3050 8G

ubuntu 22.04 CUDA out of memory

Describe the bug
Not sure why it happens but it seems that too much memory is reserved.
Do you know how to free some?
Tried to allocate 4.04 GiB (GPU 0; 11.76 GiB total capacity; 7.74 GiB already allocated; 2.91 GiB free; 7.88 GiB reserved in total by PyTorch)

Layer Divider Extension : applying configs to model..
Traceback (most recent call last):
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/routes.py", line 422, in run_predict
    output = await app.get_blocks().process_api(
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1323, in process_api
    result = await self.call_function(
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1051, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/home/pm/stable-diffusion-webui/extensions/stable-diffusion-webui-Layer-Divider-master/scripts/layer_divider_modules/sam.py", line 74, in generate_mask_app
    masks = self.mask_generator.generate(image)
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/automatic_mask_generator.py", line 163, in generate
    mask_data = self._generate_masks(image)
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/automatic_mask_generator.py", line 206, in _generate_masks
    crop_data = self._process_crop(image, crop_box, layer_idx, orig_size)
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/automatic_mask_generator.py", line 245, in _process_crop
    batch_data = self._process_batch(points, cropped_im_size, crop_box, orig_size)
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/automatic_mask_generator.py", line 279, in _process_batch
    masks, iou_preds, _ = self.predictor.predict_torch(
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/predictor.py", line 238, in predict_torch
    masks = self.model.postprocess_masks(low_res_masks, self.input_size, self.original_size)
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/segment_anything/modeling/sam.py", line 161, in postprocess_masks
    masks = F.interpolate(masks, original_size, mode="bilinear", align_corners=False)
  File "/home/pm/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/nn/functional.py", line 3950, in interpolate
    return torch._C._nn.upsample_bilinear2d(input, output_size, align_corners, scale_factors)
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 4.04 GiB (GPU 0; 11.76 GiB total capacity; 7.74 GiB already allocated; 2.91 GiB free; 7.88 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

OS you are using:

  • OS: ubuntu 22.04

No such file or directory (mac OS)

Hi! Thank you for this great approach. I am eager to try this out, but I am running run into the following issue:

Layer Divider Extension : Error while Loading SAM model! [Errno 2] No such file or directory: '/Volumes/Swap/DANGER Diffusion/stable-diffusion-webui/models/sam\\sam_vit_h_4b8939.pth'
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/gradio/routes.py", line 394, in run_predict
    output = await app.get_blocks().process_api(
  File "/opt/homebrew/lib/python3.10/site-packages/gradio/blocks.py", line 1075, in process_api
    result = await self.call_function(
  File "/opt/homebrew/lib/python3.10/site-packages/gradio/blocks.py", line 884, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/opt/homebrew/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/opt/homebrew/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/opt/homebrew/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "/Volumes/Swap/DANGER Diffusion/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 "/Volumes/Swap/DANGER Diffusion/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 "/opt/homebrew/lib/python3.10/site-packages/segment_anything/automatic_mask_generator.py", line 123, in __init__
    self.predictor = SamPredictor(model)
  File "/opt/homebrew/lib/python3.10/site-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'

Hard coding model_path in sam.py (/Volumes/Swap/DANGER Diffusion/stable-diffusion-webui/models/sam/sam_vit_h_4b8939.pth) solves it for the moment. But then I get the same error that is mentioned here.

NameError: name 'packbits' is not defined

Using Automatic1111
image

File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict
output = await app.get_blocks().process_api(
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 1075, in process_api
result = await self.call_function(
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 884, in call_function
prediction = await anyio.to_thread.run_sync(
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "F:\AnotherStableD\stable-diffusion-webui-master\extensions\stable-diffusion-webui-Layer-Divider\scripts\layer_divider_modules\sam.py", line 71, in generate_mask_app
save_psd_with_masks(image, masks)
File "F:\AnotherStableD\stable-diffusion-webui-master\extensions\stable-diffusion-webui-Layer-Divider\scripts\layer_divider_modules\mask_utils.py", line 100, in save_psd_with_masks
save_psd(image, original_layer+mask_layers, ['Original_Image']+names, modes)
File "F:\AnotherStableD\stable-diffusion-webui-master\extensions\stable-diffusion-webui-Layer-Divider\scripts\layer_divider_modules\mask_utils.py", line 92, in save_psd
psd_file.write(output_file)
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\pytoshop\core.py", line 269, in write
self.layer_and_mask_info.write(fd, self)
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\pytoshop\layers.py", line 1323, in write
self.layer_info.write(fd, header)
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\pytoshop\layers.py", line 1134, in write
layer.write_channel_data(fd, header)
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\pytoshop\layers.py", line 1037, in write_channel_data
lengths.append(data.write(fd, header, shape))
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\pytoshop\layers.py", line 560, in write
codecs.compress_image(
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\pytoshop\codecs.py", line 432, in compress_image
return compressors[compression](fd, image, depth, version)
File "F:\AnotherStableD\stable-diffusion-webui-master\venv\lib\site-packages\pytoshop\codecs.py", line 292, in compress_rle
packed = packbits.encode(row)
NameError: name 'packbits' is not defined

应该是依赖版本不对,但不清除具体是要哪个版本

Layer Divider Extension : applying configs to model..
Traceback (most recent call last):
File "/home/ubuntu/aigc/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/routes.py", line 422, in run_predict
output = await app.get_blocks().process_api(
File "/home/ubuntu/aigc/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1326, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
File "/home/ubuntu/aigc/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1260, in postprocess_data
prediction_value = block.postprocess(prediction_value)
File "/home/ubuntu/aigc/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/components.py", line 4457, in postprocess
file = self.img_array_to_temp_file(img, dir=self.DEFAULT_TEMP_DIR)
File "/home/ubuntu/aigc/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/components.py", line 355, in img_array_to_temp_file
return self.pil_to_temp_file(pil_image, dir, format="png")
TypeError: save_pil_to_file() got an unexpected keyword argument 'format'

环境,
python3.10.10
pip 23.2.1

pytoshop 1.2.1
Cython 3.0.0

onnx 1.13.1
numba 0.56.4
numpy 1.23.5

--
SD 1.3.2   torch: 2.0.1+cu118  •  xformers: 0.0.19

Error on Pressing Generate

After installing the extension and having it download the SAM model, I've been receiving the following error whenever I press "Generate". It persisted after I shut down the WebUI entirely and restarted it.

Total progress: 0it [00:00, ?it/s]
Total progress: 0it [00:00, ?it/s]
Layer Divider Extension : applying configs to model..
Traceback (most recent call last):
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict
output = await app.get_blocks().process_api(
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1075, in process_api
result = await self.call_function(
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 884, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, *args)
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\extensions\stable-diffusion-webui-Layer-Divider\scripts\layer_divider_modules\sam.py", line 71, in generate_mask_app
save_psd_with_masks(image, masks)
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\extensions\stable-diffusion-webui-Layer-Divider\scripts\layer_divider_modules\mask_utils.py", line 100, in save_psd_with_masks
save_psd(image, original_layer+mask_layers, ['Original_Image']+names, modes)
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\extensions\stable-diffusion-webui-Layer-Divider\scripts\layer_divider_modules\mask_utils.py", line 92, in save_psd
psd_file.write(output_file)
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\pytoshop\core.py", line 281, in write
self.layer_and_mask_info.write(fd, self)
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\pytoshop\layers.py", line 1422, in write
self.layer_info.write(fd, header)
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\pytoshop\layers.py", line 1220, in write
layer.write_channel_data(fd, header)
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\pytoshop\layers.py", line 1116, in write_channel_data
lengths.append(data.write(fd, header, shape))
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\pytoshop\layers.py", line 602, in write
codecs.compress_image(
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\pytoshop\codecs.py", line 488, in compress_image
return compressors[compression](fd, image, depth, version)
File "C:\Users\silve\Documents\AI Art__Automatic1111\stable-diffusion-webui\venv\lib\site-packages\pytoshop\codecs.py", line 331, in compress_rle
packed = packbits.encode(row)
NameError: name 'packbits' is not defined

Fatal error C1083, failed with exit code2

Error while restarting UI after Installation

Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[AddNet] Updating model hashes...
[AddNet] Updating model hashes...
dirname: D:\NouvelAi\localizations
localizations: {'zh_CN': 'D:\NouvelAi\extensions\stable-diffusion-webui-localization-zh_CN\localizations\zh_CN.json'}
ControlNet preprocessor location: D:\NouvelAi\extensions\sd-webui-controlnet\annotator\downloads
2023-12-14 09:59:43,833 - ControlNet - INFO - ControlNet v1.1.422
2023-12-14 09:59:43,982 - ControlNet - INFO - ControlNet v1.1.422
Installing Layer Divider Extension: Installing segment-anything
Installing Layer Divider Extension: Installing opencv-python
Installing Layer Divider Extension: Installing pytoshop==1.1.0
INFO:root:running build_ext
INFO:root:building 'pytoshop.packbits' extension
INFO:root:"E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -ID:\NouvelAi\py310\include -ID:\NouvelAi\py310\Include "-IE:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\include" "-IE:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" /TcD:\NouvelAi\py310\Lib\site-packages\pytoshop\packbits.c /Fobuild\temp.win-amd64-cpython-310\Release\NouvelAi\py310\Lib\site-packages\pytoshop\packbits.obj
packbits.c
D:\NouvelAi\py310\Lib\site-packages\pytoshop\packbits.c(29): fatal error C1083: �޷��򿪰����ļ�: ��Python.h��: No such file or directory
error: command 'E:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\cl.exe' failed with exit code 2

  • OS: Windows 10

Could not install packages due to an OSError: [WinError 5] Access is denied..

ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied.. 
'C:\\path\\to\\SDWebUI\\venv\\Lib\\site-packages\\google\\~rotobuf\\internal\\_api_implementation.cp310-win_amd64.pyd'
Check the permissions.

During the initial installation of this extension, the above error occurs.

However, if you completely close the stable-diffusion WebUI and restart it, the extension appears and works fine.

I've investigated this, and it appears that this issue occurs in several extensions, not just my extension.

I'll leave this issue open until I know why this happens and find a solution.

Pytoshop error

Describe the bug
Extension won't load due to Pytoshop error.

Installing Layer Divider Extension: Installing  pytoshop==1.1.0
Error loading script: layer_divider.py
Traceback (most recent call last):
  File "/Users/Me/stable-diffusion-webui/modules/scripts.py", line 263, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "/Users/Me/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/Me/stable-diffusion-webui/extensions/stable-diffusion-webui-Layer-Divider/scripts/layer_divider.py", line 2, in <module>
    install_sam()
  File "/Users/Me/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: '/Users/Me/stable-diffusion-webui/venv/Lib/site-packages/pytoshop'

Tried installing Pytoshop into the environment manually with pip but it says its already installed

Me@MeMacPro stable-diffusion-webui % source venv/bin/activate 
(venv) Me@MeMacPro stable-diffusion-webui % pip install pytoshop                              
Requirement already satisfied: pytoshop in ./venv/lib/python3.10/site-packages (1.1.0)
Requirement already satisfied: cython in ./venv/lib/python3.10/site-packages (from pytoshop) (0.29.35)
Requirement already satisfied: numpy in ./venv/lib/python3.10/site-packages (from pytoshop) (1.23.5)

OS you are using:
macOS Ventura

EDIT: Okay I see the problem from re-reading this post.

changed in install.py

pytoshop_path = os.path.join(sd_path, 'venv', ‘Lib', 'site-packages', 'pytoshop')

to

pytoshop_path = os.path.join(sd_path, 'venv', 'lib', 'python3.10', 'site-packages', 'pytoshop')

and it works.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.