Can't load a model that has .safetensors.index.json

So I’m trying to load this model - cocktailpeanut/flux1-schnell-qint8

The error I’m getting is

Entry Not Found for url: https://huggingface.co/cocktailpeanut/flux1-schnell-qint8/resolve/main/model_index.json

I can clearly see that model_index.json is not in the repo. But how do I pass this information to the .from_pretrained function. If I use the DiffusionPipeline.from_pretrained("cocktailpeanut/flux1-schnell-qint8") it works.

But not for eg. FluxImg2ImgPipeline.from_pretrained("cocktailpeanut/flux1-schnell-qint8")

What am I missing here?

The model you are trying to load is, simply put, a head left out in the field. You need to bring the torso from somewhere.
Generally, this is how it is used.

import torch
from diffusers import FluxPipeline

transformer = DiffusionPipeline.from_pretrained("cocktailpeanut/flux1-schnell-qint8", torch_dtype=torch.bfloat16) # Might it work without ", torch_dtype=torch.bfloat16"? It is safer to match the precision in case, but if it works without it, it will consume less VRAM.
pipe = FluxImg2ImgPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, transformer=transformer)

However, I honestly don’t know if the transformer’s stand-alone loading works well.
This is because this software usually assumes that Diffusers are basically all files in the same state, and the single load function is often used by people who are somewhat familiar with the software for experimentation.
For parts such as VAE, single loading is an everyday occurrence…

Thanks for the reply but I still seem to be getting the same error

import torch

from diffusers import DiffusionPipeline, FluxImg2ImgPipeline
from diffusers.utils import load_image

device = "cuda"
transformer = DiffusionPipeline.from_pretrained("cocktailpeanut/flux1-schnell-qint8", torch_dtype=torch.float16)
pipe = FluxImg2ImgPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", from_safetensors=True, transformer=transformer)
pipe = pipe.to(device)

The error comming out to be

---------------------------------------------------------------------------

HTTPError                                 Traceback (most recent call last)

/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_errors.py in hf_raise_for_status(response, endpoint_name)
    303     try:
--> 304         response.raise_for_status()
    305     except HTTPError as e:

15 frames

HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/cocktailpeanut/flux1-schnell-qint8/resolve/main/model_index.json


The above exception was the direct cause of the following exception:

EntryNotFoundError                        Traceback (most recent call last)

/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_errors.py in hf_raise_for_status(response, endpoint_name)
    313         elif error_code == "EntryNotFound":
    314             message = f"{response.status_code} Client Error." + "\n\n" + f"Entry Not Found for url: {response.url}."
--> 315             raise EntryNotFoundError(message, response) from e
    316 
    317         elif error_code == "GatedRepo":

EntryNotFoundError: 404 Client Error. (Request ID: Root=1-66eaa294-7a8d35c167d1e67e081cea1d;20587030-fb18-4d59-971e-d327a81a57ca)

Entry Not Found for url: https://huggingface.co/cocktailpeanut/flux1-schnell-qint8/resolve/main/model_index.json.


https://huggingface.co/cocktailpeanut/flux1-schnell-qint8/resolve/main/model_index.json
Oops. This file doesn’t exist as per the error message.
The repo must have been created by the author for experimental purposes and not for actual use. Since the essential content is the same in both repos, let’s simply do this. Also, for flux, you should use bfloat16 instead of float16.

import torch

from diffusers import FluxImg2ImgPipeline
from diffusers.utils import load_image

device = "cuda"
pipe = FluxImg2ImgPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
pipe = pipe.to(device)

If you want to save VRAM, follow the article below.