test: run non-gpu tests on github

This commit is contained in:
Bryce 2023-12-18 20:34:32 -08:00 committed by Bryce Drennan
parent df00109074
commit d834e8b5b3
5 changed files with 94 additions and 14 deletions

View File

@ -8,6 +8,10 @@ on:
env: env:
PIP_DISABLE_PIP_VERSION_CHECK: 1 PIP_DISABLE_PIP_VERSION_CHECK: 1
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs: jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -48,19 +52,14 @@ jobs:
- name: Lint - name: Lint
run: | run: |
black --diff --fast . black --diff --fast .
test: test-gpu:
runs-on: ${{ matrix.os }} runs-on: nvidia-4090
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
os: ["nvidia-4090"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: ${{ matrix.python-version }} python-version: "3.10"
# cache: pip # cache: pip
# cache-dependency-path: requirements-dev.txt # cache-dependency-path: requirements-dev.txt
- name: Install dependencies - name: Install dependencies
@ -72,7 +71,31 @@ jobs:
env: env:
CUDA_LAUNCH_BLOCKING: 1 CUDA_LAUNCH_BLOCKING: 1
run: | run: |
pytest --durations=10 -v pytest --durations=10 -v -m "gputest"
test-non-gpu:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
os: ["ubuntu-latest"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install -r requirements-dev.in . --upgrade
- name: Test with pytest
timeout-minutes: 30
env:
CUDA_LAUNCH_BLOCKING: 1
run: |
pytest --durations=10 -v -m "not gputest"
type-check: type-check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

2
.gitignore vendored
View File

@ -31,3 +31,5 @@ tests/vastai_cli.py
/img_size_memory_usage.csv /img_size_memory_usage.csv
/tests/test_cluster_output/ /tests/test_cluster_output/
/.env /.env
*.ipynb
.ipynb_checkpoints

View File

@ -152,8 +152,8 @@ def detect_cuda_tests(request):
print(f"Test {test_id} used {memory_diff} bytes of GPU memory") print(f"Test {test_id} used {memory_diff} bytes of GPU memory")
cuda_tests_node_ids.append(test_id) cuda_tests_node_ids.append(test_id)
torch.cuda.empty_cache() torch.cuda.empty_cache()
gc.collect() gc.collect()
@pytest.hookimpl() @pytest.hookimpl()
@ -162,9 +162,7 @@ def pytest_collection_modifyitems(config, items):
node_ids_to_mark = read_stored_cuda_test_nodes() node_ids_to_mark = read_stored_cuda_test_nodes()
for item in items: for item in items:
print(item.nodeid)
if item.nodeid in node_ids_to_mark: if item.nodeid in node_ids_to_mark:
print(f"Marking {item.nodeid} as gputest")
item.add_marker(pytest.mark.gputest) item.add_marker(pytest.mark.gputest)
filtered_node_ids = set() filtered_node_ids = set()

View File

@ -1 +1,55 @@
tests/img_processors/test_control_modes.py::test_control_images[depth-create_depth_map]
tests/img_processors/test_control_modes.py::test_control_images[hed-create_hed_edges]
tests/img_processors/test_control_modes.py::test_control_images[normal-create_normal_map]
tests/img_processors/test_control_modes.py::test_control_images[openpose-create_pose_map]
tests/img_processors/test_control_modes.py::test_control_images[qrcode-adaptive_threshold_binarize]
tests/modules/diffusion/test_model.py::test_nonlinearity
tests/test_api.py::test_cliptext_inpainting_pearl_doctor
tests/test_api.py::test_controlnet[canny]
tests/test_api.py::test_controlnet[colorize]
tests/test_api.py::test_controlnet[depth]
tests/test_api.py::test_controlnet[details]
tests/test_api.py::test_controlnet[edit]
tests/test_api.py::test_controlnet[hed]
tests/test_api.py::test_controlnet[inpaint]
tests/test_api.py::test_controlnet[normal]
tests/test_api.py::test_controlnet[openpose]
tests/test_api.py::test_controlnet[qrcode]
tests/test_api.py::test_controlnet[shuffle]
tests/test_api.py::test_imagine[ddim]
tests/test_api.py::test_imagine[dpmpp]
tests/test_api.py::test_img2img_beach_to_sunset[ddim]
tests/test_api.py::test_img2img_beach_to_sunset[dpmpp]
tests/test_api.py::test_img2img_low_noise[ddim]
tests/test_api.py::test_img2img_low_noise[dpmpp]
tests/test_api.py::test_img_to_file
tests/test_api.py::test_img_to_img_from_url_cats[ddim]
tests/test_api.py::test_img_to_img_from_url_cats[dpmpp]
tests/test_api.py::test_img_to_img_fruit_2_gold[ddim-0.05]
tests/test_api.py::test_img_to_img_fruit_2_gold[ddim-0.2]
tests/test_api.py::test_img_to_img_fruit_2_gold[ddim-0]
tests/test_api.py::test_img_to_img_fruit_2_gold[ddim-1]
tests/test_api.py::test_img_to_img_fruit_2_gold[dpmpp-0.05]
tests/test_api.py::test_img_to_img_fruit_2_gold[dpmpp-0.2]
tests/test_api.py::test_img_to_img_fruit_2_gold[dpmpp-0]
tests/test_api.py::test_img_to_img_fruit_2_gold[dpmpp-1]
tests/test_api.py::test_img_to_img_fruit_2_gold_repeat
tests/test_api.py::test_inpainting_bench
tests/test_api.py::test_large_image
tests/test_api.py::test_model_versions[SD-1.5]
tests/test_api.py::test_tile_mode
tests/test_cli/test_cmds.py::test_colorize_cmd
tests/test_cli/test_cmds.py::test_describe_cmd
tests/test_cli/test_cmds.py::test_edit_cmd
tests/test_cli/test_cmds.py::test_edit_demo
tests/test_cli/test_cmds.py::test_imagine_cmd
tests/test_clip_embedder.py::test_text_conditioning
tests/test_enhancers.py::test_clip_masking
tests/test_enhancers.py::test_clip_text_comparison
tests/test_enhancers.py::test_describe_picture
tests/test_enhancers.py::test_fix_faces
tests/test_outpaint.py::test_outpainting_outpaint tests/test_outpaint.py::test_outpainting_outpaint
tests/test_safety.py::test_is_nsfw
tests/test_utils/test_model_cache.py::test_cache_ordering
tests/test_utils/test_model_cache.py::test_get_existing_move_to_gpu
tests/test_utils/test_model_cache.py::test_set_cpu_full

1 tests/test_outpaint.py::test_outpainting_outpaint tests/img_processors/test_control_modes.py::test_control_images[depth-create_depth_map]
1 tests/img_processors/test_control_modes.py::test_control_images[depth-create_depth_map]
2 tests/img_processors/test_control_modes.py::test_control_images[hed-create_hed_edges]
3 tests/img_processors/test_control_modes.py::test_control_images[normal-create_normal_map]
4 tests/img_processors/test_control_modes.py::test_control_images[openpose-create_pose_map]
5 tests/img_processors/test_control_modes.py::test_control_images[qrcode-adaptive_threshold_binarize]
6 tests/modules/diffusion/test_model.py::test_nonlinearity
7 tests/test_api.py::test_cliptext_inpainting_pearl_doctor
8 tests/test_api.py::test_controlnet[canny]
9 tests/test_api.py::test_controlnet[colorize]
10 tests/test_api.py::test_controlnet[depth]
11 tests/test_api.py::test_controlnet[details]
12 tests/test_api.py::test_controlnet[edit]
13 tests/test_api.py::test_controlnet[hed]
14 tests/test_api.py::test_controlnet[inpaint]
15 tests/test_api.py::test_controlnet[normal]
16 tests/test_api.py::test_controlnet[openpose]
17 tests/test_api.py::test_controlnet[qrcode]
18 tests/test_api.py::test_controlnet[shuffle]
19 tests/test_api.py::test_imagine[ddim]
20 tests/test_api.py::test_imagine[dpmpp]
21 tests/test_api.py::test_img2img_beach_to_sunset[ddim]
22 tests/test_api.py::test_img2img_beach_to_sunset[dpmpp]
23 tests/test_api.py::test_img2img_low_noise[ddim]
24 tests/test_api.py::test_img2img_low_noise[dpmpp]
25 tests/test_api.py::test_img_to_file
26 tests/test_api.py::test_img_to_img_from_url_cats[ddim]
27 tests/test_api.py::test_img_to_img_from_url_cats[dpmpp]
28 tests/test_api.py::test_img_to_img_fruit_2_gold[ddim-0.05]
29 tests/test_api.py::test_img_to_img_fruit_2_gold[ddim-0.2]
30 tests/test_api.py::test_img_to_img_fruit_2_gold[ddim-0]
31 tests/test_api.py::test_img_to_img_fruit_2_gold[ddim-1]
32 tests/test_api.py::test_img_to_img_fruit_2_gold[dpmpp-0.05]
33 tests/test_api.py::test_img_to_img_fruit_2_gold[dpmpp-0.2]
34 tests/test_api.py::test_img_to_img_fruit_2_gold[dpmpp-0]
35 tests/test_api.py::test_img_to_img_fruit_2_gold[dpmpp-1]
36 tests/test_api.py::test_img_to_img_fruit_2_gold_repeat
37 tests/test_api.py::test_inpainting_bench
38 tests/test_api.py::test_large_image
39 tests/test_api.py::test_model_versions[SD-1.5]
40 tests/test_api.py::test_tile_mode
41 tests/test_cli/test_cmds.py::test_colorize_cmd
42 tests/test_cli/test_cmds.py::test_describe_cmd
43 tests/test_cli/test_cmds.py::test_edit_cmd
44 tests/test_cli/test_cmds.py::test_edit_demo
45 tests/test_cli/test_cmds.py::test_imagine_cmd
46 tests/test_clip_embedder.py::test_text_conditioning
47 tests/test_enhancers.py::test_clip_masking
48 tests/test_enhancers.py::test_clip_text_comparison
49 tests/test_enhancers.py::test_describe_picture
50 tests/test_enhancers.py::test_fix_faces
51 tests/test_outpaint.py::test_outpainting_outpaint tests/test_outpaint.py::test_outpainting_outpaint
52 tests/test_safety.py::test_is_nsfw
53 tests/test_utils/test_model_cache.py::test_cache_ordering
54 tests/test_utils/test_model_cache.py::test_get_existing_move_to_gpu
55 tests/test_utils/test_model_cache.py::test_set_cpu_full

View File

@ -78,6 +78,9 @@ def test_feather_tile_simple(img_ratio, tile_size, overlap_pct):
assert diff < 1 assert diff < 1
@pytest.mark.skip(
reason="takes too long. runs 5000 scenarios. if you mess with feather_tile, run this test"
)
def test_feather_tile_brute(): def test_feather_tile_brute():
source_img = pillow_img_to_torch_image( source_img = pillow_img_to_torch_image(
LazyLoadingImage(filepath=f"{TESTS_FOLDER}/data/bowl_of_fruit.jpg") LazyLoadingImage(filepath=f"{TESTS_FOLDER}/data/bowl_of_fruit.jpg")