Spaces:
Build error
Build error
File size: 1,556 Bytes
ddc8a59 a1008bd ddc8a59 89a6b3b ddc8a59 94913a9 ddc8a59 a1008bd ddc8a59 89a6b3b d513c3c 89a6b3b ddc8a59 3304f7d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import os
from typing import List
# 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: List = None,
placeholder_token: str = 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](https://github.com/huggingface/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](https://huggingface.co/docs/diffusers/main/en/using-diffusers/schedulers), [fast attention](https://huggingface.co/docs/diffusers/optimization/fp16), etc.).\n
"""
if len(weight_paths) > 0:
model_card += f"Following weight paths (KerasCV) were used \n: {weight_paths}"
if placeholder_token is not None:
model_card += f"\n\nFollowing `placeholder_token` was added to the tokenizer: `{placeholder_token}`."
with open(os.path.join(repo_folder, "README.md"), "w") as f:
f.write(yaml + model_card)
|