DegMaTsu commited on
Commit
5fb5cb2
·
verified ·
1 Parent(s): 96b4edd

Upload 8 files

Browse files
.ci/update_windows/update.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pygit2
2
+ from datetime import datetime
3
+ import sys
4
+ import os
5
+ import shutil
6
+ import filecmp
7
+
8
+ def pull(repo, remote_name='origin', branch='master'):
9
+ for remote in repo.remotes:
10
+ if remote.name == remote_name:
11
+ remote.fetch()
12
+ remote_master_id = repo.lookup_reference('refs/remotes/origin/%s' % (branch)).target
13
+ merge_result, _ = repo.merge_analysis(remote_master_id)
14
+ # Up to date, do nothing
15
+ if merge_result & pygit2.GIT_MERGE_ANALYSIS_UP_TO_DATE:
16
+ return
17
+ # We can just fastforward
18
+ elif merge_result & pygit2.GIT_MERGE_ANALYSIS_FASTFORWARD:
19
+ repo.checkout_tree(repo.get(remote_master_id))
20
+ try:
21
+ master_ref = repo.lookup_reference('refs/heads/%s' % (branch))
22
+ master_ref.set_target(remote_master_id)
23
+ except KeyError:
24
+ repo.create_branch(branch, repo.get(remote_master_id))
25
+ repo.head.set_target(remote_master_id)
26
+ elif merge_result & pygit2.GIT_MERGE_ANALYSIS_NORMAL:
27
+ repo.merge(remote_master_id)
28
+
29
+ if repo.index.conflicts is not None:
30
+ for conflict in repo.index.conflicts:
31
+ print('Conflicts found in:', conflict[0].path) # noqa: T201
32
+ raise AssertionError('Conflicts, ahhhhh!!')
33
+
34
+ user = repo.default_signature
35
+ tree = repo.index.write_tree()
36
+ repo.create_commit('HEAD',
37
+ user,
38
+ user,
39
+ 'Merge!',
40
+ tree,
41
+ [repo.head.target, remote_master_id])
42
+ # We need to do this or git CLI will think we are still merging.
43
+ repo.state_cleanup()
44
+ else:
45
+ raise AssertionError('Unknown merge analysis result')
46
+
47
+ pygit2.option(pygit2.GIT_OPT_SET_OWNER_VALIDATION, 0)
48
+ repo_path = str(sys.argv[1])
49
+ repo = pygit2.Repository(repo_path)
50
+ ident = pygit2.Signature('comfyui', 'comfy@ui')
51
+ try:
52
+ print("stashing current changes") # noqa: T201
53
+ repo.stash(ident)
54
+ except KeyError:
55
+ print("nothing to stash") # noqa: T201
56
+ backup_branch_name = 'backup_branch_{}'.format(datetime.today().strftime('%Y-%m-%d_%H_%M_%S'))
57
+ print("creating backup branch: {}".format(backup_branch_name)) # noqa: T201
58
+ try:
59
+ repo.branches.local.create(backup_branch_name, repo.head.peel())
60
+ except:
61
+ pass
62
+
63
+ print("checking out master branch") # noqa: T201
64
+ branch = repo.lookup_branch('master')
65
+ if branch is None:
66
+ ref = repo.lookup_reference('refs/remotes/origin/master')
67
+ repo.checkout(ref)
68
+ branch = repo.lookup_branch('master')
69
+ if branch is None:
70
+ repo.create_branch('master', repo.get(ref.target))
71
+ else:
72
+ ref = repo.lookup_reference(branch.name)
73
+ repo.checkout(ref)
74
+
75
+ print("pulling latest changes") # noqa: T201
76
+ pull(repo)
77
+
78
+ if "--stable" in sys.argv:
79
+ def latest_tag(repo):
80
+ versions = []
81
+ for k in repo.references:
82
+ try:
83
+ prefix = "refs/tags/v"
84
+ if k.startswith(prefix):
85
+ version = list(map(int, k[len(prefix):].split(".")))
86
+ versions.append((version[0] * 10000000000 + version[1] * 100000 + version[2], k))
87
+ except:
88
+ pass
89
+ versions.sort()
90
+ if len(versions) > 0:
91
+ return versions[-1][1]
92
+ return None
93
+ latest_tag = latest_tag(repo)
94
+ if latest_tag is not None:
95
+ repo.checkout(latest_tag)
96
+
97
+ print("Done!") # noqa: T201
98
+
99
+ self_update = True
100
+ if len(sys.argv) > 2:
101
+ self_update = '--skip_self_update' not in sys.argv
102
+
103
+ update_py_path = os.path.realpath(__file__)
104
+ repo_update_py_path = os.path.join(repo_path, ".ci/update_windows/update.py")
105
+
106
+ cur_path = os.path.dirname(update_py_path)
107
+
108
+
109
+ req_path = os.path.join(cur_path, "current_requirements.txt")
110
+ repo_req_path = os.path.join(repo_path, "requirements.txt")
111
+
112
+
113
+ def files_equal(file1, file2):
114
+ try:
115
+ return filecmp.cmp(file1, file2, shallow=False)
116
+ except:
117
+ return False
118
+
119
+ def file_size(f):
120
+ try:
121
+ return os.path.getsize(f)
122
+ except:
123
+ return 0
124
+
125
+
126
+ if self_update and not files_equal(update_py_path, repo_update_py_path) and file_size(repo_update_py_path) > 10:
127
+ shutil.copy(repo_update_py_path, os.path.join(cur_path, "update_new.py"))
128
+ exit()
129
+
130
+ if not os.path.exists(req_path) or not files_equal(repo_req_path, req_path):
131
+ import subprocess
132
+ try:
133
+ subprocess.check_call([sys.executable, '-s', '-m', 'pip', 'install', '-r', repo_req_path])
134
+ shutil.copy(repo_req_path, req_path)
135
+ except:
136
+ pass
137
+
138
+
139
+ stable_update_script = os.path.join(repo_path, ".ci/update_windows/update_comfyui_stable.bat")
140
+ stable_update_script_to = os.path.join(cur_path, "update_comfyui_stable.bat")
141
+
142
+ try:
143
+ if not file_size(stable_update_script_to) > 10:
144
+ shutil.copy(stable_update_script, stable_update_script_to)
145
+ except:
146
+ pass
.ci/update_windows/update_comfyui.bat ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ ..\python_embeded\python.exe .\update.py ..\ComfyUI\
3
+ if exist update_new.py (
4
+ move /y update_new.py update.py
5
+ echo Running updater again since it got updated.
6
+ ..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update
7
+ )
8
+ if "%~1"=="" pause
.ci/update_windows/update_comfyui_stable.bat ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ ..\python_embeded\python.exe .\update.py ..\ComfyUI\ --stable
3
+ if exist update_new.py (
4
+ move /y update_new.py update.py
5
+ echo Running updater again since it got updated.
6
+ ..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --stable
7
+ )
8
+ if "%~1"=="" pause
.ci/windows_base_files/README_VERY_IMPORTANT.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ HOW TO RUN:
2
+
3
+ if you have a NVIDIA gpu:
4
+
5
+ run_nvidia_gpu.bat
6
+
7
+
8
+
9
+ To run it in slow CPU mode:
10
+
11
+ run_cpu.bat
12
+
13
+
14
+
15
+ IF YOU GET A RED ERROR IN THE UI MAKE SURE YOU HAVE A MODEL/CHECKPOINT IN: ComfyUI\models\checkpoints
16
+
17
+ You can download the stable diffusion 1.5 one from: https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/blob/main/v1-5-pruned-emaonly-fp16.safetensors
18
+
19
+
20
+ RECOMMENDED WAY TO UPDATE:
21
+ To update the ComfyUI code: update\update_comfyui.bat
22
+
23
+
24
+
25
+ To update ComfyUI with the python dependencies, note that you should ONLY run this if you have issues with python dependencies.
26
+ update\update_comfyui_and_python_dependencies.bat
27
+
28
+
29
+ TO SHARE MODELS BETWEEN COMFYUI AND ANOTHER UI:
30
+ In the ComfyUI directory you will find a file: extra_model_paths.yaml.example
31
+ Rename this file to: extra_model_paths.yaml and edit it with your favorite text editor.
.ci/windows_base_files/run_cpu.bat ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .\python_embeded\python.exe -s ComfyUI\main.py --cpu --windows-standalone-build
2
+ pause
.ci/windows_base_files/run_nvidia_gpu.bat ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
2
+ pause
.ci/windows_nightly_base_files/run_nvidia_gpu_fast.bat ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --fast
2
+ pause
.ci/windows_nightly_base_files/run_nvidia_gpu_fast_fp16_accumulation.bat ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ .\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --fast fp16_accumulation
2
+ pause