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
f07899a5
Unverified
Commit
f07899a5
authored
Feb 09, 2024
by
camaro
Committed by
GitHub
Feb 09, 2024
Browse files
Standardize model card for Controlnet SDXL (#6908)
controlnet-sdxl
parent
a83cc0c0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
16 deletions
+21
-16
examples/controlnet/train_controlnet_sdxl.py
examples/controlnet/train_controlnet_sdxl.py
+21
-16
No files found.
examples/controlnet/train_controlnet_sdxl.py
View file @
f07899a5
...
@@ -51,6 +51,7 @@ from diffusers import (
...
@@ -51,6 +51,7 @@ from diffusers import (
)
)
from
diffusers.optimization
import
get_scheduler
from
diffusers.optimization
import
get_scheduler
from
diffusers.utils
import
check_min_version
,
is_wandb_available
,
make_image_grid
from
diffusers.utils
import
check_min_version
,
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
...
@@ -199,28 +200,32 @@ def save_model_card(repo_id: str, image_logs=None, base_model=str, repo_folder=N
...
@@ -199,28 +200,32 @@ def save_model_card(repo_id: str, image_logs=None, base_model=str, repo_folder=N
make_image_grid
(
images
,
1
,
len
(
images
)).
save
(
os
.
path
.
join
(
repo_folder
,
f
"images_
{
i
}
.png"
))
make_image_grid
(
images
,
1
,
len
(
images
)).
save
(
os
.
path
.
join
(
repo_folder
,
f
"images_
{
i
}
.png"
))
img_str
+=
f
"
\n
"
img_str
+=
f
"
\n
"
yaml
=
f
"""
model_description
=
f
"""
---
license: openrail++
base_model:
{
base_model
}
tags:
- stable-diffusion-xl
- stable-diffusion-xl-diffusers
- text-to-image
- diffusers
- controlnet
inference: true
---
"""
model_card
=
f
"""
# controlnet-
{
repo_id
}
# controlnet-
{
repo_id
}
These are controlnet weights trained on
{
base_model
}
with new type of conditioning.
These are controlnet weights trained on
{
base_model
}
with new type of conditioning.
{
img_str
}
{
img_str
}
"""
"""
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
=
"openrail++"
,
base_model
=
base_model
,
model_description
=
model_description
,
inference
=
True
,
)
tags
=
[
"stable-diffusion-xl"
,
"stable-diffusion-xl-diffusers"
,
"text-to-image"
,
"diffusers"
,
"controlnet"
,
]
model_card
=
populate_model_card
(
model_card
,
tags
=
tags
)
model_card
.
save
(
os
.
path
.
join
(
repo_folder
,
"README.md"
))
def
parse_args
(
input_args
=
None
):
def
parse_args
(
input_args
=
None
):
...
...
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