diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

config file is not a valid json file

Open neonarc4 opened this issue 1 year ago • 4 comments

File "Z:\software\python11\Lib\site-packages\diffusers\configuration_utils.py", line 436, in load_config raise EnvironmentError(f"It looks like the config file at '{config_file}' is not a valid JSON file.") OSError: It looks like the config file at 'X:\test\dreamshaper_8.safetensors' is not a valid JSON file.

why other diffusers doesnt have single file ?

pipe = AutoPipelineForInpainting.from_pretrained( test/dreamshaper_8.safetensors')

neonarc4 avatar May 19 '24 09:05 neonarc4

Try this:

pipe = StableDiffusionPipeline.from_single_file("test/dreamshaper_8.safetensors")

But, I couldn't use this pipe for inpainting :/ dreamshaper_8Inpainting.safetensors works for inpainting:

pipe = StableDiffusionInpaintPipeline.from_single_file("test/dreamshaper_8Inpainting.safetensors")

tolgacangoz avatar May 19 '24 10:05 tolgacangoz

thnx for >.</ but is their for AutoPipelineForText2Image ,I2VGenXLPipeline ,StableVideoDiffusionPipeline

like they dont have single_file

neonarc4 avatar May 19 '24 10:05 neonarc4

Maybe this PR has something to do with it. https://github.com/huggingface/diffusers/pull/6986#issue-2136319703

suzukimain avatar May 20 '24 04:05 suzukimain

Hi! we won't be able to support single file with AutoPipelineForText2Image since the pipeline type need to be explicitly given for single checkpoint for I2VGenXLPipeline and StableVideoDiffusionPipeline we are happy to support if there are single checkpoint available cc @DN6

yiyixuxu avatar May 20 '24 16:05 yiyixuxu

Hi! we won't be able to support single file with AutoPipelineForText2Image since the pipeline type need to be explicitly given for single checkpoint for I2VGenXLPipeline and StableVideoDiffusionPipeline we are happy to support if there are single checkpoint available

@yiyixuxu This answers a question about an issue I've been having. However, I am mostly familiar with only needing a .safetensors file in order to run diffusion. Is this pipeline type something I can generate manually prior to attempting to instantiate a AutoPipelineForImage2Image.from_pretrained off a local safetensors file? Like, it's a json of some kind, right?

pwcarney avatar Jun 04 '24 15:06 pwcarney

If you're going to store a config file why not just use the diffusers format? Which does exactly that and also allows to change the modules if you need to, for example the vae in SD 1.5 or the turbo o lighting versions of the unet in SDXL.

Most of the models right now have a diffusers version, for example the model you're using can just be loaded like this:

pipe = AutoPipelineForInpainting.from_pretrained("Lykon/dreamshaper-8")

If you need to have them locally in another directory, you can clone the repo if you want revisions or do a shallow clone if you only want the latest.

If you still want to do what you're suggesting, you'll need to use a file with each model and associate the corresponding pipeline to it, for example this one:

"_class_name": "StableDiffusionPipeline",

and then use the corresponding class to load the model, that's basically what the AutoPipeline does.

asomoza avatar Jun 04 '24 18:06 asomoza

if you know the pipeline name, you can use the pipeline class with from_single_file. e.g

StableDiffusionImg2ImgPipeline.from_single_file(.safetensor)

yiyixuxu avatar Jun 05 '24 03:06 yiyixuxu

or is there any particular reason you have to use the AutoPipeline?

yiyixuxu avatar Jun 05 '24 03:06 yiyixuxu

AutoPipeline detects the pipeline class for you, so if you already know the class, you don't need it

yiyixuxu avatar Jun 05 '24 03:06 yiyixuxu

thanks everyone i guess it resolved seems like video pipeline is not yet release any safetensor single file so far while not sure about gif i wonder if it can able to resolve in singilefile I2VGenXLPipeline

neonarc4 avatar Jun 15 '24 07:06 neonarc4