From 244239e5f656e1f34830b8e8ce99a40decbea324 Mon Sep 17 00:00:00 2001 From: James Reynolds Date: Thu, 8 Sep 2022 05:36:33 -0600 Subject: [PATCH] =?UTF-8?q?macOS=20CI=20workflow,=20dream.py=20exits=20wit?= =?UTF-8?q?h=20an=20error,=20but=20the=20workflow=20com=E2=80=A6=20(#396)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * macOS CI workflow, dream.py exits with an error, but the workflow completes. * Files for testing Co-authored-by: James Reynolds Co-authored-by: Lincoln Stein --- .github/workflows/macos12-miniconda.yml | 80 +++++++++++++++++++++++++ tests/prompts.txt | 1 + 2 files changed, 81 insertions(+) create mode 100644 .github/workflows/macos12-miniconda.yml create mode 100644 tests/prompts.txt diff --git a/.github/workflows/macos12-miniconda.yml b/.github/workflows/macos12-miniconda.yml new file mode 100644 index 0000000000..18f21277c0 --- /dev/null +++ b/.github/workflows/macos12-miniconda.yml @@ -0,0 +1,80 @@ +name: Build +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] +jobs: + build: + strategy: + matrix: + os: [ macos-12 ] + name: Build on ${{ matrix.os }} miniconda + runs-on: ${{ matrix.os }} + steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Cache model + id: cache-sd-v1-4 + uses: actions/cache@v3 + env: + cache-name: cache-sd-v1-4 + with: + path: models/ldm/stable-diffusion-v1/model.ckpt + key: ${{ env.cache-name }} + restore-keys: | + ${{ env.cache-name }} + - name: Download Stable Diffusion v1.4 model + if: ${{ steps.cache-sd-v1-4.outputs.cache-hit != 'true' }} + continue-on-error: true + run: | + if [ ! -e models/ldm/stable-diffusion-v1 ]; then + mkdir -p models/ldm/stable-diffusion-v1 + fi + if [ ! -e models/ldm/stable-diffusion-v1/model.ckpt ]; then + curl -o models/ldm/stable-diffusion-v1/model.ckpt ${{ secrets.SD_V1_4_URL }} + fi +# Uncomment this when we no longer make changes to environment-mac.yaml +# - name: Cache environment +# id: cache-conda-env-ldm +# uses: actions/cache@v3 +# env: +# cache-name: cache-conda-env-ldm +# with: +# path: ~/.conda/envs/ldm +# key: ${{ env.cache-name }} +# restore-keys: | +# ${{ env.cache-name }} + - name: Install dependencies +# if: ${{ steps.cache-conda-env-ldm.outputs.cache-hit != 'true' }} + run: | + conda env create -f environment-mac.yaml + - name: Cache hugginface and torch models + id: cache-hugginface-torch + uses: actions/cache@v3 + env: + cache-name: cache-hugginface-torch + with: + path: ~/.cache + key: ${{ env.cache-name }} + restore-keys: | + ${{ env.cache-name }} + - name: Download Huggingface and Torch models + if: ${{ steps.cache-hugginface-torch.outputs.cache-hit != 'true' }} + continue-on-error: true + run: | + export PYTHON_BIN=/usr/local/miniconda/envs/ldm/bin/python + $PYTHON_BIN scripts/preload_models.py + - name: Run the tests + run: | + # Note, can't "activate" via automation, and activation is just env vars and path + export PYTHON_BIN=/usr/local/miniconda/envs/ldm/bin/python + export PYTORCH_ENABLE_MPS_FALLBACK=1 + $PYTHON_BIN scripts/preload_models.py + mkdir -p outputs/img-samples + time $PYTHON_BIN scripts/dream.py --from_file tests/prompts.txt outputs/img-samples/err.log > outputs/img-samples/out.log + - name: Archive results + uses: actions/upload-artifact@v3 + with: + name: results + path: outputs/img-samples \ No newline at end of file diff --git a/tests/prompts.txt b/tests/prompts.txt new file mode 100644 index 0000000000..955220a5e6 --- /dev/null +++ b/tests/prompts.txt @@ -0,0 +1 @@ +test trending on artstation -s 1 -S 1