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

#131
by Tecmo - opened

After using Dreambooth google collab, i run all teh cells correctly with no errors, and then on "Inference" cell with the error claiming: " OSError: Error no file named model_index.json found in directory". Evidently A file is missing when I look stablediffusion_weights person folder(empty), on you Drive, when it's supossed the files to be created at some point automatically. Why?? i cant solve this

Hi there! The model_index.json file is in the Files and versions tab https://huggingface.co/CompVis/stable-diffusion-v1-4/tree/main. What Dreambooth collab are you using? If it's not one at Hugging Face, it might be worth opening an issue over there as well

bro okey, i understand, but, i see like it have to be automatically created or downloaded on the directory and all ends with the folder empty with no error until you reach "inference" cell.
And i have a question, first sorry for using this without being a programmer just like thousands of people learn to just use it. If i download that files and put them on the folder they had to be there automatically. Does it will work? why? i thought that files were like unique of each training at once.

hey, did you ever fix this? i'm having the same issue, and even when i do use a model with the model_index.json i cannot seem to get it to work. i'm refreshing the model and trying again, but if anyone can explain why i'm just throwing this out there. (edit: i don't really understand this all the way but i think i figured this out if you're still struggling: the model i had told dreambooth to use didn't have a model index file for dreambooth to do whatever the heck with. i used one from hugging face and in the files tab i found one that HAD model_index.json) btw, i have no idea if that's correct, but that's what worked

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 ""

Sign up or log in to comment