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
9132ce7c
Unverified
Commit
9132ce7c
authored
Apr 18, 2024
by
Wentian
Committed by
GitHub
Apr 17, 2024
Browse files
[Docs] Update TGATE in section `optimization`. (#7698)
Update tgate.md
parent
30c977d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
docs/source/en/optimization/tgate.md
docs/source/en/optimization/tgate.md
+8
-5
No files found.
docs/source/en/optimization/tgate.md
View file @
9132ce7c
...
@@ -35,10 +35,13 @@ from diffusers import PixArtAlphaPipeline
...
@@ -35,10 +35,13 @@ from diffusers import PixArtAlphaPipeline
from
tgate
import
TgatePixArtLoader
from
tgate
import
TgatePixArtLoader
pipe
=
PixArtAlphaPipeline
.
from_pretrained
(
"PixArt-alpha/PixArt-XL-2-1024-MS"
,
torch_dtype
=
torch
.
float16
)
pipe
=
PixArtAlphaPipeline
.
from_pretrained
(
"PixArt-alpha/PixArt-XL-2-1024-MS"
,
torch_dtype
=
torch
.
float16
)
gate_step
=
8
inference_step
=
25
pipe
=
TgatePixArtLoader
(
pipe
=
TgatePixArtLoader
(
pipe
,
pipe
,
gate_step
=
8
,
gate_step
=
gate_step
,
num_inference_steps
=
25
,
num_inference_steps
=
inference_step
,
).
to
(
"cuda"
)
).
to
(
"cuda"
)
image
=
pipe
.
tgate
(
image
=
pipe
.
tgate
(
...
@@ -56,6 +59,7 @@ Accelerate `StableDiffusionXLPipeline` with T-GATE:
...
@@ -56,6 +59,7 @@ Accelerate `StableDiffusionXLPipeline` with T-GATE:
import
torch
import
torch
from
diffusers
import
StableDiffusionXLPipeline
from
diffusers
import
StableDiffusionXLPipeline
from
diffusers
import
DPMSolverMultistepScheduler
from
diffusers
import
DPMSolverMultistepScheduler
from
tgate
import
TgateSDXLLoader
pipe
=
StableDiffusionXLPipeline
.
from_pretrained
(
pipe
=
StableDiffusionXLPipeline
.
from_pretrained
(
"stabilityai/stable-diffusion-xl-base-1.0"
,
"stabilityai/stable-diffusion-xl-base-1.0"
,
...
@@ -65,7 +69,6 @@ pipe = StableDiffusionXLPipeline.from_pretrained(
...
@@ -65,7 +69,6 @@ pipe = StableDiffusionXLPipeline.from_pretrained(
)
)
pipe
.
scheduler
=
DPMSolverMultistepScheduler
.
from_config
(
pipe
.
scheduler
.
config
)
pipe
.
scheduler
=
DPMSolverMultistepScheduler
.
from_config
(
pipe
.
scheduler
.
config
)
from
tgate
import
TgateSDXLLoader
gate_step
=
10
gate_step
=
10
inference_step
=
25
inference_step
=
25
pipe
=
TgateSDXLLoader
(
pipe
=
TgateSDXLLoader
(
...
@@ -89,6 +92,7 @@ Accelerate `StableDiffusionXLPipeline` with [DeepCache](https://github.com/horse
...
@@ -89,6 +92,7 @@ Accelerate `StableDiffusionXLPipeline` with [DeepCache](https://github.com/horse
import
torch
import
torch
from
diffusers
import
StableDiffusionXLPipeline
from
diffusers
import
StableDiffusionXLPipeline
from
diffusers
import
DPMSolverMultistepScheduler
from
diffusers
import
DPMSolverMultistepScheduler
from
tgate
import
TgateSDXLDeepCacheLoader
pipe
=
StableDiffusionXLPipeline
.
from_pretrained
(
pipe
=
StableDiffusionXLPipeline
.
from_pretrained
(
"stabilityai/stable-diffusion-xl-base-1.0"
,
"stabilityai/stable-diffusion-xl-base-1.0"
,
...
@@ -98,7 +102,6 @@ pipe = StableDiffusionXLPipeline.from_pretrained(
...
@@ -98,7 +102,6 @@ pipe = StableDiffusionXLPipeline.from_pretrained(
)
)
pipe
.
scheduler
=
DPMSolverMultistepScheduler
.
from_config
(
pipe
.
scheduler
.
config
)
pipe
.
scheduler
=
DPMSolverMultistepScheduler
.
from_config
(
pipe
.
scheduler
.
config
)
from
tgate
import
TgateSDXLDeepCacheLoader
gate_step
=
10
gate_step
=
10
inference_step
=
25
inference_step
=
25
pipe
=
TgateSDXLDeepCacheLoader
(
pipe
=
TgateSDXLDeepCacheLoader
(
...
@@ -123,6 +126,7 @@ import torch
...
@@ -123,6 +126,7 @@ import torch
from
diffusers
import
StableDiffusionXLPipeline
from
diffusers
import
StableDiffusionXLPipeline
from
diffusers
import
UNet2DConditionModel
,
LCMScheduler
from
diffusers
import
UNet2DConditionModel
,
LCMScheduler
from
diffusers
import
DPMSolverMultistepScheduler
from
diffusers
import
DPMSolverMultistepScheduler
from
tgate
import
TgateSDXLLoader
unet
=
UNet2DConditionModel
.
from_pretrained
(
unet
=
UNet2DConditionModel
.
from_pretrained
(
"latent-consistency/lcm-sdxl"
,
"latent-consistency/lcm-sdxl"
,
...
@@ -137,7 +141,6 @@ pipe = StableDiffusionXLPipeline.from_pretrained(
...
@@ -137,7 +141,6 @@ pipe = StableDiffusionXLPipeline.from_pretrained(
)
)
pipe
.
scheduler
=
LCMScheduler
.
from_config
(
pipe
.
scheduler
.
config
)
pipe
.
scheduler
=
LCMScheduler
.
from_config
(
pipe
.
scheduler
.
config
)
from
tgate
import
TgateSDXLLoader
gate_step
=
1
gate_step
=
1
inference_step
=
4
inference_step
=
4
pipe
=
TgateSDXLLoader
(
pipe
=
TgateSDXLLoader
(
...
...
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