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
49718b47
"...git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "3dc97bd1482fb099aa41a15aae55ff45c8f2b042"
Commit
49718b47
authored
Jun 20, 2022
by
Nathan Lambert
Browse files
add imports for RL UNet
parent
9c96682a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
src/diffusers/__init__.py
src/diffusers/__init__.py
+1
-0
src/diffusers/models/__init__.py
src/diffusers/models/__init__.py
+1
-0
src/diffusers/models/unet_rl.py
src/diffusers/models/unet_rl.py
+6
-2
No files found.
src/diffusers/__init__.py
View file @
49718b47
...
@@ -9,6 +9,7 @@ from .models.unet import UNetModel
...
@@ -9,6 +9,7 @@ from .models.unet import UNetModel
from
.models.unet_glide
import
GLIDESuperResUNetModel
,
GLIDETextToImageUNetModel
,
GLIDEUNetModel
from
.models.unet_glide
import
GLIDESuperResUNetModel
,
GLIDETextToImageUNetModel
,
GLIDEUNetModel
from
.models.unet_grad_tts
import
UNetGradTTSModel
from
.models.unet_grad_tts
import
UNetGradTTSModel
from
.models.unet_ldm
import
UNetLDMModel
from
.models.unet_ldm
import
UNetLDMModel
from
.models.unet_rl
import
TemporalUNet
from
.pipeline_utils
import
DiffusionPipeline
from
.pipeline_utils
import
DiffusionPipeline
from
.pipelines
import
BDDM
,
DDIM
,
DDPM
,
GLIDE
,
PNDM
,
GradTTS
,
LatentDiffusion
from
.pipelines
import
BDDM
,
DDIM
,
DDPM
,
GLIDE
,
PNDM
,
GradTTS
,
LatentDiffusion
from
.schedulers
import
DDIMScheduler
,
DDPMScheduler
,
GradTTSScheduler
,
PNDMScheduler
,
SchedulerMixin
from
.schedulers
import
DDIMScheduler
,
DDPMScheduler
,
GradTTSScheduler
,
PNDMScheduler
,
SchedulerMixin
...
...
src/diffusers/models/__init__.py
View file @
49718b47
...
@@ -20,3 +20,4 @@ from .unet import UNetModel
...
@@ -20,3 +20,4 @@ from .unet import UNetModel
from
.unet_glide
import
GLIDESuperResUNetModel
,
GLIDETextToImageUNetModel
,
GLIDEUNetModel
from
.unet_glide
import
GLIDESuperResUNetModel
,
GLIDETextToImageUNetModel
,
GLIDEUNetModel
from
.unet_grad_tts
import
UNetGradTTSModel
from
.unet_grad_tts
import
UNetGradTTSModel
from
.unet_ldm
import
UNetLDMModel
from
.unet_ldm
import
UNetLDMModel
from
.unet_rl
import
TemporalUNet
\ No newline at end of file
src/diffusers/models/unet_rl.py
View file @
49718b47
...
@@ -6,6 +6,10 @@ import einops
...
@@ -6,6 +6,10 @@ import einops
from
einops.layers.torch
import
Rearrange
from
einops.layers.torch
import
Rearrange
import
math
import
math
from
..configuration_utils
import
ConfigMixin
from
..modeling_utils
import
ModelMixin
class
SinusoidalPosEmb
(
nn
.
Module
):
class
SinusoidalPosEmb
(
nn
.
Module
):
def
__init__
(
self
,
dim
):
def
__init__
(
self
,
dim
):
super
().
__init__
()
super
().
__init__
()
...
@@ -85,7 +89,7 @@ class ResidualTemporalBlock(nn.Module):
...
@@ -85,7 +89,7 @@ class ResidualTemporalBlock(nn.Module):
out
=
self
.
blocks
[
1
](
out
)
out
=
self
.
blocks
[
1
](
out
)
return
out
+
self
.
residual_conv
(
x
)
return
out
+
self
.
residual_conv
(
x
)
class
TemporalU
n
et
(
nn
.
Module
):
class
TemporalU
N
et
(
ModelMixin
,
ConfigMixin
):
#(
nn.Module):
def
__init__
(
def
__init__
(
self
,
self
,
...
@@ -99,7 +103,7 @@ class TemporalUnet(nn.Module):
...
@@ -99,7 +103,7 @@ class TemporalUnet(nn.Module):
dims
=
[
transition_dim
,
*
map
(
lambda
m
:
dim
*
m
,
dim_mults
)]
dims
=
[
transition_dim
,
*
map
(
lambda
m
:
dim
*
m
,
dim_mults
)]
in_out
=
list
(
zip
(
dims
[:
-
1
],
dims
[
1
:]))
in_out
=
list
(
zip
(
dims
[:
-
1
],
dims
[
1
:]))
print
(
f
'[ models/temporal ] Channel dimensions:
{
in_out
}
'
)
#
print(f'[ models/temporal ] Channel dimensions: {in_out}')
time_dim
=
dim
time_dim
=
dim
self
.
time_mlp
=
nn
.
Sequential
(
self
.
time_mlp
=
nn
.
Sequential
(
...
...
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