"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "24c7d578baf6a8b79890101dd280278fff031d12"
Unverified Commit 87724965 authored by Piyush Thakur's avatar Piyush Thakur Committed by GitHub
Browse files

[Model Card] standardize T2I model card (#6939)

* standardize model card

* fix base_model
parent 35fd84be
...@@ -45,6 +45,7 @@ from diffusers import AutoencoderKL, DDPMScheduler, StableDiffusionPipeline, UNe ...@@ -45,6 +45,7 @@ from diffusers import AutoencoderKL, DDPMScheduler, StableDiffusionPipeline, UNe
from diffusers.optimization import get_scheduler from diffusers.optimization import get_scheduler
from diffusers.training_utils import EMAModel, compute_snr from diffusers.training_utils import EMAModel, compute_snr
from diffusers.utils import check_min_version, deprecate, is_wandb_available, make_image_grid from diffusers.utils import check_min_version, deprecate, is_wandb_available, make_image_grid
from diffusers.utils.hub_utils import load_or_create_model_card, populate_model_card
from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.torch_utils import is_compiled_module from diffusers.utils.torch_utils import is_compiled_module
...@@ -75,21 +76,7 @@ def save_model_card( ...@@ -75,21 +76,7 @@ def save_model_card(
image_grid.save(os.path.join(repo_folder, "val_imgs_grid.png")) image_grid.save(os.path.join(repo_folder, "val_imgs_grid.png"))
img_str += "![val_imgs_grid](./val_imgs_grid.png)\n" img_str += "![val_imgs_grid](./val_imgs_grid.png)\n"
yaml = f""" model_description = f"""
---
license: creativeml-openrail-m
base_model: {args.pretrained_model_name_or_path}
datasets:
- {args.dataset_name}
tags:
- stable-diffusion
- stable-diffusion-diffusers
- text-to-image
- diffusers
inference: true
---
"""
model_card = f"""
# Text-to-image finetuning - {repo_id} # Text-to-image finetuning - {repo_id}
This pipeline was finetuned from **{args.pretrained_model_name_or_path}** on the **{args.dataset_name}** dataset. Below are some example images generated with the finetuned pipeline using the following prompts: {args.validation_prompts}: \n This pipeline was finetuned from **{args.pretrained_model_name_or_path}** on the **{args.dataset_name}** dataset. Below are some example images generated with the finetuned pipeline using the following prompts: {args.validation_prompts}: \n
...@@ -132,10 +119,21 @@ These are the key hyperparameters used during training: ...@@ -132,10 +119,21 @@ These are the key hyperparameters used during training:
More information on all the CLI arguments and the environment are available on your [`wandb` run page]({wandb_run_url}). More information on all the CLI arguments and the environment are available on your [`wandb` run page]({wandb_run_url}).
""" """
model_card += wandb_info model_description += wandb_info
with open(os.path.join(repo_folder, "README.md"), "w") as f: model_card = load_or_create_model_card(
f.write(yaml + model_card) repo_id_or_path=repo_id,
from_training=True,
license="creativeml-openrail-m",
base_model=args.pretrained_model_name_or_path,
model_description=model_description,
inference=True,
)
tags = ["stable-diffusion", "stable-diffusion-diffusers", "text-to-image", "diffusers"]
model_card = populate_model_card(model_card, tags=tags)
model_card.save(os.path.join(repo_folder, "README.md"))
def log_validation(vae, text_encoder, tokenizer, unet, args, accelerator, weight_dtype, epoch): def log_validation(vae, text_encoder, tokenizer, unet, args, accelerator, weight_dtype, epoch):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment