Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HonzaCuhel committed Jan 12, 2024
1 parent 856d32a commit 52dd127
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 129 deletions.
21 changes: 21 additions & 0 deletions media/coverage_badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
248 changes: 124 additions & 124 deletions tests/integration/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,80 +260,80 @@ def test_cuda_simple_sdxl_turbo_detection_pipeline():
# =========================================================
# DETECTION - LLM
# =========================================================
# @pytest.mark.skipif(total_memory < 28, reason="Test requires at least 28GB of RAM for running on CPU")
# def test_cpu_lm_sdxl_turbo_detection_pipeline():
# # Define target folder
# target_folder = "data/data-det-cpu-lm-sdxl-turbo/"
# # Define the command to run the datadreamer
# cmd = (
# f"datadreamer --save_dir {target_folder} "
# f"--class_names alien mars cat "
# f"--prompts_number 1 "
# f"--prompt_generator lm "
# f"--num_objects_range 1 2 "
# f"--image_generator sdxl-turbo "
# f"--use_image_tester "
# f"--device cpu"
# )
# # Check the run of the pipeline
# _check_detection_pipeline(cmd, target_folder)
@pytest.mark.skipif(total_memory < 28, reason="Test requires at least 28GB of RAM for running on CPU")
def test_cpu_lm_sdxl_turbo_detection_pipeline():
# Define target folder
target_folder = "data/data-det-cpu-lm-sdxl-turbo/"
# Define the command to run the datadreamer
cmd = (
f"datadreamer --save_dir {target_folder} "
f"--class_names alien mars cat "
f"--prompts_number 1 "
f"--prompt_generator lm "
f"--num_objects_range 1 2 "
f"--image_generator sdxl-turbo "
f"--use_image_tester "
f"--device cpu"
)
# Check the run of the pipeline
_check_detection_pipeline(cmd, target_folder)


# @pytest.mark.skipif(total_memory < 16 or not torch.cuda.is_available(), reason="Test requires at least 16GB of RAM and CUDA support")
# def test_cuda_lm_sdxl_turbo_detection_pipeline():
# # Define target folder
# target_folder = "data/data-det-cuda-lm-sdxl-turbo/"
# # Define the command to run the datadreamer
# cmd = (
# f"datadreamer --save_dir {target_folder} "
# f"--class_names alien mars cat "
# f"--prompts_number 1 "
# f"--prompt_generator lm "
# f"--num_objects_range 1 2 "
# f"--image_generator sdxl-turbo "
# f"--use_image_tester "
# f"--device cuda"
# )
# # Check the run of the pipeline
# _check_detection_pipeline(cmd, target_folder)
@pytest.mark.skipif(total_memory < 16 or not torch.cuda.is_available(), reason="Test requires at least 16GB of RAM and CUDA support")
def test_cuda_lm_sdxl_turbo_detection_pipeline():
# Define target folder
target_folder = "data/data-det-cuda-lm-sdxl-turbo/"
# Define the command to run the datadreamer
cmd = (
f"datadreamer --save_dir {target_folder} "
f"--class_names alien mars cat "
f"--prompts_number 1 "
f"--prompt_generator lm "
f"--num_objects_range 1 2 "
f"--image_generator sdxl-turbo "
f"--use_image_tester "
f"--device cuda"
)
# Check the run of the pipeline
_check_detection_pipeline(cmd, target_folder)


# @pytest.mark.skipif(total_memory < 28, reason="Test requires at least 28GB of RAM for running on CPU")
# def test_cpu_lm_sdxl_detection_pipeline():
# # Define target folder
# target_folder = "data/data-det-cpu-lm-sdxl/"
# # Define the command to run the datadreamer
# cmd = (
# f"datadreamer --save_dir {target_folder} "
# f"--class_names alien mars cat "
# f"--prompts_number 1 "
# f"--prompt_generator lm "
# f"--num_objects_range 1 2 "
# f"--image_generator sdxl "
# f"--use_image_tester "
# f"--device cpu"
# )
# # Check the run of the pipeline
# _check_detection_pipeline(cmd, target_folder)
@pytest.mark.skipif(total_memory < 28, reason="Test requires at least 28GB of RAM for running on CPU")
def test_cpu_lm_sdxl_detection_pipeline():
# Define target folder
target_folder = "data/data-det-cpu-lm-sdxl/"
# Define the command to run the datadreamer
cmd = (
f"datadreamer --save_dir {target_folder} "
f"--class_names alien mars cat "
f"--prompts_number 1 "
f"--prompt_generator lm "
f"--num_objects_range 1 2 "
f"--image_generator sdxl "
f"--use_image_tester "
f"--device cpu"
)
# Check the run of the pipeline
_check_detection_pipeline(cmd, target_folder)


# @pytest.mark.skipif(total_memory < 16 or not torch.cuda.is_available(), reason="Test requires at least 16GB of RAM and CUDA support")
# def test_cuda_lm_sdxl_detection_pipeline():
# # Define target folder
# target_folder = "data/data-det-cuda-lm-sdxl/"
# # Define the command to run the datadreamer
# cmd = (
# f"datadreamer --save_dir {target_folder} "
# f"--class_names alien mars cat "
# f"--prompts_number 1 "
# f"--prompt_generator lm "
# f"--num_objects_range 1 2 "
# f"--image_generator sdxl "
# f"--use_image_tester "
# f"--device cuda"
# )
# # Check the run of the pipeline
# _check_detection_pipeline(cmd, target_folder)
@pytest.mark.skipif(total_memory < 16 or not torch.cuda.is_available(), reason="Test requires at least 16GB of RAM and CUDA support")
def test_cuda_lm_sdxl_detection_pipeline():
# Define target folder
target_folder = "data/data-det-cuda-lm-sdxl/"
# Define the command to run the datadreamer
cmd = (
f"datadreamer --save_dir {target_folder} "
f"--class_names alien mars cat "
f"--prompts_number 1 "
f"--prompt_generator lm "
f"--num_objects_range 1 2 "
f"--image_generator sdxl "
f"--use_image_tester "
f"--device cuda"
)
# Check the run of the pipeline
_check_detection_pipeline(cmd, target_folder)


# =========================================================
Expand Down Expand Up @@ -421,68 +421,68 @@ def test_cuda_simple_sdxl_turbo_classification_pipeline():
# =========================================================
# CLASSIFICATION - LLM
# =========================================================
# @pytest.mark.skipif(total_memory < 28, reason="Test requires at least 28GB of RAM for running on CPU")
# def test_cpu_lm_sdxl_turbo_classification_pipeline():
# # Define target folder
# target_folder = "data/data-cls-cpu-lm-sdxl-turbo/"
# # Define the command to run the datadreamer
# cmd = (
# f"datadreamer --task classification "
# f"--save_dir {target_folder} "
# f"--class_names alien mars cat "
# f"--prompts_number 1 "
# f"--prompt_generator lm "
# f"--num_objects_range 1 2 "
# f"--image_generator sdxl-turbo "
# f"--use_image_tester "
# f"--device cpu"
# )
# # Check the run of the pipeline
# _check_detection_pipeline(cmd, target_folder)
@pytest.mark.skipif(total_memory < 28, reason="Test requires at least 28GB of RAM for running on CPU")
def test_cpu_lm_sdxl_turbo_classification_pipeline():
# Define target folder
target_folder = "data/data-cls-cpu-lm-sdxl-turbo/"
# Define the command to run the datadreamer
cmd = (
f"datadreamer --task classification "
f"--save_dir {target_folder} "
f"--class_names alien mars cat "
f"--prompts_number 1 "
f"--prompt_generator lm "
f"--num_objects_range 1 2 "
f"--image_generator sdxl-turbo "
f"--use_image_tester "
f"--device cpu"
)
# Check the run of the pipeline
_check_detection_pipeline(cmd, target_folder)


# @pytest.mark.skipif(total_memory < 16 or not torch.cuda.is_available(), reason="Test requires at least 16GB of RAM and CUDA support")
# def test_cuda_lm_sdxl_turbo_classification_pipeline():
# # Define target folder
# target_folder = "data/data-cls-cuda-lm-sdxl-turbo/"
# # Define the command to run the datadreamer
# cmd = (
# f"datadreamer --task classification "
# f"--save_dir {target_folder} "
# f"--class_names alien mars cat "
# f"--prompts_number 1 "
# f"--prompt_generator lm "
# f"--num_objects_range 1 2 "
# f"--image_generator sdxl-turbo "
# f"--use_image_tester "
# f"--device cuda"
# )
# # Check the run of the pipeline
# _check_detection_pipeline(cmd, target_folder)
@pytest.mark.skipif(total_memory < 16 or not torch.cuda.is_available(), reason="Test requires at least 16GB of RAM and CUDA support")
def test_cuda_lm_sdxl_turbo_classification_pipeline():
# Define target folder
target_folder = "data/data-cls-cuda-lm-sdxl-turbo/"
# Define the command to run the datadreamer
cmd = (
f"datadreamer --task classification "
f"--save_dir {target_folder} "
f"--class_names alien mars cat "
f"--prompts_number 1 "
f"--prompt_generator lm "
f"--num_objects_range 1 2 "
f"--image_generator sdxl-turbo "
f"--use_image_tester "
f"--device cuda"
)
# Check the run of the pipeline
_check_detection_pipeline(cmd, target_folder)


# @pytest.mark.skipif(total_memory < 28, reason="Test requires at least 28GB of RAM for running on CPU")
# def test_cpu_lm_sdxl_classification_pipeline():
# # Define target folder
# target_folder = "data/data-cls-cpu-lm-sdxl/"
# # Define the command to run the datadreamer
# cmd = (
# f"datadreamer --task classification "
# f"--save_dir {target_folder} "
# f"--class_names alien mars cat "
# f"--prompts_number 1 "
# f"--prompt_generator lm "
# f"--num_objects_range 1 2 "
# f"--image_generator sdxl "
# f"--use_image_tester "
# f"--device cpu"
# )
# # Check the run of the pipeline
# _check_detection_pipeline(cmd, target_folder)
@pytest.mark.skipif(total_memory < 28, reason="Test requires at least 28GB of RAM for running on CPU")
def test_cpu_lm_sdxl_classification_pipeline():
# Define target folder
target_folder = "data/data-cls-cpu-lm-sdxl/"
# Define the command to run the datadreamer
cmd = (
f"datadreamer --task classification "
f"--save_dir {target_folder} "
f"--class_names alien mars cat "
f"--prompts_number 1 "
f"--prompt_generator lm "
f"--num_objects_range 1 2 "
f"--image_generator sdxl "
f"--use_image_tester "
f"--device cpu"
)
# Check the run of the pipeline
_check_detection_pipeline(cmd, target_folder)


# @pytest.mark.skipif(total_memory < 16 or not torch.cuda.is_available(), reason="Test requires at least 16GB of RAM and CUDA support")
# def test_cuda_lm_sdxl_classification_pipeline():
@pytest.mark.skipif(total_memory < 16 or not torch.cuda.is_available(), reason="Test requires at least 16GB of RAM and CUDA support")
def test_cuda_lm_sdxl_classification_pipeline():
# Define target folder
target_folder = "data/data-cls-cuda-lm-sdxl/"
# Define the command to run the datadreamer
Expand Down
10 changes: 5 additions & 5 deletions tests/unittests/test_image_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ def _check_clip_image_tester(device: str):
tester.release(empty_cuda_cache=True if device != "cpu" else False)


# @pytest.mark.skipif(not torch.cuda.is_available(), reason="Test requires GPU")
# def test_cuda_clip_image_tester():
# _check_clip_image_tester("cuda")
@pytest.mark.skipif(not torch.cuda.is_available(), reason="Test requires GPU")
def test_cuda_clip_image_tester():
_check_clip_image_tester("cuda")


# def test_cpu_clip_image_tester():
# _check_clip_image_tester("cpu")
def test_cpu_clip_image_tester():
_check_clip_image_tester("cpu")


def _check_image_generator(image_generator_class: Type[Union[StableDiffusionImageGenerator, StableDiffusionTurboImageGenerator]], device: str):
Expand Down

0 comments on commit 52dd127

Please sign in to comment.