Compare commits

...

5 Commits

Author SHA1 Message Date
Victor
8d01ace0b6
Merge 29142227e3 into 2307ff6746 2025-01-08 19:17:00 -05:00
comfyanonymous
2307ff6746 Improve some logging messages. 2025-01-08 19:05:22 -05:00
Victor Wong
29142227e3 Merge branch 'master' into updater-proxy 2025-01-06 21:41:06 +08:00
Victor Wong
37f38828f1 Add new line at end of file 2025-01-06 21:40:32 +08:00
Victor Wong
6a4064fd7e Allow setting http proxy in updater 2025-01-03 20:41:20 +08:00
5 changed files with 23 additions and 10 deletions

View File

@ -5,10 +5,10 @@ import os
import shutil import shutil
import filecmp import filecmp
def pull(repo, remote_name='origin', branch='master'): def pull(repo, remote_name='origin', branch='master', proxy=None):
for remote in repo.remotes: for remote in repo.remotes:
if remote.name == remote_name: if remote.name == remote_name:
remote.fetch() remote.fetch(proxy=proxy)
remote_master_id = repo.lookup_reference('refs/remotes/origin/%s' % (branch)).target remote_master_id = repo.lookup_reference('refs/remotes/origin/%s' % (branch)).target
merge_result, _ = repo.merge_analysis(remote_master_id) merge_result, _ = repo.merge_analysis(remote_master_id)
# Up to date, do nothing # Up to date, do nothing
@ -46,6 +46,14 @@ def pull(repo, remote_name='origin', branch='master'):
pygit2.option(pygit2.GIT_OPT_SET_OWNER_VALIDATION, 0) pygit2.option(pygit2.GIT_OPT_SET_OWNER_VALIDATION, 0)
repo_path = str(sys.argv[1]) repo_path = str(sys.argv[1])
proxy = None
if '--proxy' in sys.argv:
proxy_index = sys.argv.index('--proxy')
if proxy_index + 1 < len(sys.argv):
proxy = sys.argv[proxy_index + 1]
if len(proxy)<=0:
proxy = None
repo = pygit2.Repository(repo_path) repo = pygit2.Repository(repo_path)
ident = pygit2.Signature('comfyui', 'comfy@ui') ident = pygit2.Signature('comfyui', 'comfy@ui')
try: try:
@ -73,7 +81,7 @@ else:
repo.checkout(ref) repo.checkout(ref)
print("pulling latest changes") # noqa: T201 print("pulling latest changes") # noqa: T201
pull(repo) pull(repo, proxy=proxy)
if "--stable" in sys.argv: if "--stable" in sys.argv:
def latest_tag(repo): def latest_tag(repo):

View File

@ -1,8 +1,10 @@
@echo off @echo off
..\python_embeded\python.exe .\update.py ..\ComfyUI\ :: Set the http proxy here like `set proxy="http://127.0.0.1:888/"`. No spacebar allowed.
set proxy=""
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --proxy %proxy%
if exist update_new.py ( if exist update_new.py (
move /y update_new.py update.py move /y update_new.py update.py
echo Running updater again since it got updated. echo Running updater again since it got updated.
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update ..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --proxy %proxy%
) )
if "%~1"=="" pause if "%~1"=="" pause

View File

@ -1,8 +1,10 @@
@echo off @echo off
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --stable :: Set the http proxy here like `set proxy="http://127.0.0.1:888/"`. No spacebar allowed.
set proxy=""
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --proxy %proxy% --stable
if exist update_new.py ( if exist update_new.py (
move /y update_new.py update.py move /y update_new.py update.py
echo Running updater again since it got updated. echo Running updater again since it got updated.
..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --stable ..\python_embeded\python.exe .\update.py ..\ComfyUI\ --skip_self_update --proxy %proxy% --stable
) )
if "%~1"=="" pause if "%~1"=="" pause

View File

@ -111,7 +111,7 @@ class CLIP:
model_management.load_models_gpu([self.patcher], force_full_load=True) model_management.load_models_gpu([self.patcher], force_full_load=True)
self.layer_idx = None self.layer_idx = None
self.use_clip_schedule = False self.use_clip_schedule = False
logging.info("CLIP model load device: {}, offload device: {}, current: {}, dtype: {}".format(load_device, offload_device, params['device'], dtype)) logging.info("CLIP/text encoder model load device: {}, offload device: {}, current: {}, dtype: {}".format(load_device, offload_device, params['device'], dtype))
def clone(self): def clone(self):
n = CLIP(no_init=True) n = CLIP(no_init=True)
@ -898,7 +898,7 @@ def load_state_dict_guess_config(sd, output_vae=True, output_clip=True, output_c
if output_model: if output_model:
model_patcher = comfy.model_patcher.ModelPatcher(model, load_device=load_device, offload_device=model_management.unet_offload_device()) model_patcher = comfy.model_patcher.ModelPatcher(model, load_device=load_device, offload_device=model_management.unet_offload_device())
if inital_load_device != torch.device("cpu"): if inital_load_device != torch.device("cpu"):
logging.info("loaded straight to GPU") logging.info("loaded diffusion model directly to GPU")
model_management.load_models_gpu([model_patcher], force_full_load=True) model_management.load_models_gpu([model_patcher], force_full_load=True)
return (model_patcher, clip, vae, clipvision) return (model_patcher, clip, vae, clipvision)

View File

@ -4,7 +4,8 @@ lint.ignore = ["ALL"]
# Enable specific rules # Enable specific rules
lint.select = [ lint.select = [
"S307", # suspicious-eval-usage "S307", # suspicious-eval-usage
"T201", # print-usage "S102", # exec
"T", # print-usage
"W", "W",
# The "F" series in Ruff stands for "Pyflakes" rules, which catch various Python syntax errors and undefined names. # The "F" series in Ruff stands for "Pyflakes" rules, which catch various Python syntax errors and undefined names.
# See all rules here: https://docs.astral.sh/ruff/rules/#pyflakes-f # See all rules here: https://docs.astral.sh/ruff/rules/#pyflakes-f