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
180841bb
Commit
180841bb
authored
Jan 25, 2023
by
Patrick von Platen
Browse files
Release: v0.12.0
parent
6ba2231d
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
170 additions
and
15 deletions
+170
-15
examples/dreambooth/train_dreambooth.py
examples/dreambooth/train_dreambooth.py
+1
-1
examples/dreambooth/train_dreambooth_flax.py
examples/dreambooth/train_dreambooth_flax.py
+1
-1
examples/dreambooth/train_dreambooth_lora.py
examples/dreambooth/train_dreambooth_lora.py
+1
-1
examples/text_to_image/train_text_to_image.py
examples/text_to_image/train_text_to_image.py
+1
-1
examples/text_to_image/train_text_to_image_flax.py
examples/text_to_image/train_text_to_image_flax.py
+1
-1
examples/text_to_image/train_text_to_image_lora.py
examples/text_to_image/train_text_to_image_lora.py
+1
-1
examples/textual_inversion/textual_inversion.py
examples/textual_inversion/textual_inversion.py
+1
-2
examples/textual_inversion/textual_inversion_flax.py
examples/textual_inversion/textual_inversion_flax.py
+1
-1
examples/unconditional_image_generation/train_unconditional.py
...les/unconditional_image_generation/train_unconditional.py
+1
-2
examples/unconditional_image_generation/train_unconditional_ort.py
...unconditional_image_generation/train_unconditional_ort.py
+1
-2
setup.py
setup.py
+1
-1
src/diffusers/__init__.py
src/diffusers/__init__.py
+1
-1
utils/release.py
utils/release.py
+158
-0
No files found.
examples/dreambooth/train_dreambooth.py
View file @
180841bb
...
...
@@ -46,7 +46,7 @@ from transformers import AutoTokenizer, PretrainedConfig
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version
(
"0.1
0.0.dev
0"
)
check_min_version
(
"0.1
2.
0"
)
logger
=
get_logger
(
__name__
)
...
...
examples/dreambooth/train_dreambooth_flax.py
View file @
180841bb
...
...
@@ -36,7 +36,7 @@ from transformers import CLIPFeatureExtractor, CLIPTokenizer, FlaxCLIPTextModel,
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version
(
"0.1
0.0.dev
0"
)
check_min_version
(
"0.1
2.
0"
)
# Cache compiled models across invocations of this script.
cc
.
initialize_cache
(
os
.
path
.
expanduser
(
"~/.cache/jax/compilation_cache"
))
...
...
examples/dreambooth/train_dreambooth_lora.py
View file @
180841bb
...
...
@@ -54,7 +54,7 @@ from transformers import AutoTokenizer, PretrainedConfig
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version
(
"0.12.0
.dev0
"
)
check_min_version
(
"0.12.0"
)
logger
=
get_logger
(
__name__
)
...
...
examples/text_to_image/train_text_to_image.py
View file @
180841bb
...
...
@@ -45,7 +45,7 @@ from transformers import CLIPTextModel, CLIPTokenizer
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version
(
"0.1
0.0.dev
0"
)
check_min_version
(
"0.1
2.
0"
)
logger
=
get_logger
(
__name__
,
log_level
=
"INFO"
)
...
...
examples/text_to_image/train_text_to_image_flax.py
View file @
180841bb
...
...
@@ -34,7 +34,7 @@ from transformers import CLIPFeatureExtractor, CLIPTokenizer, FlaxCLIPTextModel,
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version
(
"0.1
0.0.dev
0"
)
check_min_version
(
"0.1
2.
0"
)
logger
=
logging
.
getLogger
(
__name__
)
...
...
examples/text_to_image/train_text_to_image_lora.py
View file @
180841bb
...
...
@@ -47,7 +47,7 @@ from transformers import CLIPTextModel, CLIPTokenizer
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version
(
"0.12.0
.dev0
"
)
check_min_version
(
"0.12.0"
)
logger
=
get_logger
(
__name__
,
log_level
=
"INFO"
)
...
...
examples/textual_inversion/textual_inversion.py
View file @
180841bb
...
...
@@ -68,8 +68,7 @@ else:
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version
(
"0.10.0.dev0"
)
check_min_version
(
"0.12.0"
)
logger
=
get_logger
(
__name__
)
...
...
examples/textual_inversion/textual_inversion_flax.py
View file @
180841bb
...
...
@@ -57,7 +57,7 @@ else:
# ------------------------------------------------------------------------------
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version
(
"0.1
0.0.dev
0"
)
check_min_version
(
"0.1
2.
0"
)
logger
=
logging
.
getLogger
(
__name__
)
...
...
examples/unconditional_image_generation/train_unconditional.py
View file @
180841bb
...
...
@@ -33,8 +33,7 @@ from tqdm.auto import tqdm
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version
(
"0.12.0.dev0"
)
check_min_version
(
"0.12.0"
)
logger
=
get_logger
(
__name__
,
log_level
=
"INFO"
)
...
...
examples/unconditional_image_generation/train_unconditional_ort.py
View file @
180841bb
...
...
@@ -30,8 +30,7 @@ from tqdm.auto import tqdm
# Will error if the minimal version of diffusers is not installed. Remove at your own risks.
check_min_version
(
"0.10.0.dev0"
)
check_min_version
(
"0.12.0"
)
logger
=
get_logger
(
__name__
)
...
...
setup.py
View file @
180841bb
...
...
@@ -219,7 +219,7 @@ install_requires = [
setup
(
name
=
"diffusers"
,
version
=
"0.12.0
.dev0
"
,
# expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots)
version
=
"0.12.0"
,
# expected format is one of x.y.z.dev0, or x.y.z.rc1 or x.y.z (no to dashes, yes to dots)
description
=
"Diffusers"
,
long_description
=
open
(
"README.md"
,
"r"
,
encoding
=
"utf-8"
).
read
(),
long_description_content_type
=
"text/markdown"
,
...
...
src/diffusers/__init__.py
View file @
180841bb
__version__
=
"0.12.0
.dev0
"
__version__
=
"0.12.0"
from
.configuration_utils
import
ConfigMixin
from
.utils
import
(
...
...
utils/release.py
0 → 100644
View file @
180841bb
# coding=utf-8
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
argparse
import
os
import
re
import
packaging.version
PATH_TO_EXAMPLES
=
"examples/"
REPLACE_PATTERNS
=
{
"examples"
:
(
re
.
compile
(
r
'^check_min_version\("[^"]+"\)\s*$'
,
re
.
MULTILINE
),
'check_min_version("VERSION")
\n
'
),
"init"
:
(
re
.
compile
(
r
'^__version__\s+=\s+"([^"]+)"\s*$'
,
re
.
MULTILINE
),
'__version__ = "VERSION"
\n
'
),
"setup"
:
(
re
.
compile
(
r
'^(\s*)version\s*=\s*"[^"]+",'
,
re
.
MULTILINE
),
r
'\1version="VERSION",'
),
"doc"
:
(
re
.
compile
(
r
'^(\s*)release\s*=\s*"[^"]+"$'
,
re
.
MULTILINE
),
'release = "VERSION"
\n
'
),
}
REPLACE_FILES
=
{
"init"
:
"src/diffusers/__init__.py"
,
"setup"
:
"setup.py"
,
}
README_FILE
=
"README.md"
def
update_version_in_file
(
fname
,
version
,
pattern
):
"""Update the version in one file using a specific pattern."""
with
open
(
fname
,
"r"
,
encoding
=
"utf-8"
,
newline
=
"
\n
"
)
as
f
:
code
=
f
.
read
()
re_pattern
,
replace
=
REPLACE_PATTERNS
[
pattern
]
replace
=
replace
.
replace
(
"VERSION"
,
version
)
code
=
re_pattern
.
sub
(
replace
,
code
)
with
open
(
fname
,
"w"
,
encoding
=
"utf-8"
,
newline
=
"
\n
"
)
as
f
:
f
.
write
(
code
)
def
update_version_in_examples
(
version
):
"""Update the version in all examples files."""
for
folder
,
directories
,
fnames
in
os
.
walk
(
PATH_TO_EXAMPLES
):
# Removing some of the folders with non-actively maintained examples from the walk
if
"research_projects"
in
directories
:
directories
.
remove
(
"research_projects"
)
if
"legacy"
in
directories
:
directories
.
remove
(
"legacy"
)
for
fname
in
fnames
:
if
fname
.
endswith
(
".py"
):
update_version_in_file
(
os
.
path
.
join
(
folder
,
fname
),
version
,
pattern
=
"examples"
)
def
global_version_update
(
version
,
patch
=
False
):
"""Update the version in all needed files."""
for
pattern
,
fname
in
REPLACE_FILES
.
items
():
update_version_in_file
(
fname
,
version
,
pattern
)
if
not
patch
:
update_version_in_examples
(
version
)
def
clean_main_ref_in_model_list
():
"""Replace the links from main doc tp stable doc in the model list of the README."""
# If the introduction or the conclusion of the list change, the prompts may need to be updated.
_start_prompt
=
"🤗 Transformers currently provides the following architectures"
_end_prompt
=
"1. Want to contribute a new model?"
with
open
(
README_FILE
,
"r"
,
encoding
=
"utf-8"
,
newline
=
"
\n
"
)
as
f
:
lines
=
f
.
readlines
()
# Find the start of the list.
start_index
=
0
while
not
lines
[
start_index
].
startswith
(
_start_prompt
):
start_index
+=
1
start_index
+=
1
index
=
start_index
# Update the lines in the model list.
while
not
lines
[
index
].
startswith
(
_end_prompt
):
if
lines
[
index
].
startswith
(
"1."
):
lines
[
index
]
=
lines
[
index
].
replace
(
"https://huggingface.co/docs/diffusers/main/model_doc"
,
"https://huggingface.co/docs/diffusers/model_doc"
,
)
index
+=
1
with
open
(
README_FILE
,
"w"
,
encoding
=
"utf-8"
,
newline
=
"
\n
"
)
as
f
:
f
.
writelines
(
lines
)
def
get_version
():
"""Reads the current version in the __init__."""
with
open
(
REPLACE_FILES
[
"init"
],
"r"
)
as
f
:
code
=
f
.
read
()
default_version
=
REPLACE_PATTERNS
[
"init"
][
0
].
search
(
code
).
groups
()[
0
]
return
packaging
.
version
.
parse
(
default_version
)
def
pre_release_work
(
patch
=
False
):
"""Do all the necessary pre-release steps."""
# First let's get the default version: base version if we are in dev, bump minor otherwise.
default_version
=
get_version
()
if
patch
and
default_version
.
is_devrelease
:
raise
ValueError
(
"Can't create a patch version from the dev branch, checkout a released version!"
)
if
default_version
.
is_devrelease
:
default_version
=
default_version
.
base_version
elif
patch
:
default_version
=
f
"
{
default_version
.
major
}
.
{
default_version
.
minor
}
.
{
default_version
.
micro
+
1
}
"
else
:
default_version
=
f
"
{
default_version
.
major
}
.
{
default_version
.
minor
+
1
}
.0"
# Now let's ask nicely if that's the right one.
version
=
input
(
f
"Which version are you releasing? [
{
default_version
}
]"
)
if
len
(
version
)
==
0
:
version
=
default_version
print
(
f
"Updating version to
{
version
}
."
)
global_version_update
(
version
,
patch
=
patch
)
# if not patch:
# print("Cleaning main README, don't forget to run `make fix-copies`.")
# clean_main_ref_in_model_list()
def
post_release_work
():
"""Do all the necesarry post-release steps."""
# First let's get the current version
current_version
=
get_version
()
dev_version
=
f
"
{
current_version
.
major
}
.
{
current_version
.
minor
+
1
}
.0.dev0"
current_version
=
current_version
.
base_version
# Check with the user we got that right.
version
=
input
(
f
"Which version are we developing now? [
{
dev_version
}
]"
)
if
len
(
version
)
==
0
:
version
=
dev_version
print
(
f
"Updating version to
{
version
}
."
)
global_version_update
(
version
)
# print("Cleaning main README, don't forget to run `make fix-copies`.")
# clean_main_ref_in_model_list()
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--post_release"
,
action
=
"store_true"
,
help
=
"Whether this is pre or post release."
)
parser
.
add_argument
(
"--patch"
,
action
=
"store_true"
,
help
=
"Whether or not this is a patch release."
)
args
=
parser
.
parse_args
()
if
not
args
.
post_release
:
pre_release_work
(
patch
=
args
.
patch
)
elif
args
.
patch
:
print
(
"Nothing to do after a patch :-)"
)
else
:
post_release_work
()
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