Skip to content

Commit

Permalink
[Rebase Mirror Onto] Mixed precision diffusion models with scaled fp8.
Browse files Browse the repository at this point in the history
This change allows supports for diffusion models where all the linears are
scaled fp8 while the other weights are the original precision.
  • Loading branch information
Comfy-Org Mirror Autopull Bot committed Oct 21, 2024
1 parent 0075c6d commit 9533507
Show file tree
Hide file tree
Showing 7 changed files with 337 additions and 3 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@

name: "Release Stable Version"

on:
workflow_dispatch:
inputs:
git_tag:
description: 'Git tag'
required: true
type: string
cu:
description: 'CUDA version'
required: true
type: string
default: "124"
python_minor:
description: 'Python minor version'
required: true
type: string
default: "11"
python_patch:
description: 'Python patch version'
required: true
type: string
default: "9"


jobs:
package_comfy_windows:
permissions:
contents: "write"
packages: "write"
pull-requests: "read"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.git_tag }}
fetch-depth: 0
persist-credentials: false
- uses: actions/cache/restore@v4
id: cache
with:
path: |
cu${{ inputs.cu }}_python_deps.tar
update_comfyui_and_python_dependencies.bat
key: ${{ runner.os }}-build-cu${{ inputs.cu }}-${{ inputs.python_minor }}
- shell: bash
run: |
mv cu${{ inputs.cu }}_python_deps.tar ../
mv update_comfyui_and_python_dependencies.bat ../
cd ..
tar xf cu${{ inputs.cu }}_python_deps.tar
pwd
ls
- shell: bash
run: |
cd ..
cp -r ComfyUI ComfyUI_copy
curl https://www.python.org/ftp/python/3.${{ inputs.python_minor }}.${{ inputs.python_patch }}/python-3.${{ inputs.python_minor }}.${{ inputs.python_patch }}-embed-amd64.zip -o python_embeded.zip
unzip python_embeded.zip -d python_embeded
cd python_embeded
echo ${{ env.MINOR_VERSION }}
echo 'import site' >> ./python3${{ inputs.python_minor }}._pth
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
./python.exe get-pip.py
./python.exe -s -m pip install ../cu${{ inputs.cu }}_python_deps/*
sed -i '1i../ComfyUI' ./python3${{ inputs.python_minor }}._pth
cd ..
git clone https://github.com/comfyanonymous/taesd
cp taesd/*.pth ./ComfyUI_copy/models/vae_approx/
mkdir ComfyUI_windows_portable
mv python_embeded ComfyUI_windows_portable
mv ComfyUI_copy ComfyUI_windows_portable/ComfyUI
cd ComfyUI_windows_portable
mkdir update
cp -r ComfyUI/.ci/update_windows/* ./update/
cp -r ComfyUI/.ci/windows_base_files/* ./
cp ../update_comfyui_and_python_dependencies.bat ./update/
cd ..
"C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=8 -mfb=64 -md=32m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable
mv ComfyUI_windows_portable.7z ComfyUI/ComfyUI_windows_portable_nvidia.7z
cd ComfyUI_windows_portable
python_embeded/python.exe -s ComfyUI/main.py --quick-test-for-ci --cpu
ls
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ComfyUI_windows_portable_nvidia.7z
tag: ${{ inputs.git_tag }}
overwrite: true
prerelease: true
make_latest: false
4 changes: 2 additions & 2 deletions .github/workflows/stable-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- shell: bash
run: |
cd ..
cp -r ComfyUI ComfyUI_copy
cp -r ${{ github.event.repository.name }} ComfyUI_copy
curl https://www.python.org/ftp/python/3.${{ inputs.python_minor }}.${{ inputs.python_patch }}/python-3.${{ inputs.python_minor }}.${{ inputs.python_patch }}-embed-amd64.zip -o python_embeded.zip
unzip python_embeded.zip -d python_embeded
cd python_embeded
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
cd ..
"C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma2 -mx=8 -mfb=64 -md=32m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable
mv ComfyUI_windows_portable.7z ComfyUI/ComfyUI_windows_portable_nvidia.7z
mv ComfyUI_windows_portable.7z ${{ github.event.repository.name }}/ComfyUI_windows_portable_nvidia.7z
cd ComfyUI_windows_portable
python_embeded/python.exe -s ComfyUI/main.py --quick-test-for-ci --cpu
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/test-workflows-windows-custom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Use Custom Runner Target To Test ComfyUI Windows with Default Workflow
on:
workflow_dispatch:
inputs:
runs_on:
description: 'What runners to run this test on'
required: false
default: 'win'

jobs:
test-action:
runs-on: ${{ inputs.runs_on }}
steps:
- name: Use ComfyUI GitHub Action
uses: comfy-org/comfy-action@monkeytest
with:
os: windows
cuda_version: 12.1
workflow_filenames: 'default.json'
gcs_bucket_name: 'comfy-ci-results'
google_credentials: ${{ secrets.GCS_SERVICE_ACCOUNT_JSON }}
output_prefix: 'ComfyUI'
timeout: 50
# api_endpoint: http://localhost:8080/upload-artifact
91 changes: 91 additions & 0 deletions .github/workflows/test-workflows-with-manual-input.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Test ComfyUI Workflows Manual
on:
workflow_dispatch:
inputs:
os:
description: 'Operating System'
required: true
default: 'macos'
type: choice
options:
- macos
- linux
- win
runner_label:
description: 'Runner Label'
required: false
default: 'self-hosted'
type: string
python_version:
description: 'Python Version'
required: true
default: '3.9'
type: choice
options:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- other
python_version_number:
description: 'Specify your own Python Version Number, e.g. 3.9.12'
required: false
default: '3.9'
type: string
cuda_version:
description: 'CUDA Version, currently only 12.1 is supported'
required: true
default: '12.1'
type: choice
options:
- '12.1'
torch_version:
description: 'Torch Version'
required: true
default: 'stable'
type: choice
options:
- stable
- preview
- other
torch_version_number:
description: 'Torch Version Number'
required: false
default: '2.3.1'
type: string
comfyui_flags:
description: 'ComfyUI Flags'
required: false
default: '--force-fp16'
type: string
workflow_filenames:
description: 'Workflow Filenames'
required: false
default: 'default.json,lora.json'
type: string
workflow_raw_json:
description: 'Workflow Raw JSON (Not yet supported)'
required: false
default: ''
type: string





jobs:
test-default-workflow:
runs-on: ${{ inputs.runner_label }}
steps:
- name: Test Default Workflow
uses: comfy-org/comfy-action@main
with:
os: ${{ inputs.os }}
python_version: ${{ (contains(inputs.python_version, "other") && inputs.python_version_number != '' ) && inputs.python_version_number || inputs.python_version}}
cuda_version: ${{ inputs.cuda_version }}
torch_version: ${{ (contains(inputs.torch_version, "other") && inputs.torch_version_number != '' ) && inputs.torch_version_number || inputs.torch_version}}
workflow_filenames: "default.json,lora.json"
workflow_raw_json: ${{ inputs.workflow_raw_json }}
google_credentials: ${{ secrets.GCS_SERVICE_ACCOUNT_JSON }}
timeout: 50
2 changes: 1 addition & 1 deletion .github/workflows/windows_release_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- shell: bash
run: |
cd ..
cp -r ComfyUI ComfyUI_copy
cp -r ComfyUI-Mirror ComfyUI_copy
curl https://www.python.org/ftp/python/3.${{ inputs.python_minor }}.${{ inputs.python_patch }}/python-3.${{ inputs.python_minor }}.${{ inputs.python_patch }}-embed-amd64.zip -o python_embeded.zip
unzip python_embeded.zip -d python_embeded
cd python_embeded
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/workflows-matrix-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Comfy CI Workflows Run
on:
push:
branches:
- master
paths-ignore:
- 'app/**'
- 'input/**'
- 'output/**'
- 'model/**'
- 'notebook/**'
- 'script_example/**'
- 'tests/**'
- 'tests-ui/**'
- '.github/**'
- '.ci/**'
- 'web/**'
workflow_dispatch:

jobs:
test-stable:
strategy:
fail-fast: false
matrix:
os: [macos, linux, windows]
python_version: ["3.9", "3.10", "3.11", "3.12"]
cuda_version: ["12.1"]
torch_version: ["stable"]
include:
- os: macos
runner_label: [self-hosted, macOS, m2]
flags: "--use-pytorch-cross-attention"
- os: linux
runner_label: [self-hosted, Linux, t4]
flags: ""
- os: windows
runner_label: [self-hosted, win]
flags: ""
runs-on: ${{ matrix.runner_label }}
steps:
- name: Test Workflows
uses: comfy-org/comfy-action@main
with:
os: ${{ matrix.os }}
python_version: ${{ matrix.python_version }}
torch_version: ${{ matrix.torch_version }}
google_credentials: ${{ secrets.GCS_SERVICE_ACCOUNT_JSON }}
comfyui_flags: ${{ matrix.flags }}
output_prefix: 'ComfyUI'
timeout: 50
use_prior_commit: 'true'
test-win-nightly:
strategy:
fail-fast: true
matrix:
os: [windows]
python_version: ["3.9", "3.10", "3.11", "3.12"]
cuda_version: ["12.1"]
torch_version: ["nightly"]
include:
- os: windows
runner_label: [self-hosted, win]
flags: ""
runs-on: ${{ matrix.runner_label }}
steps:
- name: Test Workflows
uses: comfy-org/comfy-action@main
with:
os: ${{ matrix.os }}
python_version: ${{ matrix.python_version }}
torch_version: ${{ matrix.torch_version }}
google_credentials: ${{ secrets.GCS_SERVICE_ACCOUNT_JSON }}
comfyui_flags: ${{ matrix.flags }}
output_prefix: 'ComfyUI'
timeout: 50
use_prior_commit: 'true'
test-unix-nightly:
strategy:
fail-fast: false
matrix:
os: [macos, linux]
python_version: ["3.11"]
cuda_version: ["12.1"]
torch_version: ["nightly"]
include:
- os: macos
runner_label: [self-hosted, macOS, m2]
flags: "--use-pytorch-cross-attention"
- os: linux
runner_label: [self-hosted, Linux, t4]
flags: ""

runs-on: ${{ matrix.runner_label }}
steps:
- name: Test Workflows
uses: comfy-org/comfy-action@main
with:
os: ${{ matrix.os }}
python_version: ${{ matrix.python_version }}
torch_version: ${{ matrix.torch_version }}
google_credentials: ${{ secrets.GCS_SERVICE_ACCOUNT_JSON }}
comfyui_flags: ${{ matrix.flags }}
output_prefix: 'ComfyUI'
timeout: 50
use_prior_commit: 'true'
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"workbench.colorCustomizations": {
"inlineChat.background": "#FFFFFF",
"inlineChatInput.background": "#FFFFFF",
"inlineChatInput.focusBorder": "#EFEFEF",
"inlineChat.regionHighlight": "#F0F0F0",
"titleBar.activeBackground": "#0D4A23",
"titleBar.activeForeground": "#F2FCF5"
}
}

0 comments on commit 9533507

Please sign in to comment.