Migrate most to self.config and self.context

This commit is contained in:
henryruhs
2025-03-06 18:27:56 +01:00
parent ab3b699124
commit b829d5e42c
5 changed files with 105 additions and 78 deletions
+12 -11
View File
@@ -1,3 +1,5 @@
from configparser import ConfigParser
import pytest
import torch
@@ -7,18 +9,17 @@ from face_swapper.src.networks.unet import UNet
@pytest.mark.parametrize('output_size', [ 128, 256, 512 ])
def test_aad_with_unet(output_size : int) -> None:
identity_channels = 512
output_channels = 1024
if output_size == 128:
output_channels = 2048
if output_size == 256:
output_channels = 4096
if output_size == 512:
output_channels = 8192
num_blocks = 2
config_parser = ConfigParser()
config_parser['training.model.generator'] =\
{
'identity_channels': '512',
'output_channels': str(output_size * 16),
'output_size': str(output_size),
'num_blocks': '2'
}
generator = AAD(identity_channels, output_channels, output_size, num_blocks).eval()
encoder = UNet(output_size).eval()
generator = AAD(config_parser).eval()
encoder = UNet(config_parser).eval()
source_tensor = torch.randn(1, 512)
target_tensor = torch.randn(1, 3, output_size, output_size)