Stability-AI / stablediffusion

High-Resolution Image Synthesis with Latent Diffusion Models
MIT License
39.21k stars 5.06k forks source link

Unable to Locate 'imwatermark' Module #371

Open Greenhat09 opened 7 months ago

Greenhat09 commented 7 months ago

I'm encountering an issue while attempting to execute a Python script named txt2img.py. After installing all the required libraries using 'pip install -r requirements.py', I tried to run the script with the following command: 'python scripts/txt2img.py --prompt "cat" --ckpt weights/768-v-ema.ckpt --config configs/stable-diffusion/v2-inference-v.yaml --H 768 --W 768'. However, I received the following error message:

Traceback (most recent call last): File "/Users/dylan/Documents/AI_art/stablediffusion/scripts/txt2img.py", line 14, in from imwatermark import WatermarkEncoder ModuleNotFoundError: No module named 'imwatermark'

I'm using Ubuntu 20.04 with Python 3.9. Could you assist me in troubleshooting this problem?

Hemakshi011 commented 7 months ago

Install with pip install invisible-watermark If you continue getting the error after invisible-watermark installation, change the line from imWatermark import WatermarkEncoder in txt2img.py to from imwatermark import WatermarkEncoder (Lowercase) Source: https://stackoverflow.com/questions/74524544/importerror-cannot-import-name-watermarkencoder-from-imwatermark