stable-diffusion icon indicating copy to clipboard operation
stable-diffusion copied to clipboard

OSError: Error no file named model_index.json found in directory

Open DjTecmo opened this issue 3 years ago • 1 comments

WHY WHY WHY WHY WHY AND WHY IS THIS ERROR HAPENING WITHOUT ANY EXPLANATION ON THE INSTRUCTIONS OF HOW TO VOID IT!! OSError: Error no file named model_index.json found in directory /content/drive/MyDrive/stable_diffusion_weights/...

DjTecmo avatar Oct 17 '22 07:10 DjTecmo

My desperation is evident!!

DjTecmo avatar Oct 17 '22 07:10 DjTecmo

using accelerate config helped me to avoid this problem

batrlatom avatar Oct 17 '22 22:10 batrlatom

hmm, okey i will try, Can you tell me in which cell can I find it? A day with the problem and with so much code and code I sometimes skip where it could be

DjTecmo avatar Oct 18 '22 05:10 DjTecmo

how to use it?

using accelerate config helped me to avoid this problem

Ad4m69 avatar Oct 18 '22 05:10 Ad4m69

Just help me HOW i execute this configuration? i saw this warning on a previous cell: "To avoid this warning pass in values for each of the problematic parameters or run accelerate config". But how and where?

DjTecmo avatar Oct 18 '22 05:10 DjTecmo

I meet the problem when downloading the weight from Hugging Face following the readme.

pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=True)

This is the huggingface page of their model stable-diffusion-v1-4. You need to login and agree the terms to access the repo, otherwise a 404 or 403 error. There will be the model_index.json and other files you need. Besides, if you set use_auth_token=True in the code, you need to generate a token following the guide of huggingface.

QJ-Chen avatar Oct 21 '22 02:10 QJ-Chen

Thank you, you really helped know more about it. About the authentication token, do i need to generate a new one? it seems like google saved the last and put it automatically and the cell checked on green as correct so i thought that was fine, thank you!

DjTecmo avatar Oct 21 '22 14:10 DjTecmo

Thank you, you really helped know more about it. About the authentication token, do i need to generate a new one? it seems like google saved the last and put it automatically and the cell checked on green as correct so i thought that was fine, thank you!

I have the same problem. How did you decide that? Help me, friend!

andrruta avatar Oct 24 '22 16:10 andrruta

okey , i used to let the token_auth cell empty. It worked after filling it . but don't trust this anymore, i still got this error after some time trying to train other persons posterior time .using the notebook again to train another person, the error came out of nothing and yes, an empty file is missing when you look stablediffusion_weights, on you Drive. Idontknoe why

DjTecmo avatar Oct 26 '22 00:10 DjTecmo

using accelerate config helped me to avoid this problem

Bro why you only left that reply without an explanation, i don't understand this about that!! how you make that without messing it!??

DjTecmo avatar Oct 26 '22 00:10 DjTecmo

I meet the problem when downloading the weight from Hugging Face following the readme.

pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=True)

This is the huggingface page of their model stable-diffusion-v1-4. You need to login and agree the terms to access the repo, otherwise a 404 or 403 error. There will be the model_index.json and other files you need. Besides, if you set use_auth_token=True in the code, you need to generate a token following the guide of huggingface.

Thanks but, is this issue ... emm, wait, this things are supposed to be generated on the colab and saved on my Drive directory "weights" , are you telling me something i don't know will give me what i want , how i know the json files im looking will be usefull , are not this files unique? im training on Dreambooth google colab and I just run aparently correct the cells one by one making what is need to do on each one and this error don't says me what to do or don't to let the files be generated and saved correctly to be used by Inference Cell, on the same

DjTecmo avatar Oct 26 '22 06:10 DjTecmo

Earlier (about two weeks ago) I worked in this colab without any problems. This problem arose after changes in the construction of the collab. Now I tried everything I can (token replacement too) but all in vain. I understand that there is no solution to the problem. I didn't find a solution on the web either unfortunately.

andrruta avatar Oct 26 '22 09:10 andrruta

exactly as you said, tried everything, but yes, thank you, we will wait for an experts opinion so

El mié, 26 oct 2022 a la(s) 04:01, andrruta @.***) escribió:

Earlier (about two weeks ago) I worked in this colab without any problems. This problem arose after changes in the construction of the collab. Now I tried everything I can (token replacement too) but all in vain. I understand that there is no solution to the problem. I didn't find a solution on the web either unfortunately.

— Reply to this email directly, view it on GitHub https://github.com/CompVis/stable-diffusion/issues/394#issuecomment-1291722498, or unsubscribe https://github.com/notifications/unsubscribe-auth/A23DUPXPGHN3AFJH4UFMAFDWFDXNZANCNFSM6AAAAAARGZGOGE . You are receiving this because you modified the open/close state.Message ID: @.***>

DjTecmo avatar Oct 27 '22 02:10 DjTecmo

Earlier (about two weeks ago) I worked in this colab without any problems. This problem arose after changes in the construction of the collab. Now I tried everything I can (token replacement too) but all in vain. I understand that there is no solution to the problem. I didn't find a solution on the web either unfortunately.

Earlier (about two weeks ago) I worked in this colab without any problems. This problem arose after changes in the construction of the collab. Now I tried everything I can (token replacement too) but all in vain. I understand that there is no solution to the problem. I didn't find a solution on the web either unfortunately.

DjTecmo avatar Oct 27 '22 03:10 DjTecmo

Earlier (about two weeks ago) I worked in this colab without any problems. This problem arose after changes in the construction of the collab. Now I tried everything I can (token replacement too) but all in vain. I understand that there is no solution to the problem. I didn't find a solution on the web either unfortunately.

I found that having even more space than the minimum available required for the files is solving the problem. After having a trained model saved correctly in my drive(a sucessfull training with the collab) i cannot make it again with the previous one saved. because my space was just the required and sometimes less, so i solved it that way but mmm, i cannot erase more things in my drive than the important stuff so hope you all find another way or find this usefull. Reopen the case in case of neccesary

DjTecmo avatar Nov 04 '22 03:11 DjTecmo

The model and all files related to it, including model_index.json are downloaded to your home cache directory by default e.g home/username/.cache. You should find it in something like home/username/.cache/models--CompVis--stable-diffusion-v1-4/snapshots/133a221b8aa7292a167afc5127cb63fb5005638b/model_index.json.

If you can't locate your home cache directory, you can define a specific directory where you want model and its files to be saved by doing,

import os
cache_dir = "path/to/my/specific/directory"
os.environ['XDG_CACHE_HOME'] = cache_dir

Don't forget to pass this directory in the pipeline, and I am assuming your terminal has access to internet (which was the problem in my case), by doing

ldm = StableDiffusionPipeline.from_pretrained(type="CompVis/stable-diffusion-v1-4", use_auth_token=MY_TOKEN,  cache_dir=cache_dir)

update MY_TOKEN with the token from your hugging face profile, or you simply pass an empty string ""

danielajisafe avatar Feb 23 '24 21:02 danielajisafe

How do I know that this will solve my error and not generate others?

El vie, 23 de feb de 2024, 3:27 p. m., Daniel Ajisafe < @.***> escribió:

The model and all files related to it, including model_index.json are downloaded to your home cache directory by default e.g home/username/.cache. You should find it in something like home/username/.cache/models--CompVis--stable-diffusion-v1-4/snapshots/133a221b8aa7292a167afc5127cb63fb5005638b/model_index.json .

If you can't locate your home cache directory, you can define a specific directory where you want model and its files to be saved by doing,

import os cache_dir = "path/to/my/specific/directory" os.environ['XDG_CACHE_HOME'] = cache_dir

Don't forget to pass this directory in the pipeline, by doing

ldm = StableDiffusionPipeline.from_pretrained(type="CompVis/stable-diffusion-v1-4", use_auth_token=MY_TOKEN, cache_dir=cache_dir)

update MY_TOKEN with the token from your hugging face profile, or you simply pass an empty string ""

— Reply to this email directly, view it on GitHub https://github.com/CompVis/stable-diffusion/issues/394#issuecomment-1962012235, or unsubscribe https://github.com/notifications/unsubscribe-auth/A23DUPUVPMNQUACA77MLSBLYVECVJAVCNFSM6AAAAAARGZGOGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRSGAYTEMRTGU . You are receiving this because you modified the open/close state.Message ID: @.***>

DjTecmo avatar Feb 26 '24 07:02 DjTecmo

Hi! I was wondering did you find out the solution of your first question? My problem is CompVis/stable-diffusion-v1-4 does not appear to have a file named model_index.json. I'm confused about I can’t even find where this directory is

ProtegosLeviosa avatar Mar 10 '24 10:03 ProtegosLeviosa