JackAILab / ConsistentID

Customized ID Consistent for human
MIT License
726 stars 72 forks source link

fyi - inference errors / for the default model it doesn't seem to have safetensor - #18

Closed johndpope closed 3 weeks ago

johndpope commented 1 month ago
# TODO import base SD model and pretrained ConsistentID model
device = "cuda"
base_model_path = "SG161222/Realistic_Vision_V6.0_B1_noVAE"
consistentID_path = "./ConsistentID_model_facemask_pretrain_50w" # pretrained ConsistentID model
# "philz1337/epicrealism" # 
# Gets the absolute path of the current script
script_directory = os.path.dirname(os.path.realpath(__file__))

### Load base model
pipe = ConsistentIDStableDiffusionPipeline.from_pretrained(
    base_model_path, 
    torch_dtype=torch.float16, 
    use_safetensors=False
).to(device)

safety_checker/model.safetensors not found Traceback (most recent call last): File "/media/oem/12TB/ConsistentID/infer.py", line 18, in pipe = ConsistentIDStableDiffusionPipeline.from_pretrained( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/oem/miniconda3/envs/ani/lib/python3.11/site-packages/diffusers/pipelines/pipeline_utils.py", line 1078, in from_pretrained cached_folder = cls.download( ^^^^^^^^^^^^^ File "/home/oem/miniconda3/envs/ani/lib/python3.11/site-packages/diffusers/pipelines/pipeline_utils.py", line 1775, in download raise EnvironmentError( OSError: Could not find the necessary safetensors weights in {'safety_checker/pytorch_model.bin', 'text_encoder/pytorch_model.bin', 'unet/diffusion_pytorch_model.bin', 'vae/diffusion_pytorch_model.bin'} (variant=None)

Traceback (most recent call last): File "/media/oem/12TB/ConsistentID/infer.py", line 18, in pipe = ConsistentIDStableDiffusionPipeline.from_pretrained( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/oem/miniconda3/envs/ani/lib/python3.11/site-packages/diffusers/pipelines/pipeline_utils.py", line 1090, in from_pretrained cached_folder = cls.download( ^^^^^^^^^^^^^ File "/home/oem/miniconda3/envs/ani/lib/python3.11/site-packages/diffusers/pipelines/pipeline_utils.py", line 1708, in download deprecate("no variant default", "0.24.0", deprecation_message, standard_warn=False) File "/home/oem/miniconda3/envs/ani/lib/python3.11/site-packages/diffusers/utils/deprecation_utils.py", line 18, in deprecate raise ValueError( ValueError: The deprecation tuple ('no variant default', '0.24.0', "You are trying to load the model files of the variant=fp16, but no such modeling files are available.The default model files: {'safety_checker/pytorch_model.bin', 'text_encoder/pytorch_model.bin', 'vae/diffusion_pytorch_model.bin', 'unet/diffusion_pytorch_model.bin'} will be loaded instead. Make sure to not load from variant=fp16if such variant modeling files are not available. Doing so will lead to an error in v0.24.0 as defaulting to non-variantmodeling files is deprecated.") should be removed since diffusers' version 0.24.0 is >= 0.24.0

johndpope commented 1 month ago

Also there's no BiSeNet_pretrained_for_ConsistentID.pth - mentioned anywhere - could not find on huggingface -

I do see this ConsistentID_model_facemask_pretrain_50w.bin

code is saying self.bise_net_cp='./models/BiSeNet_pretrained_for_ConsistentID.pth' # Import BiSeNet model

UPDATE deleted file here https://github.com/JackAILab/ConsistentID/blob/2a0bc6d795be86a19b5c6f76b70e9aad2b204a58/models/BiSeNet_pretrained_for_ConsistentID.pth

UPDATE 2 this line file name is missing .bin extension consistentID_path = "./ConsistentID_model_facemask_pretrain_50w" # pretrained ConsistentID model

should be consistentID_path = "./ConsistentID_model_facemask_pretrain_50w.bin" # pretrained ConsistentID model

(maybe my install / conda environment - but I had to just cherry pick the code out of bisenet directory - was running with python -m infer.py) https://gist.github.com/johndpope/555319980017b5361fec01d224b76161

stqwzr commented 1 month ago

@johndpope Hi, i downloaded the weigths from https://huggingface.co/JackAILab/ConsistentID/tree/main model and this part i change from self.bise_net_cp='./models/BiSeNet_pretrained_for_ConsistentID.pth' # Import BiSeNet to self.bise_net_cp='./models/face_parsing.pth'