Skip to content

Commit 8fe2ff4

Browse files
committed
Merge branch 'main' into v_prediction
2 parents f00d896 + af27943 commit 8fe2ff4

File tree

228 files changed

+29352
-3658
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+29352
-3658
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
contact_links:
2-
- name: Forum
3-
url: https://discuss.huggingface.co/c/discussion-related-to-httpsgithubcomhuggingfacediffusers/63
4-
about: General usage questions and community discussions
52
- name: Blank issue
63
url: https://github.com/huggingface/diffusers/issues/new
7-
about: Please note that the Forum is in most places the right place for discussions
4+
about: General usage questions and community discussions
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Set up conda environment for testing
2+
3+
description: Sets up miniconda in your ${RUNNER_TEMP} environment and gives you the ${CONDA_RUN} environment variable so you don't have to worry about polluting non-empeheral runners anymore
4+
5+
inputs:
6+
python-version:
7+
description: If set to any value, dont use sudo to clean the workspace
8+
required: false
9+
type: string
10+
default: "3.9"
11+
miniconda-version:
12+
description: Miniconda version to install
13+
required: false
14+
type: string
15+
default: "4.12.0"
16+
environment-file:
17+
description: Environment file to install dependencies from
18+
required: false
19+
type: string
20+
default: ""
21+
22+
runs:
23+
using: composite
24+
steps:
25+
# Use the same trick from https://github.com/marketplace/actions/setup-miniconda
26+
# to refresh the cache daily. This is kind of optional though
27+
- name: Get date
28+
id: get-date
29+
shell: bash
30+
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')d"
31+
- name: Setup miniconda cache
32+
id: miniconda-cache
33+
uses: actions/cache@v2
34+
with:
35+
path: ${{ runner.temp }}/miniconda
36+
key: miniconda-${{ runner.os }}-${{ runner.arch }}-${{ inputs.python-version }}-${{ steps.get-date.outputs.today }}
37+
- name: Install miniconda (${{ inputs.miniconda-version }})
38+
if: steps.miniconda-cache.outputs.cache-hit != 'true'
39+
env:
40+
MINICONDA_VERSION: ${{ inputs.miniconda-version }}
41+
shell: bash -l {0}
42+
run: |
43+
MINICONDA_INSTALL_PATH="${RUNNER_TEMP}/miniconda"
44+
mkdir -p "${MINICONDA_INSTALL_PATH}"
45+
case ${RUNNER_OS}-${RUNNER_ARCH} in
46+
Linux-X64)
47+
MINICONDA_ARCH="Linux-x86_64"
48+
;;
49+
macOS-ARM64)
50+
MINICONDA_ARCH="MacOSX-arm64"
51+
;;
52+
macOS-X64)
53+
MINICONDA_ARCH="MacOSX-x86_64"
54+
;;
55+
*)
56+
echo "::error::Platform ${RUNNER_OS}-${RUNNER_ARCH} currently unsupported using this action"
57+
exit 1
58+
;;
59+
esac
60+
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-py39_${MINICONDA_VERSION}-${MINICONDA_ARCH}.sh"
61+
curl -fsSL "${MINICONDA_URL}" -o "${MINICONDA_INSTALL_PATH}/miniconda.sh"
62+
bash "${MINICONDA_INSTALL_PATH}/miniconda.sh" -b -u -p "${MINICONDA_INSTALL_PATH}"
63+
rm -rf "${MINICONDA_INSTALL_PATH}/miniconda.sh"
64+
- name: Update GitHub path to include miniconda install
65+
shell: bash
66+
run: |
67+
MINICONDA_INSTALL_PATH="${RUNNER_TEMP}/miniconda"
68+
echo "${MINICONDA_INSTALL_PATH}/bin" >> $GITHUB_PATH
69+
- name: Setup miniconda env cache (with env file)
70+
id: miniconda-env-cache-env-file
71+
if: ${{ runner.os }} == 'macOS' && ${{ inputs.environment-file }} != ''
72+
uses: actions/cache@v2
73+
with:
74+
path: ${{ runner.temp }}/conda-python-${{ inputs.python-version }}
75+
key: miniconda-env-${{ runner.os }}-${{ runner.arch }}-${{ inputs.python-version }}-${{ steps.get-date.outputs.today }}-${{ hashFiles(inputs.environment-file) }}
76+
- name: Setup miniconda env cache (without env file)
77+
id: miniconda-env-cache
78+
if: ${{ runner.os }} == 'macOS' && ${{ inputs.environment-file }} == ''
79+
uses: actions/cache@v2
80+
with:
81+
path: ${{ runner.temp }}/conda-python-${{ inputs.python-version }}
82+
key: miniconda-env-${{ runner.os }}-${{ runner.arch }}-${{ inputs.python-version }}-${{ steps.get-date.outputs.today }}
83+
- name: Setup conda environment with python (v${{ inputs.python-version }})
84+
if: steps.miniconda-env-cache-env-file.outputs.cache-hit != 'true' && steps.miniconda-env-cache.outputs.cache-hit != 'true'
85+
shell: bash
86+
env:
87+
PYTHON_VERSION: ${{ inputs.python-version }}
88+
ENV_FILE: ${{ inputs.environment-file }}
89+
run: |
90+
CONDA_BASE_ENV="${RUNNER_TEMP}/conda-python-${PYTHON_VERSION}"
91+
ENV_FILE_FLAG=""
92+
if [[ -f "${ENV_FILE}" ]]; then
93+
ENV_FILE_FLAG="--file ${ENV_FILE}"
94+
elif [[ -n "${ENV_FILE}" ]]; then
95+
echo "::warning::Specified env file (${ENV_FILE}) not found, not going to include it"
96+
fi
97+
conda create \
98+
--yes \
99+
--prefix "${CONDA_BASE_ENV}" \
100+
"python=${PYTHON_VERSION}" \
101+
${ENV_FILE_FLAG} \
102+
cmake=3.22 \
103+
conda-build=3.21 \
104+
ninja=1.10 \
105+
pkg-config=0.29 \
106+
wheel=0.37
107+
- name: Clone the base conda environment and update GitHub env
108+
shell: bash
109+
env:
110+
PYTHON_VERSION: ${{ inputs.python-version }}
111+
CONDA_BASE_ENV: ${{ runner.temp }}/conda-python-${{ inputs.python-version }}
112+
run: |
113+
CONDA_ENV="${RUNNER_TEMP}/conda_environment_${GITHUB_RUN_ID}"
114+
conda create \
115+
--yes \
116+
--prefix "${CONDA_ENV}" \
117+
--clone "${CONDA_BASE_ENV}"
118+
# TODO: conda-build could not be cloned because it hardcodes the path, so it
119+
# could not be cached
120+
conda install --yes -p ${CONDA_ENV} conda-build=3.21
121+
echo "CONDA_ENV=${CONDA_ENV}" >> "${GITHUB_ENV}"
122+
echo "CONDA_RUN=conda run -p ${CONDA_ENV} --no-capture-output" >> "${GITHUB_ENV}"
123+
echo "CONDA_BUILD=conda run -p ${CONDA_ENV} conda-build" >> "${GITHUB_ENV}"
124+
echo "CONDA_INSTALL=conda install -p ${CONDA_ENV}" >> "${GITHUB_ENV}"
125+
- name: Get disk space usage and throw an error for low disk space
126+
shell: bash
127+
run: |
128+
echo "Print the available disk space for manual inspection"
129+
df -h
130+
# Set the minimum requirement space to 4GB
131+
MINIMUM_AVAILABLE_SPACE_IN_GB=4
132+
MINIMUM_AVAILABLE_SPACE_IN_KB=$(($MINIMUM_AVAILABLE_SPACE_IN_GB * 1024 * 1024))
133+
# Use KB to avoid floating point warning like 3.1GB
134+
df -k | tr -s ' ' | cut -d' ' -f 4,9 | while read -r LINE;
135+
do
136+
AVAIL=$(echo $LINE | cut -f1 -d' ')
137+
MOUNT=$(echo $LINE | cut -f2 -d' ')
138+
if [ "$MOUNT" = "/" ]; then
139+
if [ "$AVAIL" -lt "$MINIMUM_AVAILABLE_SPACE_IN_KB" ]; then
140+
echo "There is only ${AVAIL}KB free space left in $MOUNT, which is less than the minimum requirement of ${MINIMUM_AVAILABLE_SPACE_IN_KB}KB. Please help create an issue to PyTorch Release Engineering via https://github.com/pytorch/test-infra/issues and provide the link to the workflow run."
141+
exit 1;
142+
else
143+
echo "There is ${AVAIL}KB free space left in $MOUNT, continue"
144+
fi
145+
fi
146+
done
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build Docker images (nightly)
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * *" # every day at midnight
7+
8+
concurrency:
9+
group: docker-image-builds
10+
cancel-in-progress: false
11+
12+
env:
13+
REGISTRY: diffusers
14+
15+
jobs:
16+
build-docker-images:
17+
runs-on: ubuntu-latest
18+
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
image-name:
27+
- diffusers-pytorch-cpu
28+
- diffusers-pytorch-cuda
29+
- diffusers-flax-cpu
30+
- diffusers-flax-tpu
31+
- diffusers-onnxruntime-cpu
32+
- diffusers-onnxruntime-cuda
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v3
37+
38+
- name: Login to Docker Hub
39+
uses: docker/login-action@v2
40+
with:
41+
username: ${{ env.REGISTRY }}
42+
password: ${{ secrets.DOCKERHUB_TOKEN }}
43+
44+
- name: Build and push
45+
uses: docker/build-push-action@v3
46+
with:
47+
no-cache: true
48+
context: ./docker/${{ matrix.image-name }}
49+
push: true
50+
tags: ${{ env.REGISTRY }}/${{ matrix.image-name }}:latest

.github/workflows/build_pr_documentation.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ concurrency:
99

1010
jobs:
1111
build:
12-
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
12+
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@use_hf_hub
1313
with:
1414
commit_sha: ${{ github.event.pull_request.head.sha }}
1515
pr_number: ${{ github.event.number }}
1616
package: diffusers
17+
secrets:
18+
token: ${{ secrets.HF_DOC_PUSH }}
19+
comment_bot_token: ${{ secrets.HUGGINGFACE_PUSH }}

.github/workflows/delete_doc_comment.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ on:
77

88
jobs:
99
delete:
10-
uses: huggingface/doc-builder/.github/workflows/delete_doc_comment.yml@main
10+
uses: huggingface/doc-builder/.github/workflows/delete_doc_comment.yml@use_hf_hub
1111
with:
1212
pr_number: ${{ github.event.number }}
1313
package: diffusers
14+
secrets:
15+
token: ${{ secrets.HF_DOC_PUSH }}
16+
comment_bot_token: ${{ secrets.HUGGINGFACE_PUSH }}

.github/workflows/pr_quality.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,20 @@ jobs:
3131
isort --check-only examples tests src utils scripts
3232
flake8 examples tests src utils scripts
3333
doc-builder style src/diffusers docs/source --max_len 119 --check_only --path_to_docs docs/source
34+
35+
check_repository_consistency:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v3
39+
- name: Set up Python
40+
uses: actions/setup-python@v4
41+
with:
42+
python-version: "3.7"
43+
- name: Install dependencies
44+
run: |
45+
python -m pip install --upgrade pip
46+
pip install .[quality]
47+
- name: Check quality
48+
run: |
49+
python utils/check_copies.py
50+
python utils/check_dummies.py

0 commit comments

Comments
 (0)