tencent-ailab / IP-Adapter

The image prompt adapter is designed to enable a pretrained text-to-image diffusion model to generate images with image prompt.
Apache License 2.0
4.5k stars 296 forks source link

can't use local base_model_path #285

Open Avedena opened 5 months ago

Avedena commented 5 months ago

Hi there,

if I use a local SD1.5 Base model I get this error:

 LocalEntryNotFoundError                   Traceback (most recent call last)
Cell In[58], line 2
      1 # load SD pipeline
----> 2 pipe = StableDiffusionPipeline.from_pretrained(
      3     base_model_path,
      4     torch_dtype=torch.float16,
      5     scheduler=noise_scheduler,
      6     vae=vae,
      7     feature_extractor=None,
      8     safety_checker=None,
      9     local_files_only=True
     10 LocalEntryNotFoundError: Cannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input.)

My declaration looks like this:

base_model_path = "custom_models/MyCustomModel.safetensors"
vae_model_path = "stabilityai/sd-vae-ft-mse"
image_encoder_path = "models/image_encoder/"
ip_ckpt = "models/ip-adapter-full-face_sd15.bin"
device = "cuda" 

The Pipeline:

# load SD pipeline
pipe = StableDiffusionPipeline.from_pretrained(
    base_model_path,
    torch_dtype=torch.float16,
    scheduler=noise_scheduler,
    vae=vae,
    feature_extractor=None,
    safety_checker=None,
    local_files_only=True
)

I tryed local_files_only=True to be clear to use a local model. The other files are already cached. The model is in this pathIP-Adapter\custom_models

masaisai111 commented 2 months ago

好像这个不能直接加载模型,的加载路径,比如.../stable-diffusion-v1-5/,请问这个原理你懂吗emmm