XavierXiao / Dreambooth-Stable-Diffusion

Implementation of Dreambooth (https://arxiv.org/abs/2208.12242) with Stable Diffusion
MIT License
7.6k stars 795 forks source link

Colab won't generate from saved checkpoint - AttributeError: 'Options' object has no attribute 'filter_nsfw' #112

Open jaaaamIron opened 1 year ago

jaaaamIron commented 1 year ago

Hi.

I've already trained a model and successfully generate images with it using the Dreambooth colab notebook. However, I'm now trying to reload the trained checkpoint, and when I go to generate an image through the SD interface, I get the error in colab: AttributeError: 'Options' object has no attribute 'filter_nsfw'

It's probably worth point out that I'm not using Dreambooth to generate nsfw images, and I'm guessing this is some sort of safeguarding setting.

Does anyone know what to do, and is this a common issue?

The full error is this:

Error completing request Arguments: ('Chris2022 in a hospital, as a very old man.', '', 'None', 'None', 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 0, 0, 0, False, False, False, '', 1, '', 0, '', True, False, False) {} Traceback (most recent call last): File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 45, in f res = list(func(*args, *kwargs)) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 28, in f res = func(args, **kwargs) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/txt2img.py", line 49, in txt2img processed = process_images(p) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 430, in process_images res = process_images_inner(p) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 544, in process_images_inner if opts.filter_nsfw: File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/shared.py", line 459, in getattr return super(Options, self).getattribute(item) AttributeError: 'Options' object has no attribute 'filter_nsfw'

bissigb commented 1 year ago

I have the same issue, just selecting the model version V2.1-768px everything seems to work, till automatic1111 opens and i write a prompt and generate.

I am using this colab https://colab.research.google.com/github/TheLastBen/fast-stable-diffusion/blob/main/fast_stable_diffusion_AUTOMATIC1111.ipynb

100% 20/20 [00:03<00:00, 6.12it/s] Error completing request Arguments: ('test', '', 'None', 'None', 20, 1, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 0, 0, 0, False, False, False, '', 1, '', 0, '', True, False, False) {} Traceback (most recent call last): File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 45, in f res = list(func(*args, *kwargs)) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 28, in f res = func(args, **kwargs) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/txt2img.py", line 49, in txt2img processed = process_images(p) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 430, in process_images res = process_images_inner(p) File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 544, in process_images_inner if opts.filter_nsfw: File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/shared.py", line 459, in getattr return super(Options, self).getattribute(item) AttributeError: 'Options' object has no attribute 'filter_nsfw'

jaaaamIron commented 1 year ago

I fixed this by deleting my 'sd' folder on Google Drive. Next time I ran colab notebook it grabbed the latest version/re-downloaded and worked fine.

bissigb commented 1 year ago

Hi jaaaamIron, thanks have tried it but now i get other errors: Something went wrong, try again I tried it with reloading the original cpkt file and whithout, i also tried with other 2.1 ckpt files, dont work.

I was also switching to my other colab pro account, same result:

Converting to CKPT ... There was a problem when trying to write in your cache folder (/root/.cache/huggingface/hub). You should set the environment variable TRANSFORMERS_CACHE to a writable directory. Traceback (most recent call last): File "/content/convertosdv2.py", line 1107, in convert(args) File "/content/convertosdv2.py", line 1058, in convert pipe = StableDiffusionPipeline.from_pretrained(args.model_to_load, torch_dtype=load_dtype, tokenizer=None, safety_checker=None) File "/usr/local/lib/python3.8/dist-packages/diffusers/pipeline_utils.py", line 661, in from_pretrained loaded_sub_model = load_method(cached_folder, loading_kwargs) File "/usr/local/lib/python3.8/dist-packages/transformers/feature_extraction_utils.py", line 306, in from_pretrained feature_extractor_dict, kwargs = cls.get_feature_extractor_dict(pretrained_model_name_or_path, kwargs) File "/usr/local/lib/python3.8/dist-packages/transformers/feature_extraction_utils.py", line 402, in get_feature_extractor_dict resolved_feature_extractor_file = cached_file( File "/usr/local/lib/python3.8/dist-packages/transformers/utils/hub.py", line 380, in cached_file raise EnvironmentError( OSError: /content/stable-diffusion-V2 does not appear to have a file named preprocessor_config.json. Checkout 'https://huggingface.co//content/stable-diffusion-V2/None' for available files. Something went wrong, try again

I am not a coder, but i like this notebook because its better than other webuis, has lot more options...

Thanks for your suggestions

Bruno

bissigb commented 1 year ago

Hi jaaaamIron, finally i get it to work. Maybe login out and later login in Google Drive makes some difference, but deleting the sd-folder seems to be the key. I let the colab run with v2.1-768.ckpt but whitout re-download the original key. Thanks for your help! Bruno