Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
36f7face
Commit
36f7face
authored
Feb 26, 2024
by
comfyanonymous
Browse files
Update the standalone package updater so it can self update.
parent
8ac69f62
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
208 deletions
+57
-208
.ci/update_windows/update.py
.ci/update_windows/update.py
+47
-2
.ci/update_windows/update_comfyui.bat
.ci/update_windows/update_comfyui.bat
+7
-1
.ci/update_windows/update_comfyui_and_python_dependencies.bat
...update_windows/update_comfyui_and_python_dependencies.bat
+0
-3
.ci/update_windows_cu118/update_comfyui_and_python_dependencies.bat
..._windows_cu118/update_comfyui_and_python_dependencies.bat
+0
-11
.github/workflows/windows_release_cu118_dependencies.yml
.github/workflows/windows_release_cu118_dependencies.yml
+0
-71
.github/workflows/windows_release_cu118_dependencies_2.yml
.github/workflows/windows_release_cu118_dependencies_2.yml
+0
-37
.github/workflows/windows_release_cu118_package.yml
.github/workflows/windows_release_cu118_package.yml
+0
-79
.github/workflows/windows_release_dependencies.yml
.github/workflows/windows_release_dependencies.yml
+2
-3
.github/workflows/windows_release_nightly_pytorch.yml
.github/workflows/windows_release_nightly_pytorch.yml
+1
-1
No files found.
.ci/update_windows/update.py
View file @
36f7face
import
pygit2
import
pygit2
from
datetime
import
datetime
from
datetime
import
datetime
import
sys
import
sys
import
os
import
shutil
import
filecmp
def
pull
(
repo
,
remote_name
=
'origin'
,
branch
=
'master'
):
def
pull
(
repo
,
remote_name
=
'origin'
,
branch
=
'master'
):
for
remote
in
repo
.
remotes
:
for
remote
in
repo
.
remotes
:
...
@@ -42,7 +45,8 @@ def pull(repo, remote_name='origin', branch='master'):
...
@@ -42,7 +45,8 @@ def pull(repo, remote_name='origin', branch='master'):
raise
AssertionError
(
'Unknown merge analysis result'
)
raise
AssertionError
(
'Unknown merge analysis result'
)
pygit2
.
option
(
pygit2
.
GIT_OPT_SET_OWNER_VALIDATION
,
0
)
pygit2
.
option
(
pygit2
.
GIT_OPT_SET_OWNER_VALIDATION
,
0
)
repo
=
pygit2
.
Repository
(
str
(
sys
.
argv
[
1
]))
repo_path
=
str
(
sys
.
argv
[
1
])
repo
=
pygit2
.
Repository
(
repo_path
)
ident
=
pygit2
.
Signature
(
'comfyui'
,
'comfy@ui'
)
ident
=
pygit2
.
Signature
(
'comfyui'
,
'comfy@ui'
)
try
:
try
:
print
(
"stashing current changes"
)
print
(
"stashing current changes"
)
...
@@ -51,7 +55,10 @@ except KeyError:
...
@@ -51,7 +55,10 @@ except KeyError:
print
(
"nothing to stash"
)
print
(
"nothing to stash"
)
backup_branch_name
=
'backup_branch_{}'
.
format
(
datetime
.
today
().
strftime
(
'%Y-%m-%d_%H_%M_%S'
))
backup_branch_name
=
'backup_branch_{}'
.
format
(
datetime
.
today
().
strftime
(
'%Y-%m-%d_%H_%M_%S'
))
print
(
"creating backup branch: {}"
.
format
(
backup_branch_name
))
print
(
"creating backup branch: {}"
.
format
(
backup_branch_name
))
repo
.
branches
.
local
.
create
(
backup_branch_name
,
repo
.
head
.
peel
())
try
:
repo
.
branches
.
local
.
create
(
backup_branch_name
,
repo
.
head
.
peel
())
except
:
pass
print
(
"checking out master branch"
)
print
(
"checking out master branch"
)
branch
=
repo
.
lookup_branch
(
'master'
)
branch
=
repo
.
lookup_branch
(
'master'
)
...
@@ -63,3 +70,41 @@ pull(repo)
...
@@ -63,3 +70,41 @@ pull(repo)
print
(
"Done!"
)
print
(
"Done!"
)
self_update
=
True
if
len
(
sys
.
argv
)
>
2
:
self_update
=
'--skip_self_update'
not
in
sys
.
argv
update_py_path
=
os
.
path
.
realpath
(
__file__
)
repo_update_py_path
=
os
.
path
.
join
(
repo_path
,
".ci/update_windows/update.py"
)
cur_path
=
os
.
path
.
dirname
(
update_py_path
)
req_path
=
os
.
path
.
join
(
cur_path
,
"current_requirements.txt"
)
repo_req_path
=
os
.
path
.
join
(
repo_path
,
"requirements.txt"
)
def
files_equal
(
file1
,
file2
):
try
:
return
filecmp
.
cmp
(
file1
,
file2
,
shallow
=
False
)
except
:
return
False
def
file_size
(
f
):
try
:
return
os
.
path
.
getsize
(
f
)
except
:
return
0
if
self_update
and
not
files_equal
(
update_py_path
,
repo_update_py_path
)
and
file_size
(
repo_update_py_path
)
>
10
:
shutil
.
copy
(
repo_update_py_path
,
os
.
path
.
join
(
cur_path
,
"update_new.py"
))
exit
()
if
not
os
.
path
.
exists
(
req_path
)
or
not
files_equal
(
repo_req_path
,
req_path
):
import
subprocess
try
:
subprocess
.
check_call
([
sys
.
executable
,
'-m'
,
'pip'
,
'install'
,
'-r'
,
repo_req_path
])
shutil
.
copy
(
repo_req_path
,
req_path
)
except
:
pass
.ci/update_windows/update_comfyui.bat
View file @
36f7face
@echo
off
..\python_embeded\python.exe .\update.py ..\ComfyUI\
..\python_embeded\python.exe .\update.py ..\ComfyUI\
pause
if
exist
update_new
.py
(
move
/y
update_new
.py
update
.py
echo
Running
updater
again
since
it
got
updated
.
..\python_embeded\python.exe .\update.py ..\ComfyUI\
--skip
_self_update
)
if
"
%
~1"
==
""
pause
.ci/update_windows/update_comfyui_and_python_dependencies.bat
deleted
100755 → 0
View file @
8ac69f62
..\python_embeded\python.exe .\update.py ..\ComfyUI\
..\python_embeded\python.exe
-s -m
pip
install
--upgrade
torch
torchvision
torchaudio
--extra-index-url
https
://download.pytorch.org/whl/cu117
xformers
-r
../ComfyUI/requirements.txt
pygit2
pause
.ci/update_windows_cu118/update_comfyui_and_python_dependencies.bat
deleted
100755 → 0
View file @
8ac69f62
@echo
off
..\python_embeded\python.exe .\update.py ..\ComfyUI\
echo
echo
This
will
try
to
update
pytorch
and
all
python
dependencies
,
if
you
get
an
error
wait
for
pytorch
/xformers
to
fix
their
stuff
echo
You
should
not
be
running
this
anyways
unless
you
really
have
to
echo
echo
If
you
just
want
to
update
normally
,
close
this
and
run
update_comfyui
.bat
instead
.
echo
pause
..\python_embeded\python.exe
-s -m
pip
install
--upgrade
torch
torchvision
torchaudio
--extra-index-url
https
://download.pytorch.org/whl/cu118
xformers
-r
../ComfyUI/requirements.txt
pygit2
pause
.github/workflows/windows_release_cu118_dependencies.yml
deleted
100644 → 0
View file @
8ac69f62
name
:
"
Windows
Release
cu118
dependencies"
on
:
workflow_dispatch
:
# push:
# branches:
# - master
jobs
:
build_dependencies
:
env
:
# you need at least cuda 5.0 for some of the stuff compiled here.
TORCH_CUDA_ARCH_LIST
:
"
5.0+PTX
6.0
6.1
7.0
7.5
8.0
8.6
8.9"
FORCE_CUDA
:
1
MAX_JOBS
:
1
# will crash otherwise
DISTUTILS_USE_SDK
:
1
# otherwise distutils will complain on windows about multiple versions of msvc
XFORMERS_BUILD_TYPE
:
"
Release"
runs-on
:
windows-latest
steps
:
-
name
:
Cache Built Dependencies
uses
:
actions/cache@v3
id
:
cache-cu118_python_stuff
with
:
path
:
cu118_python_deps.tar
key
:
${{ runner.os }}-build-cu118
-
if
:
steps.cache-cu118_python_stuff.outputs.cache-hit != 'true'
uses
:
actions/checkout@v3
-
if
:
steps.cache-cu118_python_stuff.outputs.cache-hit != 'true'
uses
:
actions/setup-python@v4
with
:
python-version
:
'
3.10.9'
-
if
:
steps.cache-cu118_python_stuff.outputs.cache-hit != 'true'
uses
:
comfyanonymous/cuda-toolkit@test
id
:
cuda-toolkit
with
:
cuda
:
'
11.8.0'
# copied from xformers github
-
name
:
Setup MSVC
uses
:
ilammy/msvc-dev-cmd@v1
-
name
:
Configure Pagefile
# windows runners will OOM with many CUDA architectures
# we cheat here with a page file
uses
:
al-cheb/configure-pagefile-action@v1.3
with
:
minimum-size
:
2GB
# really unfortunate: https://github.com/ilammy/msvc-dev-cmd#name-conflicts-with-shell-bash
-
name
:
Remove link.exe
shell
:
bash
run
:
rm /usr/bin/link
-
if
:
steps.cache-cu118_python_stuff.outputs.cache-hit != 'true'
shell
:
bash
run
:
|
python -m pip wheel --no-cache-dir torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118 -r requirements.txt pygit2 -w ./temp_wheel_dir
python -m pip install --no-cache-dir ./temp_wheel_dir/*
echo installed basic
git clone --recurse-submodules https://github.com/facebookresearch/xformers.git
cd xformers
python -m pip install --no-cache-dir wheel setuptools twine
echo building xformers
python setup.py bdist_wheel -d ../temp_wheel_dir/
cd ..
rm -rf xformers
ls -lah temp_wheel_dir
mv temp_wheel_dir cu118_python_deps
tar cf cu118_python_deps.tar cu118_python_deps
.github/workflows/windows_release_cu118_dependencies_2.yml
deleted
100644 → 0
View file @
8ac69f62
name
:
"
Windows
Release
cu118
dependencies
2"
on
:
workflow_dispatch
:
inputs
:
xformers
:
description
:
'
xformers
version'
required
:
true
type
:
string
default
:
"
xformers"
# push:
# branches:
# - master
jobs
:
build_dependencies
:
runs-on
:
windows-latest
steps
:
-
uses
:
actions/checkout@v3
-
uses
:
actions/setup-python@v4
with
:
python-version
:
'
3.10.9'
-
shell
:
bash
run
:
|
python -m pip wheel --no-cache-dir torch torchvision torchaudio ${{ inputs.xformers }} --extra-index-url https://download.pytorch.org/whl/cu118 -r requirements.txt pygit2 -w ./temp_wheel_dir
python -m pip install --no-cache-dir ./temp_wheel_dir/*
echo installed basic
ls -lah temp_wheel_dir
mv temp_wheel_dir cu118_python_deps
tar cf cu118_python_deps.tar cu118_python_deps
-
uses
:
actions/cache/save@v3
with
:
path
:
cu118_python_deps.tar
key
:
${{ runner.os }}-build-cu118
.github/workflows/windows_release_cu118_package.yml
deleted
100644 → 0
View file @
8ac69f62
name
:
"
Windows
Release
cu118
packaging"
on
:
workflow_dispatch
:
# push:
# branches:
# - master
jobs
:
package_comfyui
:
permissions
:
contents
:
"
write"
packages
:
"
write"
pull-requests
:
"
read"
runs-on
:
windows-latest
steps
:
-
uses
:
actions/cache/restore@v3
id
:
cache
with
:
path
:
cu118_python_deps.tar
key
:
${{ runner.os }}-build-cu118
-
shell
:
bash
run
:
|
mv cu118_python_deps.tar ../
cd ..
tar xf cu118_python_deps.tar
pwd
ls
-
uses
:
actions/checkout@v3
with
:
fetch-depth
:
0
persist-credentials
:
false
-
shell
:
bash
run
:
|
cd ..
cp -r ComfyUI ComfyUI_copy
curl https://www.python.org/ftp/python/3.10.9/python-3.10.9-embed-amd64.zip -o python_embeded.zip
unzip python_embeded.zip -d python_embeded
cd python_embeded
echo 'import site' >> ./python310._pth
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
./python.exe get-pip.py
./python.exe -s -m pip install ../cu118_python_deps/*
sed -i '1i../ComfyUI' ./python310._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/update_windows_cu118/* ./update/
cp -r ComfyUI/.ci/windows_base_files/* ./
cd ..
"C:\Program Files\7-Zip\7z.exe" a -t7z -m0=lzma -mx=8 -mfb=64 -md=32m -ms=on -mf=BCJ2 ComfyUI_windows_portable.7z ComfyUI_windows_portable
mv ComfyUI_windows_portable.7z ComfyUI/new_ComfyUI_windows_portable_nvidia_cu118_or_cpu.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
:
new_ComfyUI_windows_portable_nvidia_cu118_or_cpu.7z
tag
:
"
latest"
overwrite
:
true
.github/workflows/windows_release_dependencies.yml
View file @
36f7face
...
@@ -41,10 +41,9 @@ jobs:
...
@@ -41,10 +41,9 @@ jobs:
-
shell
:
bash
-
shell
:
bash
run
:
|
run
:
|
echo "@echo off
echo "@echo off
..\python_embeded\python.exe .\update.py ..\ComfyUI\\
call update_comfyui.bat nopause
echo -
echo -
echo This will try to update pytorch and all python dependencies, if you get an error wait for pytorch/xformers to fix their stuff
echo This will try to update pytorch and all python dependencies.
echo You should not be running this anyways unless you really have to
echo -
echo -
echo If you just want to update normally, close this and run update_comfyui.bat instead.
echo If you just want to update normally, close this and run update_comfyui.bat instead.
echo -
echo -
...
...
.github/workflows/windows_release_nightly_pytorch.yml
View file @
36f7face
...
@@ -68,7 +68,7 @@ jobs:
...
@@ -68,7 +68,7 @@ jobs:
cp -r ComfyUI/.ci/update_windows/* ./update/
cp -r ComfyUI/.ci/update_windows/* ./update/
cp -r ComfyUI/.ci/windows_base_files/* ./
cp -r ComfyUI/.ci/windows_base_files/* ./
echo "
..\python_embeded\python.exe .\update.py ..\ComfyUI\\
echo "
call update_comfyui.bat nopause
..\python_embeded\python.exe -s -m pip install --upgrade --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu${{ inputs.cu }} -r ../ComfyUI/requirements.txt pygit2
..\python_embeded\python.exe -s -m pip install --upgrade --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cu${{ inputs.cu }} -r ../ComfyUI/requirements.txt pygit2
pause" > ./update/update_comfyui_and_python_dependencies.bat
pause" > ./update/update_comfyui_and_python_dependencies.bat
cd ..
cd ..
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment