facebookresearch / stable_signature

Official implementation of the paper "The Stable Signature Rooting Watermarks in Latent Diffusion Models"
Other
385 stars 48 forks source link

with diffusers code problem #18

Closed peppaaaaaaa closed 8 months ago

peppaaaaaaa commented 8 months ago

Thanks for your "with diffusers" code. I would like to ask if I can use this code and replace it with StableDiffusionInpaintPipeline, using v2-inference.yaml and sd-v1-5-inpainting.ckpt. When I pass in a watermarked image (using the encode in hidden), does the output watermark still remain unchanged?

At the same time, I encountered the following error while running the code. I would like to ask how to load this LDM model(I am a beginner and there may be many parts that I do not understand. Please forgive me) Traceback (most recent call last): File "D:\SAM\stable_signature-main\impaint.py", line 14, in ldm_ae = load_model_from_config(config, ldm_ckpt) File "D:\SAM\stable_signature-main\utils_model.py", line 140, in load_model_from_config model = instantiate_from_config(config.model) File "D:\SAM\stable_signature-main\utils_model.py", line 125, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) File "D:\SAM\stable_signature-main\utils_model.py", line 132, in get_obj_from_str return getattr(importlib.import_module(module, package=None), cls) File "C:\Users\Lenovo\anaconda3\lib\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 972, in _find_and_load_unlocked File "", line 228, in _call_with_frames_removed File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 972, in _find_and_load_unlocked File "", line 228, in _call_with_frames_removed File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 972, in _find_and_load_unlocked File "", line 228, in _call_with_frames_removed File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'ldm'

Looking for your reply!

feihua11 commented 8 months ago

Hello, I have also encountered this problem. Have you resolved it

pierrefdz commented 8 months ago

Hi, sorry I haven't had the time to look into it...

For this question:

I would like to ask if I can use this code and replace it with StableDiffusionInpaintPipeline, using v2-inference.yaml and sd-v1-5-inpainting.ckpt. When I pass in a watermarked image (using the encode in hidden), does the output watermark still remain unchanged?

I think the VAE is not the same for the inpainting task (it was not when I did the experiments last year, but it may have changed). This means that you'll need to redo the fine-tuning of this specific VAE (see finetune_decoder.py). You'll need to check that the config and weights of the LDM VAE used for inpainting are properly loaded. In my case the files looked something like: stable-diffusion-2-inpainting/v2-inpainting-inference.yaml stable-diffusion-2-inpainting/512-inpainting-ema.ckpt

At the same time, I encountered the following error while running the code. I would like to ask how to load this LDM model(I am a beginner and there may be many parts that I do not understand. Please forgive me)

It means that https://github.com/facebookresearch/stable_signature/tree/main/src/ldm is not imported. You can maybe try to force it by adding sys.path.append('src') at the beginning of utils_model.py.

feihua11 commented 8 months ago

Thank you very much. I have resolved this issue by importing the LDM folder

pierrefdz commented 8 months ago

I'm closing this since no activity. Don't hesitate to re-open if needed