Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running the inference command #7

Open
raniasyed opened this issue Jun 19, 2024 · 3 comments
Open

Error running the inference command #7

raniasyed opened this issue Jun 19, 2024 · 3 comments

Comments

@raniasyed
Copy link

Whenever I run the command to harmonize multiple images, I get this error:

OSError: Can't load config for 'stabilityai/stable-diffusion-2-base'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'stabilityai/stable-diffusion-2-base' is the correct path to a directory containing a model_index.json file

And when I try logging in to hugging face using huggingface -cli login, I get this:
requests.exceptions.SSLError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/whoami-v2 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: EE certificate key too weak (_ssl.c:1007)')))"), '(Request ID: eb7b7154-574c-4480-a29a-89ea3d9e238e)')

Please help me solve the issue.

@WindVChen
Copy link
Owner

Hi @raniasyed ,

I didn't encounter such an issue before, but maybe you can have a look at this issue huggingface/transformers#17611 which is quite similar.

Besides, there could also sometimes be internet problem. You can also have a try to add this script at the start of the code (refer to CompVis/stable-diffusion#302 (comment)):

import os
os.environ['HF_ENDPOINT']='https://hf-mirror.com'

@raniasyed
Copy link
Author

Hey, thank you for helping me out with that @WindVChen ! I just have one more question. The inference script takes a lot of time even for a single image. If I need to reduce the runtime, do you think removing text embedding optimization or commenting out UNET and passing the background image directly will work without affecting the code that much? Also can you point where you used these in the code? I couldn't quite grasp it since I am a beginner.

@WindVChen
Copy link
Owner

Hi @raniasyed ,

The time cost mainly comes from multiple iterations of text embeddings optimization (code refer to here), null-text embeddings optimization (code refer to here), and the multiple rounds of the above operations (code refer to here).

Based on the visualizations of the ablation study in Fig. 11 (paper v2), "removing text embedding optimization" will deteriorate the performance. As for "commenting out UNET", I'm not quite sure what it means. Do you mean removing the UNET in the diffusion model structure? And could you give more explanations about "passing the background image directly"?

A straightforward solution to reduce time cost is Earlystopping, when you have got satisfactory results after a harmonization round. Another possible way is to replace the DDIM scheduler (50 steps) with other faster schedulers like DPMSolver (about 20 steps). To achieve that, you may also need to modify the hyper parameters like learning rates in the script for good adaptation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants