mirror of
https://github.com/finegrain-ai/refiners.git
synced 2024-11-22 22:28:46 +00:00
15 lines
453 B
Python
15 lines
453 B
Python
|
import torch
|
||
|
|
||
|
from refiners.fluxion.utils import manual_seed, no_grad
|
||
|
from refiners.foundationals.latent_diffusion.model import LatentDiffusionModel
|
||
|
|
||
|
|
||
|
@no_grad()
|
||
|
def test_sample_noise():
|
||
|
manual_seed(2)
|
||
|
latents_0 = LatentDiffusionModel.sample_noise(size=(1, 4, 64, 64))
|
||
|
manual_seed(2)
|
||
|
latents_1 = LatentDiffusionModel.sample_noise(size=(1, 4, 64, 64), offset_noise=0.0)
|
||
|
|
||
|
assert torch.allclose(latents_0, latents_1, atol=1e-6, rtol=0)
|