Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
06a042cd
Unverified
Commit
06a042cd
authored
Feb 12, 2024
by
Piyush Thakur
Committed by
GitHub
Feb 12, 2024
Browse files
[Model Card] standardize T2I Lora model card (#6940)
standardize model card t2i-lora
parent
87724965
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
examples/text_to_image/train_text_to_image_lora.py
examples/text_to_image/train_text_to_image_lora.py
+22
-16
No files found.
examples/text_to_image/train_text_to_image_lora.py
View file @
06a042cd
...
...
@@ -45,6 +45,7 @@ from diffusers import AutoencoderKL, DDPMScheduler, DiffusionPipeline, StableDif
from
diffusers.optimization
import
get_scheduler
from
diffusers.training_utils
import
cast_training_params
,
compute_snr
from
diffusers.utils
import
check_min_version
,
convert_state_dict_to_diffusers
,
is_wandb_available
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.torch_utils
import
is_compiled_module
...
...
@@ -61,26 +62,31 @@ def save_model_card(repo_id: str, images=None, base_model=str, dataset_name=str,
image
.
save
(
os
.
path
.
join
(
repo_folder
,
f
"image_
{
i
}
.png"
))
img_str
+=
f
"
\n
"
yaml
=
f
"""
---
license: creativeml-openrail-m
base_model:
{
base_model
}
tags:
- stable-diffusion
- stable-diffusion-diffusers
- text-to-image
- diffusers
- lora
inference: true
---
"""
model_card
=
f
"""
model_description
=
f
"""
# LoRA text2image fine-tuning -
{
repo_id
}
These are LoRA adaption weights for
{
base_model
}
. The weights were fine-tuned on the
{
dataset_name
}
dataset. You can find some example images in the following.
\n
{
img_str
}
"""
with
open
(
os
.
path
.
join
(
repo_folder
,
"README.md"
),
"w"
)
as
f
:
f
.
write
(
yaml
+
model_card
)
model_card
=
load_or_create_model_card
(
repo_id_or_path
=
repo_id
,
from_training
=
True
,
license
=
"creativeml-openrail-m"
,
base_model
=
base_model
,
model_description
=
model_description
,
inference
=
True
,
)
tags
=
[
"stable-diffusion"
,
"stable-diffusion-diffusers"
,
"text-to-image"
,
"diffusers"
,
"lora"
,
]
model_card
=
populate_model_card
(
model_card
,
tags
=
tags
)
model_card
.
save
(
os
.
path
.
join
(
repo_folder
,
"README.md"
))
def
parse_args
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment