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
a7ae808e
Commit
a7ae808e
authored
Oct 28, 2022
by
Patrick von Platen
Browse files
increase tolerance
parent
ea01a4c7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
tests/models/test_models_unet_2d.py
tests/models/test_models_unet_2d.py
+8
-7
tests/models/test_models_vae.py
tests/models/test_models_vae.py
+6
-6
No files found.
tests/models/test_models_unet_2d.py
View file @
a7ae808e
...
@@ -21,12 +21,13 @@ import unittest
...
@@ -21,12 +21,13 @@ import unittest
import
torch
import
torch
from
diffusers
import
UNet2DConditionModel
,
UNet2DModel
from
diffusers
import
UNet2DConditionModel
,
UNet2DModel
from
diffusers.utils
import
floats_tensor
,
load_numpy
,
require_torch_gpu
,
slow
,
torch_all_close
,
torch_device
from
diffusers.utils
import
floats_tensor
,
load_numpy
,
logging
,
require_torch_gpu
,
slow
,
torch_all_close
,
torch_device
from
parameterized
import
parameterized
from
parameterized
import
parameterized
from
..test_modeling_common
import
ModelTesterMixin
from
..test_modeling_common
import
ModelTesterMixin
logger
=
logging
.
get_logger
(
__name__
)
torch
.
backends
.
cuda
.
matmul
.
allow_tf32
=
False
torch
.
backends
.
cuda
.
matmul
.
allow_tf32
=
False
...
@@ -464,7 +465,7 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
...
@@ -464,7 +465,7 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
3
)
@
parameterized
.
expand
(
@
parameterized
.
expand
(
[
[
...
@@ -490,7 +491,7 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
...
@@ -490,7 +491,7 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1
e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
5
e-
3
)
@
parameterized
.
expand
(
@
parameterized
.
expand
(
[
[
...
@@ -515,7 +516,7 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
...
@@ -515,7 +516,7 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
3
)
@
parameterized
.
expand
(
@
parameterized
.
expand
(
[
[
...
@@ -541,7 +542,7 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
...
@@ -541,7 +542,7 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1
e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
5
e-
3
)
@
parameterized
.
expand
(
@
parameterized
.
expand
(
[
[
...
@@ -566,7 +567,7 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
...
@@ -566,7 +567,7 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
3
)
@
parameterized
.
expand
(
@
parameterized
.
expand
(
[
[
...
@@ -592,4 +593,4 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
...
@@ -592,4 +593,4 @@ class UNet2DConditionModelIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1
e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
5
e-
3
)
tests/models/test_models_vae.py
View file @
a7ae808e
...
@@ -185,7 +185,7 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
...
@@ -185,7 +185,7 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
3
)
@
parameterized
.
expand
(
@
parameterized
.
expand
(
[
[
...
@@ -209,7 +209,7 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
...
@@ -209,7 +209,7 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
:
2
,
-
2
:].
flatten
().
float
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
:
2
,
-
2
:].
flatten
().
float
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1
e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
5
e-
3
)
@
parameterized
.
expand
(
@
parameterized
.
expand
(
[
[
...
@@ -231,7 +231,7 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
...
@@ -231,7 +231,7 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
-
2
:,
:
2
].
flatten
().
float
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
3
)
@
parameterized
.
expand
(
@
parameterized
.
expand
(
[
[
...
@@ -254,7 +254,7 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
...
@@ -254,7 +254,7 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
:
2
,
-
2
:].
flatten
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
:
2
,
-
2
:].
flatten
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
3
)
@
parameterized
.
expand
(
@
parameterized
.
expand
(
[
[
...
@@ -276,7 +276,7 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
...
@@ -276,7 +276,7 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
-
1
,
-
2
:,
:
2
,
-
2
:].
flatten
().
float
().
cpu
()
output_slice
=
sample
[
-
1
,
-
2
:,
:
2
,
-
2
:].
flatten
().
float
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1
e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
5
e-
3
)
@
parameterized
.
expand
(
@
parameterized
.
expand
(
[
[
...
@@ -300,4 +300,4 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
...
@@ -300,4 +300,4 @@ class AutoencoderKLIntegrationTests(unittest.TestCase):
output_slice
=
sample
[
0
,
-
1
,
-
3
:,
-
3
:].
flatten
().
cpu
()
output_slice
=
sample
[
0
,
-
1
,
-
3
:,
-
3
:].
flatten
().
cpu
()
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
expected_output_slice
=
torch
.
tensor
(
expected_slice
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
4
)
assert
torch_all_close
(
output_slice
,
expected_output_slice
,
atol
=
1e-
3
)
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