mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Cache model workflow (#394)
* Add workflow that caches the model, step 1 for CI * Change name of workflow job Co-authored-by: James Reynolds <magnsuviri@me.com> Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
This commit is contained in:
parent
7996a30e3a
commit
711d49ed30
64
.github/workflows/cache-model.yml
vendored
Normal file
64
.github/workflows/cache-model.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
name: Cache Model
|
||||
on:
|
||||
workflow_dispatch
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ macos-12 ]
|
||||
name: Create Caches using ${{ matrix.os }}
|
||||
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
|
Loading…
Reference in New Issue
Block a user