import os # Copied from https://github.com/huggingface/diffusers/blob/31be42209ddfdb69d9640a777b32e9b5c6259bf0/examples/text_to_image/train_text_to_image_lora.py#L55 def save_model_card(base_model=str, repo_folder=None, weight_paths=None): yaml = f""" --- license: creativeml-openrail-m base_model: {base_model} tags: - stable-diffusion - stable-diffusion-diffusers - text-to-image - diffusers inference: true --- """ model_card = f""" # KerasCV Stable Diffusion in Diffusers 🧨🤗 The pipeline contained in this repository was created using [this Space](https://huggingface.co/spaces/sayakpaul/convert-kerascv-sd-diffusers). The purpose is to convert the KerasCV Stable Diffusion weights in a way that is compatible with Diffusers. This allows users to fine-tune using KerasCV and use the fine-tuned weights in Diffusers taking advantage of its nifty features (like schedulers, fast attention, etc.).\n """ if weight_paths is not None: model_card += "Following weight paths (KerasCV) were used: {weight_paths}" with open(os.path.join(repo_folder, "README.md"), "w") as f: f.write(yaml + model_card)