Shopify / Background Replacement, 1-Click installers for Windows, RunPod, Massed Compute and Kaggle - This App is for replacing background of anything such as Product Images
🕑 Added 2024-04-23 21:01:00 +0000 UTCPatreon exclusive posts index to find our scripts easily, Patreon scripts updates history to see which updates arrived to which scripts and amazing Patreon special generative scripts list that you can use in any of your task.
Join discord to get help, chat, discuss and also tell me your discord username to get your special rank : SECourses Discord
Please also Star, Watch and Fork our Stable Diffusion & Generative AI GitHub repository and join our Reddit subreddit and follow me on LinkedIn (my real profile)
=======
Latest installers zip file : shopify_v6.zip
24 April 2025 Update
I have updated app to work with RTX 5000 series
This required some code changes as well to make it work with recent torch
The app working blazing fast on RTX 5090
Windows Requirements
Python 3.10.11, FFmpeg, CUDA 12.4, cuDNN 8.9.7, C++ Tools and Git
If it doesn't work make sure to below NEW tutorial and install everything exactly as shown in this below tutorial
Make sure to have installed Python 3.11, it doesn't have to be default Python version
16 November 2024 Update:
Libraries updated to better version and now works even faster
Free Kaggle notebook is made and working amazing
The Kaggle notebook updated and working
Massed Compute installers and RunPod installer added
Installation:
Download the attached zip file and extract into a folder where you want to install (no SPACES or non-English characters super important, e.g.: bg_replace) where you want to install.
Double click and start Windows_Install .bat file. This will install everything automatically for you
After that we will use Windows_Run_APP .bat file to start the Shopify Background replacement app
When you use the Windows_Run_APP .bat first time running it will download necessary model files into models sub folder
The app started url will be by default http://127.0.0.1:7860/ and it will automatically open in browser
1024x1024 pixel resolution of images are the best for this APP but looks like supporting all resolutions
Follow the instructions written on the Gradio
Let me know also if you find better settings
How To Install and Use:
This app is for replacing background of anything, especially for products
Windows:
First watch above requirements tutorial and follow every step
Extract zip archive into a drive like c:/FramePack_v1
Longer directory path or space character or special character in folder paths causes issues
Double click and install with Windows_Install.bat
Then run with Windows_Start_App.bat
If you get model download error open Windows_Start_APP.bat with a notepad editor and make "HF_HUB_ENABLE_HF_TRANSFER=0"
Massed Compute (Recommend Cloud) :
Please register via this link : https://vm.massedcompute.com/signup?linkId=lp_034338&sourceId=secourses&tenantId=massed-compute
Use our coupon SECourses
Our coupon works on all GPUs now
H100 has amazing price and speed but you can use like RTX A6000 ADA as well
Full details here : https://www.patreon.com/posts/26671823
Then select our image SECourses from Creator dropdown
Then follow Massed_Compute_Instructions_READ.txt
Same as my any other Massed Compute installer script
Example tutorial for learn how to install and use Massed Compute
(Starts at 12:58) : https://youtu.be/KW-MHmoNcqo?si=G1WbG-Qw4ujWvOtG&t=778
RunPod (Cloud):
Please register via this link : https://runpod.io?ref=1aka98lq
Then follow Runpod_Instructions_READ.txt
Same as my any other RunPod installer script
Use the template written in Runpod_Instructions_READ.txt file
Example tutorial for learn how to install and use RunPod
(starts at 22:03) : https://youtu.be/KW-MHmoNcqo?si=QN8X8Sjn13ZYu-EU&t=1323
Comments
Steven Lee
I keep getting the issue: Hugging Face cache folders set to: E:\AI\shopify_v6\background-replacement\models Traceback (most recent call last): File "E:\AI\shopify_v6\background-replacement\app.py", line 2, in import gradio as gr ModuleNotFoundError: No module named 'gradio' Press any key to continue . . .
Steven Lee
I run into an issue where if I use the windows installer "Windows_Install.bat" file. The requirements.txt is from a conda environment therefore it does not get installed. How must this file be modified so that the necessary packages get installed in the venv?
Furkan Gözükara
yes using kaggle has so many disadvantageous
huiminh ding
see, the ngrok GUI cannot easily come out,
huiminh ding
no, thanks
Furkan Gözükara
well you need custom code for that. i dont know how to do from cmd. you need to hire a programmer for you to code. if you got a good budget i may code
huiminh ding
Can I do batch replacements in the command line without a GUI interface, and what is the code?
Furkan Gözükara
you have cuda error. please follow this video and install cuda 12.4 python 3.10 : https://youtu.be/DrhUHnYfwC0 i use win 11 too
big dato
win 11 error WARNING: Failed to find CUDA. Traceback (most recent call last): File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\utils\import_utils.py", line 853, in _get_module return importlib.import_module("." + module_name, self.__name__) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\loaders\single_file.py", line 24, in from .single_file_utils import ( File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\loaders\single_file_utils.py", line 28, in from ..models.modeling_utils import load_state_dict File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\models\modeling_utils.py", line 35, in from ..quantizers import DiffusersAutoQuantizer, DiffusersQuantizer File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\quantizers\__init__.py", line 15, in from .auto import DiffusersAutoQuantizer File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\quantizers\auto.py", line 21, in from .bitsandbytes import BnB4BitDiffusersQuantizer, BnB8BitDiffusersQuantizer File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\quantizers\bitsandbytes\__init__.py", line 2, in from .utils import dequantize_and_replace, dequantize_bnb_weight, replace_with_bnb_linear File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\quantizers\bitsandbytes\utils.py", line 32, in import bitsandbytes as bnb File "C:\shopify_v5\background-replacement\venv\lib\site-packages\bitsandbytes\__init__.py", line 16, in from .nn import modules File "C:\shopify_v5\background-replacement\venv\lib\site-packages\bitsandbytes\nn\__init__.py", line 17, in from .triton_based_modules import ( File "C:\shopify_v5\background-replacement\venv\lib\site-packages\bitsandbytes\nn\triton_based_modules.py", line 6, in from bitsandbytes.triton.dequantize_rowwise import dequantize_rowwise File "C:\shopify_v5\background-replacement\venv\lib\site-packages\bitsandbytes\triton\dequantize_rowwise.py", line 11, in import triton File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\__init__.py", line 20, in from .runtime import ( File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\runtime\__init__.py", line 1, in from .autotuner import (Autotuner, Config, Heuristics, autotune, heuristics) File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\runtime\autotuner.py", line 9, in from ..testing import do_bench, do_bench_cudagraph File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\testing.py", line 7, in from . import language as tl File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\language\__init__.py", line 4, in from . import math File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\language\math.py", line 1, in from . import core File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\language\core.py", line 10, in from ..runtime.jit import jit File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\runtime\jit.py", line 12, in from ..runtime.driver import driver File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\runtime\driver.py", line 1, in from ..backends import backends File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\backends\__init__.py", line 50, in backends = _discover_backends() File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\backends\__init__.py", line 43, in _discover_backends compiler = _load_module(name, os.path.join(root, name, 'compiler.py')) File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\backends\__init__.py", line 12, in _load_module spec.loader.exec_module(module) File "C:\shopify_v5\background-replacement\venv\lib\site-packages\triton\backends\amd\compiler.py", line 2, in from triton._C.libtriton import ir, passes, llvm, amd ImportError: DLL load failed while importing libtriton: 动态链接库(DLL)初始化例程失败。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\utils\import_utils.py", line 853, in _get_module return importlib.import_module("." + module_name, self.__name__) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\pipelines\controlnet\pipeline_controlnet_sd_xl.py", line 35, in from ...loaders import ( File "", line 1075, in _handle_fromlist File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\utils\import_utils.py", line 843, in __getattr__ module = self._get_module(self._class_to_module[name]) File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\utils\import_utils.py", line 855, in _get_module raise RuntimeError( RuntimeError: Failed to import diffusers.loaders.single_file because of the following error (look up to see its traceback): DLL load failed while importing libtriton: 动态链接库(DLL)初始化例程失败。 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\shopify_v5\background-replacement\app.py", line 3, in from background_replacer import replace_background File "C:\shopify_v5\background-replacement\background_replacer.py", line 18, in from pipeline import init as init_pipeline, run_pipeline File "C:\shopify_v5\background-replacement\pipeline.py", line 3, in from diffusers import StableDiffusionXLControlNetPipeline, ControlNetModel, AutoencoderKL, UniPCMultistepScheduler File "", line 1075, in _handle_fromlist File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\utils\import_utils.py", line 844, in __getattr__ value = getattr(module, name) File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\utils\import_utils.py", line 844, in __getattr__ value = getattr(module, name) File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\utils\import_utils.py", line 843, in __getattr__ module = self._get_module(self._class_to_module[name]) File "C:\shopify_v5\background-replacement\venv\lib\site-packages\diffusers\utils\import_utils.py", line 855, in _get_module raise RuntimeError( RuntimeError: Failed to import diffusers.pipelines.controlnet.pipeline_controlnet_sd_xl because of the following error (look up to see its traceback): Failed to import diffusers.loaders.single_file because of the following error (look up to see its traceback): DLL load failed while importing libtriton: 动态链接库(DLL)初始化例程失败。 请按任意键继续. . .
Furkan Gözükara
yep fixed with newest zip file
huiminh ding
Could I know if the error has been solved on kaggle notebook? Thanks, please let me know.
huiminh ding
thanks a lot
Furkan Gözükara
give me some time i will fix kaggle notebook hopefully
huiminh ding
Do I need virtual environment?
huiminh ding
/kaggle/working/background-replacement Traceback (most recent call last): File "/opt/conda/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1778, in _get_module return importlib.import_module("." + module_name, self.__name__) File "/opt/conda/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/opt/conda/lib/python3.10/site-packages/transformers/pipelines/__init__.py", line 26, in from ..image_processing_utils import BaseImageProcessor File "/opt/conda/lib/python3.10/site-packages/transformers/image_processing_utils.py", line 21, in from .image_transforms import center_crop, normalize, rescale File "/opt/conda/lib/python3.10/site-packages/transformers/image_transforms.py", line 22, in from .image_utils import ( File "/opt/conda/lib/python3.10/site-packages/transformers/image_utils.py", line 58, in from torchvision.transforms import InterpolationMode File "/opt/conda/lib/python3.10/site-packages/torchvision/__init__.py", line 10, in from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils # usort:skip File "/opt/conda/lib/python3.10/site-packages/torchvision/_meta_registrations.py", line 163, in @torch.library.register_fake("torchvision::nms") AttributeError: module 'torch.library' has no attribute 'register_fake' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/kaggle/working/background-replacement/app.py", line 3, in from background_replacer import replace_background File "/kaggle/working/background-replacement/background_replacer.py", line 14, in from captioner import init as init_captioner, derive_caption File "/kaggle/working/background-replacement/captioner.py", line 1, in from transformers import pipeline File "", line 1075, in _handle_fromlist File "/opt/conda/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1766, in __getattr__ module = self._get_module(self._class_to_module[name]) File "/opt/conda/lib/python3.10/site-packages/transformers/utils/import_utils.py", line 1780, in _get_module raise RuntimeError( RuntimeError: Failed to import transformers.pipelines because of the following error (look up to see its traceback): module 'torch.library' has no attribute 'register_fake'
Furkan Gözükara
no this doesnt change product only background
huiminh ding
will this change the product
Andrea Rotondo
thank you very much
Furkan Gözükara
in the pipeline.py. you need to find hugging face repo that includes diffusers files and then you can change : pipe = StableDiffusionXLControlNetPipeline.from_pretrained( i dont know if single safetensors would work but you can try with giving full path. i will try in a moment
Andrea Rotondo
good morning where can i change the SDXL MODEL?
Furkan Gözükara
inside pipeline.py you will see it loads models
Jesse
How would I replace the model? I don't see where it's stored / accessed.
Furkan Gözükara
i never tried but theoretically should work fine. if you try let me know please
Jesse
This is very cool. Are we able to change the model to a different SDXL model?
Furkan Gözükara
sure. make sure that python 3.10.11 is default version set. then do reinstall. also don't forget c++ tools. while installing if you get any error copy entire cmd output and email me monstermmorpg@gmail.com
Chloe
ok thanks for letting me know. ill install 3.10
Furkan Gözükara
hi. sadly 3.11 will not work. please install 3.10.11 and make it default as shown here : https://youtu.be/-NjNy7afOQ0 also install c++ tools and ffmpeg too
Chloe
Hi thanks for replying, I am using python 3,11 and just re-installed it on disc C and get this message: Traceback (most recent call last): File "C:\backgroundrpl\background-replacement\app.py", line 2, in import gradio as gr ModuleNotFoundError: No module named 'gradio' Press any key to continue . . .
Furkan Gözükara
hello. you need to install both python and the background-replacement directly into your drive. e.g. python will be in c:/python310 and background will be in D:/background_replace . no space character or not non english character. i am also testing script right now to verify it is working or not still with a fresh install
Chloe
Hi I have a problem running this script: Traceback (most recent call last): File "C:\Users\User\Desktop\backgroundreplacement\background-replacement\app.py", line 3, in from background_replacer import replace_background File "C:\Users\User\Desktop\backgroundreplacement\background-replacement\background_replacer.py", line 25, in init_segmenter() File "C:\Users\User\Desktop\backgroundreplacement\background-replacement\segmenter.py", line 35, in init import data_loader_cache ModuleNotFoundError: No module named 'data_loader_cache' Press any key to continue . . .
Furkan Gözükara
just fixed and replied you from discord ty
PhotoFaceFun
Traceback (most recent call last): File "D:\pimages\background-replacement\app.py", line 150, in num_inference_steps = gr.Slider(precision=0,minimum=1, maximum=300,value=30, default=30,step=1, label="Num Inference Steps") File "D:\pimages\background-replacement\venv\lib\site-packages\gradio\component_meta.py", line 146, in wrapper return fn(self, **kwargs) TypeError: Slider.__init__() got an unexpected keyword argument 'precision' To continue, press any key. . . help me solve the problem Thank you
PhotoFaceFun
Hello.🤝 Startup problem - Auto Windows Installer For SDXL Background Replacement for Product Images A matching Triton is not available, some optimizations will not be enabled. Error caught was: No module named 'triton' Initializing captioner... Initializing upscaler... Initializing segmenter... Initializing depth estimator... Initializing depth ControlNet... Initializing autoencoder... Initializing SDXL pipeline... Loading pipeline components...: 100%|████████████████████████████████████████████████████| 7/7 [00:08<00:00, 1.26s/it] Traceback (most recent call last): File "D:\pimages\background-replacement\app.py", line 150, in num_inference_steps = gr.Slider(precision=0,minimum=1, maximum=300,value=30, default=30,step=1, label="Num Inference Steps") File "D:\pimages\background-replacement\venv\lib\site-packages\gradio\component_meta.py", line 146, in wrapper return fn(self, **kwargs) TypeError: Slider.init() got an unexpected keyword argument 'precision' To continue, press any key. . .
hi mizu
Thank you sir. I appreciate your work.
Furkan Gözükara
yes here for runpod : https://www.patreon.com/posts/auto-runpod-for-89919157
hi mizu
Is this possible to run in Runpod or Paperspace?
Furkan Gözükara
for example this repo : https://github.com/xuebinqin/DIS
JS
What open source repos where you referring to?
JS
SECourses: Tutorials, Guides, Resources, Training, MidJourney, Voice Clone, TTS, ChatGPT, GPT, LLM, Scripts by Furkan Gözükara 1w I don't think so you can make. They are using some third party open source repos i never seen.
Furkan Gözükara
can you elaborate more because i didn't understand the question.
JS
Are you referring to the repos that your install.bat and run.bat use, or repos installed by Comfy UI?
Furkan Gözükara
please message me from discord and show screenshots. it doesn't show error here.
Furkan Gözükara
I don't think so you can make. They are using some third party open source repos i never seen.
James Sheffield
That's a great tutorial. Do you know how to do this in ComfyUI?
Andy Le
it stopped there, no more processing, i waited for more than 3 hours, so that turn off cmd window and run it again, but it couldnt run anymore
Andy Le
Initializing captioner... Initializing upscaler... Initializing segmenter... Cloning into 'git\xuebinqin\DIS'... remote: Enumerating objects: 343, done. remote: Counting objects: 100% (109/109), done. remote: Compressing objects: 100% (43/43), done. remote: Total 343 (delta 89), reused 66 (delta 66), pack-reused 234 iB/s Receiving objects: 100% (343/343), 49.63 MiB | 7.90 MiB/s, done. Resolving deltas: 100% (165/165), done.
Andy Le
first i run install.bat after that, i continue to run.bat. it ran in minutes and stop working, screen frozen. i turn off the screen and try to open it again, it said some errors on screen and push me to press any key..its closed. I install python 3.10 and git 2.0 (required to run stable diffsuion Automatic1111 ver 1.6 on my PC)
Furkan Gözükara
hello. do you have python and git installed? what version of Python you have? first did you click install . bat file?
Andy Le
i couldnt start with it. Is is bug in run.bat ?