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
932ce05d
Commit
932ce05d
authored
Jun 27, 2022
by
Patrick von Platen
Browse files
cancel einops
parent
4e08e0ca
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
25 deletions
+14
-25
examples/train_unconditional.py
examples/train_unconditional.py
+1
-1
src/diffusers/models/unet_ldm.py
src/diffusers/models/unet_ldm.py
+0
-7
src/diffusers/models/unet_rl.py
src/diffusers/models/unet_rl.py
+0
-1
src/diffusers/schedulers/scheduling_utils.py
src/diffusers/schedulers/scheduling_utils.py
+11
-15
tests/test_modeling_utils.py
tests/test_modeling_utils.py
+2
-1
No files found.
examples/train_unconditional.py
View file @
932ce05d
...
...
@@ -173,7 +173,7 @@ if __name__ == "__main__":
parser
.
add_argument
(
"--lr"
,
type
=
float
,
default
=
1e-4
)
parser
.
add_argument
(
"--warmup_steps"
,
type
=
int
,
default
=
500
)
parser
.
add_argument
(
"--ema_inv_gamma"
,
type
=
float
,
default
=
1.0
)
parser
.
add_argument
(
"--ema_power"
,
type
=
float
,
default
=
3
/
4
)
parser
.
add_argument
(
"--ema_power"
,
type
=
float
,
default
=
3
/
4
)
parser
.
add_argument
(
"--ema_max_decay"
,
type
=
float
,
default
=
0.999
)
parser
.
add_argument
(
"--push_to_hub"
,
action
=
"store_true"
)
parser
.
add_argument
(
"--hub_token"
,
type
=
str
,
default
=
None
)
...
...
src/diffusers/models/unet_ldm.py
View file @
932ce05d
...
...
@@ -13,13 +13,6 @@ from .embeddings import get_timestep_embedding
from
.resnet
import
Upsample
# try:
# from einops import rearrange, repeat
# except:
# print("Einops is not installed")
# pass
def
exists
(
val
):
return
val
is
not
None
...
...
src/diffusers/models/unet_rl.py
View file @
932ce05d
...
...
@@ -17,7 +17,6 @@ from ..modeling_utils import ModelMixin
# pass
class
SinusoidalPosEmb
(
nn
.
Module
):
def
__init__
(
self
,
dim
):
super
().
__init__
()
...
...
src/diffusers/schedulers/scheduling_utils.py
View file @
932ce05d
...
...
@@ -11,11 +11,11 @@
# 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.
from
typing
import
Union
import
numpy
as
np
import
torch
from
typing
import
Union
SCHEDULER_CONFIG_NAME
=
"scheduler_config.json"
...
...
@@ -53,20 +53,16 @@ class SchedulerMixin:
raise
ValueError
(
f
"`self.tensor_format`:
{
self
.
tensor_format
}
is not valid."
)
def
match_shape
(
self
,
values
:
Union
[
np
.
ndarray
,
torch
.
Tensor
],
broadcast_array
:
Union
[
np
.
ndarray
,
torch
.
Tensor
]
):
def
match_shape
(
self
,
values
:
Union
[
np
.
ndarray
,
torch
.
Tensor
],
broadcast_array
:
Union
[
np
.
ndarray
,
torch
.
Tensor
]):
"""
Turns a 1-D array into an array or tensor with len(broadcast_array.shape) dims.
Args:
timesteps: an array or tensor of values to extract.
broadcast_array: an array with a larger shape of K dimensions with the batch
dimension equal to the length of timesteps.
Returns:
a tensor of shape [batch_size, 1, ...] where the shape has K dims.
Turns a 1-D array into an array or tensor with len(broadcast_array.shape) dims.
Args:
timesteps: an array or tensor of values to extract.
broadcast_array: an array with a larger shape of K dimensions with the batch
dimension equal to the length of timesteps.
Returns:
a tensor of shape [batch_size, 1, ...] where the shape has K dims.
"""
tensor_format
=
getattr
(
self
,
"tensor_format"
,
"pt"
)
...
...
tests/test_modeling_utils.py
View file @
932ce05d
...
...
@@ -21,7 +21,8 @@ import unittest
import
numpy
as
np
import
torch
from
diffusers
import
(
# GradTTSPipeline,
from
diffusers
import
(
GradTTSPipeline
,
BDDMPipeline
,
DDIMPipeline
,
DDIMScheduler
,
...
...
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