-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow for caching stable diffusion models (#685)
* workflow for sd models * rename and schedule weekly * rename the workflows
- Loading branch information
1 parent
d857415
commit 763b507
Showing
2 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
.github/workflows/inference_cache.yml → .github/workflows/inference_cache_llm.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Optimum neuron SD inference cache builder | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# Schedule the workflow to run every Saturday at midnight UTC | ||
- cron: '0 0 * * 6' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
|
||
jobs: | ||
cache: | ||
name: Create optimum-neuron inference cache | ||
runs-on: | ||
group: aws-inf2-8xlarge | ||
env: | ||
AWS_REGION: us-east-1 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: [stable-diffusion] | ||
steps: | ||
- name: Install Neuron runtime | ||
run: | | ||
. /etc/os-release | ||
sudo tee /etc/apt/sources.list.d/neuron.list > /dev/null <<EOF | ||
deb https://apt.repos.neuron.amazonaws.com ${VERSION_CODENAME} main | ||
EOF | ||
wget -qO - https://apt.repos.neuron.amazonaws.com/GPG-PUB-KEY-AMAZON-AWS-NEURON.PUB | sudo apt-key add - | ||
sudo apt-get update -y | ||
sudo apt-get install aws-neuronx-tools=2.18.3.0 aws-neuronx-runtime-lib=2.21.41.0-fb1705f5f aws-neuronx-collectives=2.21.46.0-69b77134b -y | ||
export PATH=/opt/aws/neuron/bin:$PATH | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Install python and create venv | ||
run: | | ||
sudo apt install python3-venv python3-dev -y | ||
python3 -m venv aws_neuron_venv_pytorch | ||
source aws_neuron_venv_pytorch/bin/activate | ||
python -m pip install -U pip | ||
python -m pip config set global.extra-index-url https://pip.repos.neuron.amazonaws.com | ||
- name: Install optimum neuron | ||
run: | | ||
source aws_neuron_venv_pytorch/bin/activate | ||
python -m pip install .[neuronx] | ||
- name: Create cache for ${{matrix.config}} models | ||
run: | | ||
source aws_neuron_venv_pytorch/bin/activate | ||
config_prefix_url=https://huggingface.co/aws-neuron/optimum-neuron-cache/raw/main/inference-cache-config | ||
HF_TOKEN=${{secrets.HF_TOKEN_OPTIMUM_NEURON_CACHE}} \ | ||
python tools/auto_fill_inference_cache.py --config_file ${config_prefix_url}/${{matrix.config}}.json |