-
Notifications
You must be signed in to change notification settings - Fork 6.1k
[CI] Nightly Test Updates #9380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
456eac5
update
DN6 261e19b
update
DN6 95d93e2
update
DN6 c1602e0
update
DN6 8588abe
Merge branch 'main' into nightly-precision
DN6 f2c049b
update
DN6 ff39dbb
Merge branch 'main' into nightly-precision
sayakpaul e1afd48
Merge branch 'main' into nightly-precision
yiyixuxu 2a037e2
Merge branch 'main' into nightly-precision
yiyixuxu de4a878
Merge branch 'main' into nightly-precision
sayakpaul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,15 +13,19 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
import unittest | ||
|
||
import numpy as np | ||
import torch | ||
from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer | ||
|
||
from diffusers import AmusedPipeline, AmusedScheduler, UVit2DModel, VQModel | ||
from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device | ||
from diffusers.utils.testing_utils import ( | ||
enable_full_determinism, | ||
require_torch_gpu, | ||
slow, | ||
torch_device, | ||
) | ||
|
||
from ..pipeline_params import TEXT_TO_IMAGE_BATCH_PARAMS, TEXT_TO_IMAGE_PARAMS | ||
from ..test_pipelines_common import PipelineTesterMixin | ||
|
@@ -65,19 +69,15 @@ def get_dummy_components(self): | |
vqvae = VQModel( | ||
act_fn="silu", | ||
block_out_channels=[8], | ||
down_block_types=[ | ||
"DownEncoderBlock2D", | ||
], | ||
down_block_types=["DownEncoderBlock2D"], | ||
in_channels=3, | ||
latent_channels=8, | ||
layers_per_block=1, | ||
norm_num_groups=8, | ||
num_vq_embeddings=8, | ||
out_channels=3, | ||
sample_size=8, | ||
up_block_types=[ | ||
"UpDecoderBlock2D", | ||
], | ||
up_block_types=["UpDecoderBlock2D"], | ||
mid_block_add_attention=False, | ||
lookup_from_codebook=True, | ||
) | ||
|
@@ -96,7 +96,6 @@ def get_dummy_components(self): | |
) | ||
text_encoder = CLIPTextModelWithProjection(text_encoder_config) | ||
tokenizer = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip") | ||
|
||
components = { | ||
"transformer": transformer, | ||
"scheduler": scheduler, | ||
|
@@ -135,47 +134,37 @@ class AmusedPipelineSlowTests(unittest.TestCase): | |
def test_amused_256(self): | ||
pipe = AmusedPipeline.from_pretrained("amused/amused-256") | ||
pipe.to(torch_device) | ||
|
||
image = pipe("dog", generator=torch.Generator().manual_seed(0), num_inference_steps=2, output_type="np").images | ||
|
||
image_slice = image[0, -3:, -3:, -1].flatten() | ||
|
||
assert image.shape == (1, 256, 256, 3) | ||
expected_slice = np.array([0.4011, 0.3992, 0.3790, 0.3856, 0.3772, 0.3711, 0.3919, 0.3850, 0.3625]) | ||
assert np.abs(image_slice - expected_slice).max() < 3e-3 | ||
expected_slice = np.array([0.4011, 0.3992, 0.379, 0.3856, 0.3772, 0.3711, 0.3919, 0.385, 0.3625]) | ||
assert np.abs(image_slice - expected_slice).max() < 0.003 | ||
|
||
def test_amused_256_fp16(self): | ||
pipe = AmusedPipeline.from_pretrained("amused/amused-256", variant="fp16", torch_dtype=torch.float16) | ||
pipe.to(torch_device) | ||
|
||
image = pipe("dog", generator=torch.Generator().manual_seed(0), num_inference_steps=2, output_type="np").images | ||
|
||
image_slice = image[0, -3:, -3:, -1].flatten() | ||
|
||
assert image.shape == (1, 256, 256, 3) | ||
expected_slice = np.array([0.0554, 0.05129, 0.0344, 0.0452, 0.0476, 0.0271, 0.0495, 0.0527, 0.0158]) | ||
assert np.abs(image_slice - expected_slice).max() < 7e-3 | ||
assert np.abs(image_slice - expected_slice).max() < 0.007 | ||
|
||
def test_amused_512(self): | ||
pipe = AmusedPipeline.from_pretrained("amused/amused-512") | ||
pipe.to(torch_device) | ||
|
||
image = pipe("dog", generator=torch.Generator().manual_seed(0), num_inference_steps=2, output_type="np").images | ||
|
||
image_slice = image[0, -3:, -3:, -1].flatten() | ||
|
||
assert image.shape == (1, 512, 512, 3) | ||
expected_slice = np.array([0.9960, 0.9960, 0.9946, 0.9980, 0.9947, 0.9932, 0.9960, 0.9961, 0.9947]) | ||
assert np.abs(image_slice - expected_slice).max() < 3e-3 | ||
expected_slice = np.array([0.1199, 0.1171, 0.1229, 0.1188, 0.1210, 0.1147, 0.1260, 0.1346, 0.1152]) | ||
assert np.abs(image_slice - expected_slice).max() < 0.003 | ||
|
||
def test_amused_512_fp16(self): | ||
pipe = AmusedPipeline.from_pretrained("amused/amused-512", variant="fp16", torch_dtype=torch.float16) | ||
pipe.to(torch_device) | ||
|
||
image = pipe("dog", generator=torch.Generator().manual_seed(0), num_inference_steps=2, output_type="np").images | ||
|
||
image_slice = image[0, -3:, -3:, -1].flatten() | ||
|
||
assert image.shape == (1, 512, 512, 3) | ||
expected_slice = np.array([0.9983, 1.0, 1.0, 1.0, 1.0, 0.9989, 0.9994, 0.9976, 0.9977]) | ||
assert np.abs(image_slice - expected_slice).max() < 3e-3 | ||
expected_slice = np.array([0.1509, 0.1492, 0.1531, 0.1485, 0.1501, 0.1465, 0.1581, 0.1690, 0.1499]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same (runner change effects)? |
||
assert np.abs(image_slice - expected_slice).max() < 0.003 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably because of the runner change?