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

run-time error #20

Open
zhangfeng0617 opened this issue Jul 7, 2024 · 17 comments
Open

run-time error #20

zhangfeng0617 opened this issue Jul 7, 2024 · 17 comments

Comments

@zhangfeng0617
Copy link

zhangfeng0617 commented Jul 7, 2024

Hello, may I ask if I have downloaded the pre-training model you sent to the local, changed the path in the code, or this problem, may I ask what is going on? thank you
image
image

@zhangfeng0617 zhangfeng0617 changed the title 运行出问题 run-time error Jul 7, 2024
@WindVChen
Copy link
Owner

Hi @zhangfeng0617 ,

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'

If you want to load the pre-trained model from the local machine, you may need to ensure downloading the correct type of files. Below is the needed file list of Stable Diffusion:
image

@zhangfeng0617
Copy link
Author

Thanks for your reply, can you give me a link to the pre-training model of this project? Maybe my pre-training model is not in the right file. thank you

@WindVChen
Copy link
Owner

Hi, you can find these files here.

@zhangfeng0617
Copy link
Author

thank you! thank you!

@zhangfeng0617
Copy link
Author

I downloaded the pre-training model to the local, there is this problem, hope you can help to answer it, thank you
image
Attack based on Diffusion***
Traceback (most recent call last):
File "main.py", line 114, in
ldm_stable = StableDiffusionPipeline.from_pretrained(pretrained_diffusion_path).to('cuda:0')
File "F:\Anaconda2023\anaconda3\envs\diffattack\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1037, in from_pretrained
loaded_sub_model = load_sub_model(
File "F:\Anaconda2023\anaconda3\envs\diffattack\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 450, in load_sub_model
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
File "F:\Anaconda2023\anaconda3\envs\diffattack\lib\site-packages\transformers\tokenization_utils_base.py", line 2094, in from_pretrained
raise EnvironmentError(
OSError: Can't load tokenizer for 'stabilityai/stable-diffusion-2-base\tokenizer'. 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\tokenizer' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.

Process finished with exit code 1
image

thanks!

@WindVChen
Copy link
Owner

Hi,

Could you please let me know the level of file path you passed into the code?

For example, here's my local save path:

image

And it should work when setting the --pretrained_diffusion_path="C:\Users\PC\.cache\huggingface\diffusers\models--stabilityai--stable-diffusion-2-base\snapshots\455a0f46082..." in the main.py.

@zhangfeng0617
Copy link
Author

This is the previous version you published, but it does not affect. I put the pre-trained model downloaded from the link you sent above into the project, and I also loaded it directly in the code. As shown in the figure. I see you put it under the C drive path, is that the reason? In addition, the pre-trained model I downloaded does not have huggingface\diffusers\ in front, is this affecting the operation? thank you
image
image

@WindVChen
Copy link
Owner

Ah, I think I understand the issue now.

I apologize for the confusion regarding the path specified in the code: --pretrained_diffusion_path="stabilityai/stable-diffusion-2-base". The value stabilityai/stable-diffusion-2-base does not refer to a local path. Instead, it points to the Hugging Face repository stabilityai/stable-diffusion-2-base from which the necessary weights will be downloaded automatically.

The error message you encountered previously might be due to a name collision if you have a local directory with the same name as the Hugging Face repository. To resolve this, please try using an absolute path for the --pretrained_diffusion_path parameter. If that doesn't work, consider renaming your local folder to something else.

@zhangfeng0617
Copy link
Author

It's okay. I'm the one who's learning and asking questions. I changed the local absolute path and changed the name of the pre-trained model, but it still didn't work. May I ask is there any other way? If I don't download the pre-trained model locally, I'll have a network problem like the one shown here. I really don't know what to do (crying and laughing), looking forward to your help, thank you.
image

@WindVChen
Copy link
Owner

Emm, that's a bit weird.

Typically, setting --pretrained_diffusion_path="stabilityai/stable-diffusion-2-base" should automatically download the weights. The error message shown in the screenshot still seems to be related to a network connection issue. Have you tried the potential solutions mentioned here?

@zhangfeng0617
Copy link
Author

I tried the method but it didn't work. I will download your project again and try it. Thank you very much for your trouble.

@WindVChen
Copy link
Owner

Sorry it didn't work out :( Please keep me informed if you manage to identify the issue.

@zhangfeng0617
Copy link
Author

Hello, because I am busy with other things at this time, so I have delayed this. I re-downloaded your project and tried to replace the versions of the request and urllib3 libraries, but I still had this connection problem. Also, I downloaded stable-diffusion-2-base locally, but I didn't use it. I just downloaded the project, and then hooked up the vpn to run it directly, but the following problems kept appearing. Is there a problem with the process of my running the project? Could you help me, please? Thank you. It's so much trouble. If possible, it would be best to add your contact information, so that I can consult you more easily, because I do encounter this problem is rather difficult. It's perfectly normal for you to say no. Thank you again.

The following is the error message:

File "F:\Anaconda2023\anaconda3\envs\diffattack\lib\site-packages\requests\adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: (MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /api/models/stabilityai/stable-diffusion-2-base (Caused by SSLError(SSLZeroReturnError(6, 'TLS/SSL connection has been closed (EOF) (_ssl.c:1135)')))"), '(Request ID: 38dcc369-6bd4-4e11-988c-2d545872bbb3)')

@WindVChen
Copy link
Owner

Hi @zhangfeng0617 ,

Apologies for the delayed response—things have been quite busy on my end as well.

Please feel free to send an email to [email protected], and I'll share my personal contact details there.

@zhangfeng0617
Copy link
Author

Ok, thank you, now I am busy with some other things, I will contact you when the school starts, thank you very much

@zhangfeng0617
Copy link
Author

The previous problem has been solved, because the hanging vpn only proxy browser, no proxy Pycharm. Now this problem has arisen, may I ask what the problem is, thank you very much

Attack based on Diffusion, Attacked Dataset: imagenet_compatible***
vae\diffusion_pytorch_model.safetensors not found
Fetching 13 files: 0%| | 0/13 [00:00<?, ?it/s]

@WindVChen
Copy link
Owner

WindVChen commented Sep 10, 2024

Hi,

From the error message, you may need to check if you've downloaded diffusion_pytorch_model.safetensors under the folder vae.

Below are the files under my folder:
image

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