Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
diffusers
Commits
89459a5d
Unverified
Commit
89459a5d
authored
Dec 25, 2023
by
Sayak Paul
Committed by
GitHub
Dec 25, 2023
Browse files
fix: lora peft dummy components (#6308)
* fix: lora peft dummy components * fix: dummy components
parent
008d9818
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
tests/lora/test_lora_layers_peft.py
tests/lora/test_lora_layers_peft.py
+68
-0
No files found.
tests/lora/test_lora_layers_peft.py
View file @
89459a5d
...
@@ -115,9 +115,12 @@ class PeftLoraLoaderMixinTests:
...
@@ -115,9 +115,12 @@ class PeftLoraLoaderMixinTests:
torch
.
manual_seed
(
0
)
torch
.
manual_seed
(
0
)
unet
=
UNet2DConditionModel
(
**
self
.
unet_kwargs
)
unet
=
UNet2DConditionModel
(
**
self
.
unet_kwargs
)
scheduler
=
scheduler_cls
(
**
self
.
scheduler_kwargs
)
scheduler
=
scheduler_cls
(
**
self
.
scheduler_kwargs
)
torch
.
manual_seed
(
0
)
torch
.
manual_seed
(
0
)
vae
=
AutoencoderKL
(
**
self
.
vae_kwargs
)
vae
=
AutoencoderKL
(
**
self
.
vae_kwargs
)
text_encoder
=
CLIPTextModel
.
from_pretrained
(
"peft-internal-testing/tiny-clip-text-2"
)
text_encoder
=
CLIPTextModel
.
from_pretrained
(
"peft-internal-testing/tiny-clip-text-2"
)
tokenizer
=
CLIPTokenizer
.
from_pretrained
(
"peft-internal-testing/tiny-clip-text-2"
)
tokenizer
=
CLIPTokenizer
.
from_pretrained
(
"peft-internal-testing/tiny-clip-text-2"
)
...
@@ -1402,6 +1405,35 @@ class StableDiffusionXLLoRATests(PeftLoraLoaderMixinTests, unittest.TestCase):
...
@@ -1402,6 +1405,35 @@ class StableDiffusionXLLoRATests(PeftLoraLoaderMixinTests, unittest.TestCase):
@
slow
@
slow
@
require_torch_gpu
@
require_torch_gpu
class
LoraIntegrationTests
(
PeftLoraLoaderMixinTests
,
unittest
.
TestCase
):
class
LoraIntegrationTests
(
PeftLoraLoaderMixinTests
,
unittest
.
TestCase
):
pipeline_class
=
StableDiffusionPipeline
scheduler_cls
=
DDIMScheduler
scheduler_kwargs
=
{
"beta_start"
:
0.00085
,
"beta_end"
:
0.012
,
"beta_schedule"
:
"scaled_linear"
,
"clip_sample"
:
False
,
"set_alpha_to_one"
:
False
,
"steps_offset"
:
1
,
}
unet_kwargs
=
{
"block_out_channels"
:
(
32
,
64
),
"layers_per_block"
:
2
,
"sample_size"
:
32
,
"in_channels"
:
4
,
"out_channels"
:
4
,
"down_block_types"
:
(
"DownBlock2D"
,
"CrossAttnDownBlock2D"
),
"up_block_types"
:
(
"CrossAttnUpBlock2D"
,
"UpBlock2D"
),
"cross_attention_dim"
:
32
,
}
vae_kwargs
=
{
"block_out_channels"
:
[
32
,
64
],
"in_channels"
:
3
,
"out_channels"
:
3
,
"down_block_types"
:
[
"DownEncoderBlock2D"
,
"DownEncoderBlock2D"
],
"up_block_types"
:
[
"UpDecoderBlock2D"
,
"UpDecoderBlock2D"
],
"latent_channels"
:
4
,
}
def
tearDown
(
self
):
def
tearDown
(
self
):
import
gc
import
gc
...
@@ -1655,6 +1687,42 @@ class LoraIntegrationTests(PeftLoraLoaderMixinTests, unittest.TestCase):
...
@@ -1655,6 +1687,42 @@ class LoraIntegrationTests(PeftLoraLoaderMixinTests, unittest.TestCase):
@
slow
@
slow
@
require_torch_gpu
@
require_torch_gpu
class
LoraSDXLIntegrationTests
(
PeftLoraLoaderMixinTests
,
unittest
.
TestCase
):
class
LoraSDXLIntegrationTests
(
PeftLoraLoaderMixinTests
,
unittest
.
TestCase
):
has_two_text_encoders
=
True
pipeline_class
=
StableDiffusionXLPipeline
scheduler_cls
=
EulerDiscreteScheduler
scheduler_kwargs
=
{
"beta_start"
:
0.00085
,
"beta_end"
:
0.012
,
"beta_schedule"
:
"scaled_linear"
,
"timestep_spacing"
:
"leading"
,
"steps_offset"
:
1
,
}
unet_kwargs
=
{
"block_out_channels"
:
(
32
,
64
),
"layers_per_block"
:
2
,
"sample_size"
:
32
,
"in_channels"
:
4
,
"out_channels"
:
4
,
"down_block_types"
:
(
"DownBlock2D"
,
"CrossAttnDownBlock2D"
),
"up_block_types"
:
(
"CrossAttnUpBlock2D"
,
"UpBlock2D"
),
"attention_head_dim"
:
(
2
,
4
),
"use_linear_projection"
:
True
,
"addition_embed_type"
:
"text_time"
,
"addition_time_embed_dim"
:
8
,
"transformer_layers_per_block"
:
(
1
,
2
),
"projection_class_embeddings_input_dim"
:
80
,
# 6 * 8 + 32
"cross_attention_dim"
:
64
,
}
vae_kwargs
=
{
"block_out_channels"
:
[
32
,
64
],
"in_channels"
:
3
,
"out_channels"
:
3
,
"down_block_types"
:
[
"DownEncoderBlock2D"
,
"DownEncoderBlock2D"
],
"up_block_types"
:
[
"UpDecoderBlock2D"
,
"UpDecoderBlock2D"
],
"latent_channels"
:
4
,
"sample_size"
:
128
,
}
def
tearDown
(
self
):
def
tearDown
(
self
):
import
gc
import
gc
...
...
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