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
75aee39e
Unverified
Commit
75aee39e
authored
Feb 12, 2024
by
Piyush Thakur
Committed by
GitHub
Feb 12, 2024
Browse files
[Model Card] standardize T2I Adapter Sdxl model card (#6947)
standardize model card template t21-adapter-sdxl
parent
215e6804
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
+16
-17
examples/t2i_adapter/train_t2i_adapter_sdxl.py
examples/t2i_adapter/train_t2i_adapter_sdxl.py
+16
-17
No files found.
examples/t2i_adapter/train_t2i_adapter_sdxl.py
View file @
75aee39e
...
@@ -49,6 +49,7 @@ from diffusers import (
...
@@ -49,6 +49,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
from
diffusers.utils
import
check_min_version
,
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.import_utils
import
is_xformers_available
from
diffusers.utils.torch_utils
import
is_compiled_module
from
diffusers.utils.torch_utils
import
is_compiled_module
...
@@ -195,7 +196,7 @@ def import_model_class_from_model_name_or_path(
...
@@ -195,7 +196,7 @@ def import_model_class_from_model_name_or_path(
raise
ValueError
(
f
"
{
model_class
}
is not supported."
)
raise
ValueError
(
f
"
{
model_class
}
is not supported."
)
def
save_model_card
(
repo_id
:
str
,
image_logs
=
None
,
base_model
=
str
,
repo_folder
=
None
):
def
save_model_card
(
repo_id
:
str
,
image_logs
:
dict
=
None
,
base_model
:
str
=
None
,
repo_folder
:
str
=
None
):
img_str
=
""
img_str
=
""
if
image_logs
is
not
None
:
if
image_logs
is
not
None
:
img_str
=
"You can find some example images below.
\n
"
img_str
=
"You can find some example images below.
\n
"
...
@@ -209,27 +210,25 @@ def save_model_card(repo_id: str, image_logs=None, base_model=str, repo_folder=N
...
@@ -209,27 +210,25 @@ def save_model_card(repo_id: str, image_logs=None, base_model=str, repo_folder=N
image_grid
(
images
,
1
,
len
(
images
)).
save
(
os
.
path
.
join
(
repo_folder
,
f
"images_
{
i
}
.png"
))
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: creativeml-openrail-m
base_model:
{
base_model
}
tags:
- stable-diffusion-xl
- stable-diffusion-xl-diffusers
- text-to-image
- diffusers
- t2iadapter
inference: true
---
"""
model_card
=
f
"""
# t2iadapter-
{
repo_id
}
# t2iadapter-
{
repo_id
}
These are t2iadapter weights trained on
{
base_model
}
with new type of conditioning.
These are t2iadapter 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
=
"creativeml-openrail-m"
,
base_model
=
base_model
,
model_description
=
model_description
,
inference
=
True
,
)
tags
=
[
"stable-diffusion-xl"
,
"stable-diffusion-xl-diffusers"
,
"text-to-image"
,
"diffusers"
,
"t2iadapter"
]
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