Some checks failed
Python Linting / Run Ruff (push) Has been cancelled
Python Linting / Run Pylint (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.10, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.11, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-stable (12.1, , linux, 3.12, [self-hosted Linux], stable) (push) Has been cancelled
Full Comfy CI Workflow Runs / test-unix-nightly (12.1, , linux, 3.11, [self-hosted Linux], nightly) (push) Has been cancelled
Execution Tests / test (macos-latest) (push) Has been cancelled
Execution Tests / test (ubuntu-latest) (push) Has been cancelled
Execution Tests / test (windows-latest) (push) Has been cancelled
Test server launches without errors / test (push) Has been cancelled
Unit Tests / test (macos-latest) (push) Has been cancelled
Unit Tests / test (ubuntu-latest) (push) Has been cancelled
Unit Tests / test (windows-2022) (push) Has been cancelled
Includes 30 custom nodes committed directly, 7 Civitai-exclusive loras stored via Git LFS, and a setup script that installs all dependencies and downloads HuggingFace-hosted models on vast.ai. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
71 lines
2.0 KiB
Python
71 lines
2.0 KiB
Python
"""
|
|
Fixtures for base images.
|
|
"""
|
|
|
|
import pathlib
|
|
import pytest
|
|
import torch
|
|
|
|
from setup_utils import execute
|
|
from io_utils import save_image, load_image
|
|
from configs import DirectoryConfig
|
|
|
|
# Image file names
|
|
EXT = ".jpg"
|
|
CATEGORY = pathlib.Path("base_images")
|
|
BASE_IMAGE_1_NAME = "main1_sd15" + EXT
|
|
BASE_IMAGE_2_NAME = "main2_sd15" + EXT
|
|
|
|
# Prepend category path
|
|
BASE_IMAGE_1 = CATEGORY / BASE_IMAGE_1_NAME
|
|
BASE_IMAGE_2 = CATEGORY / BASE_IMAGE_2_NAME
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def base_image(loaded_checkpoint, seed, test_dirs: DirectoryConfig, node_classes):
|
|
"""Generate a base image for upscaling tests."""
|
|
EmptyLatentImage = node_classes["EmptyLatentImage"]
|
|
CLIPTextEncode = node_classes["CLIPTextEncode"]
|
|
KSampler = node_classes["KSampler"]
|
|
VAEDecode = node_classes["VAEDecode"]
|
|
|
|
model, clip, vae = loaded_checkpoint
|
|
|
|
with torch.inference_mode():
|
|
(empty_latent,) = execute(EmptyLatentImage, width=512, height=512, batch_size=2)
|
|
|
|
(positive,) = execute(
|
|
CLIPTextEncode,
|
|
text="beautiful scenery nature glass bottle landscape, , purple galaxy bottle,",
|
|
clip=clip,
|
|
)
|
|
|
|
(negative,) = execute(CLIPTextEncode, text="text, watermark", clip=clip)
|
|
|
|
(samples,) = execute(
|
|
KSampler,
|
|
model=model,
|
|
positive=positive,
|
|
negative=negative,
|
|
latent_image=empty_latent,
|
|
seed=seed,
|
|
steps=10,
|
|
cfg=8,
|
|
sampler_name="dpmpp_2m",
|
|
scheduler="karras",
|
|
denoise=1.0,
|
|
)
|
|
|
|
(image,) = execute(VAEDecode, samples=samples, vae=vae)
|
|
|
|
# Save base images
|
|
sample_dir = test_dirs.sample_images
|
|
base_img1_path = sample_dir / BASE_IMAGE_1
|
|
base_img2_path = sample_dir / BASE_IMAGE_2
|
|
save_image(image[0:1], base_img1_path)
|
|
save_image(image[1:2], base_img2_path)
|
|
|
|
# Load images back as tensors to account for compression
|
|
image = torch.cat([load_image(base_img1_path), load_image(base_img2_path)])
|
|
return image, positive, negative
|