Civitai 转 diffusers 的 base model
- Q1
Q1
pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(# "runwayml/stable-diffusion-v1-5", "/data/model/basemodel/realistic_v10BAKEDVAE.safetensors",controlnet=controlnet, torch_dtype=torch.float16,local_files_only = True
)
>>
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or
'namespace/repo_name': '/data/model/basemodel/realistic_v10BAKEDVAE.safetensors'. Use `repo_type`
argument if needed.
Civitai上的模型多是webui训练来的,不能直接用到diffusers框架上,需要转。
conda create -n diffusers python=3.10
conda activate diffusers
pip install --upgrade diffusers[torch]
pip install transformers
pip install omegaconf
pip install safetensors
git clone https://github.com/huggingface/diffusers
python ./diffusers/scripts/convert_original_stable_diffusion_to_diffusers.py \--checkpoint_path ./model/realistic_v10BAKEDVAE.safetensors \ --dump_path ./diffusers_model --from_safetensors
pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained("./model/diffusers_model",controlnet=controlnet, torch_dtype=torch.float16,local_files_only = True
)