test: try local runner

This commit is contained in:
Bryce 2023-12-03 07:02:57 -08:00 committed by Bryce Drennan
parent 0fe3733933
commit 6fcf0da331
5 changed files with 61 additions and 41 deletions

View File

@ -54,12 +54,12 @@ jobs:
run: |
black --diff --fast .
test:
runs-on: ubuntu-latest
runs-on: [self-hosted, cuda]
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
subset: ["1/10", "2/10", "3/10", "4/10", "5/10", "6/10", "7/10", "8/10", "9/10", "10/10"]
# subset: ["1/10", "2/10", "3/10", "4/10", "5/10", "6/10", "7/10", "8/10", "9/10", "10/10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
@ -71,44 +71,44 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -r requirements-dev.txt .
- name: Get current date
id: date
run: echo "::set-output name=curmonth::$(date +'%Y-%m')"
- name: Cache Model Files
id: cache-model-files
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ steps.date.outputs.curmonth }}-b
# - name: Get current date
# id: date
# run: echo "::set-output name=curmonth::$(date +'%Y-%m')"
# - name: Cache Model Files
# id: cache-model-files
# uses: actions/cache/restore@v3
# with:
# path: ${{ env.CACHE_PATHS }}
# key: ${{ steps.date.outputs.curmonth }}-b
# Generate initial file list for all directories
- name: Generate initial model file list
run: |
for dir in $CACHE_PATHS; do
if [ -d "$dir" ]; then
find $dir
fi
done > initial_file_list.txt
# - name: Generate initial model file list
# run: |
# for dir in $CACHE_PATHS; do
# if [ -d "$dir" ]; then
# find $dir
# fi
# done > initial_file_list.txt
- name: Test with pytest
timeout-minutes: 20
timeout-minutes: 30
run: |
pytest --durations=50 -v --subset ${{ matrix.subset }}
pytest --durations=10 -v
# Generate final file list and check for new files
- name: Generate final model file list
run: |
for dir in CACHE_PATHS; do
if [ -d "$dir" ]; then
find $dir
fi
done > final_file_list.txt
if ! diff initial_file_list.txt final_file_list.txt > /dev/null; then
echo "New files detected."
echo "new_files=true" >> $GITHUB_ENV
else
echo "No new files detected."
fi
- uses: actions/cache/save@v3
id: cache
if: env.new_files == 'true'
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ steps.date.outputs.curmonth }}-b
# - name: Generate final model file list
# run: |
# for dir in CACHE_PATHS; do
# if [ -d "$dir" ]; then
# find $dir
# fi
# done > final_file_list.txt
# if ! diff initial_file_list.txt final_file_list.txt > /dev/null; then
# echo "New files detected."
# echo "new_files=true" >> $GITHUB_ENV
# else
# echo "No new files detected."
# fi
# - uses: actions/cache/save@v3
# id: cache
# if: env.new_files == 'true'
# with:
# path: ${{ env.CACHE_PATHS }}
# key: ${{ steps.date.outputs.curmonth }}-b

View File

@ -12,6 +12,7 @@
- allow selection of output video format
- chain multiple operations together imggen => videogen
- make sure terminal output on windows doesn't suck
- add karras schedule to refiners
### Old Todo

View File

@ -10,7 +10,7 @@ import responses
from tqdm import tqdm
from urllib3 import HTTPConnectionPool
from imaginairy import api
from imaginairy import ImaginePrompt, api, imagine
from imaginairy.log_utils import configure_logging, suppress_annoying_logs_and_warnings
from imaginairy.samplers import SAMPLER_TYPE_OPTIONS
from imaginairy.utils import (
@ -110,6 +110,24 @@ def pytest_addoption(parser):
)
@pytest.fixture(scope="session")
def default_model_loaded():
"""
Just to make sure default weights are downloaded before the test runs
"""
prompt = ImaginePrompt(
"dogs lying on a hot pink couch",
width=64,
height=64,
steps=2,
seed=1,
sampler_type="ddim",
)
next(imagine(prompt))
@pytest.hookimpl()
def pytest_collection_modifyitems(config, items):
"""Only select a subset of tests to run, based on the --subset option."""

View File

@ -1,4 +1,4 @@
extend-ignore = ["E501", "G004", "PT005", "RET504", "SIM114", "TRY003", "TRY400", "TRY401", "RUF012", "RUF100"]
extend-ignore = ["E501", "G004", "PT004", "PT005", "RET504", "SIM114", "TRY003", "TRY400", "TRY401", "RUF012", "RUF100"]
extend-exclude = ["imaginairy/vendored", "downloads", "other"]
extend-select = [

View File

@ -95,6 +95,7 @@ def test_img_to_img_from_url_cats(
filename_base_for_outputs,
mocked_responses,
filename_base_for_orig_outputs,
default_model_loaded,
):
with open(
os.path.join(TESTS_FOLDER, "data", "val2017-000000039769-cococats.jpg"), "rb"