Commit ·
2dee1ec
1
Parent(s): e7b1387
Files changed (2)
- launch.py+1-3
- modules/launch_util.py+22-30
1 unmodified line234567812 unmodified lines2122232425262728293031321 unmodified lineimport sysimport platformfrom modules.launch_util import commit_hash, fooocus_tag, is_installed, run, python, \run_pip, repo_dir, git_clone, requirements_met, script_path, dir_reposfrom modules.model_loader import load_file_from_urlfrom modules.path import modelfile_path, lorafile_path12 unmodified linescomfy_repo = os.environ.get('COMFY_REPO', "https://github.com/comfyanonymous/ComfyUI")comfy_commit_hash = os.environ.get('COMFY_COMMIT_HASH', "2bc12d3d22efb5c63ae3a7fc342bb2dd16b31735")commit = commit_hash()tag = fooocus_tagprint(f"Python {sys.version}")print(f"Version: {tag}")print(f"Commit hash: {commit}")comfyui_name = 'ComfyUI-from-StabilityAI-Official'git_clone(comfy_repo, repo_dir(comfyui_name), "Inference Engine", comfy_commit_hash)1 unmodified line234567812 unmodified lines212223242526272829301 unmodified lineimport sysimport platformfrom modules.launch_util import fooocus_tag, is_installed, run, python, \run_pip, repo_dir, git_clone, requirements_met, script_path, dir_reposfrom modules.model_loader import load_file_from_urlfrom modules.path import modelfile_path, lorafile_path12 unmodified linescomfy_repo = os.environ.get('COMFY_REPO', "https://github.com/comfyanonymous/ComfyUI")comfy_commit_hash = os.environ.get('COMFY_COMMIT_HASH', "2bc12d3d22efb5c63ae3a7fc342bb2dd16b31735")tag = fooocus_tagprint(f"Python {sys.version}")print(f"Version: {tag}")comfyui_name = 'ComfyUI-from-StabilityAI-Official'git_clone(comfy_repo, repo_dir(comfyui_name), "Inference Engine", comfy_commit_hash)
1234567891011121314151617184 unmodified lines2324252627282930313233343536373839404142434445464748495051525354555657import osimport importlibimport importlib.utilimport subprocessimport sysimport reimport loggingfrom functools import lru_cachelogging.getLogger("torch.distributed.nn").setLevel(logging.ERROR) # sshh...logging.getLogger("xformers").addFilter(lambda record: 'A matching Triton is not available' not in record.getMessage())python = sys.executablegit = os.environ.get('GIT', "git")default_command_live = (os.environ.get('LAUNCH_LIVE_OUTPUT') == "1")index_url = os.environ.get('INDEX_URL', "")4 unmodified linesfooocus_tag = '1.0.0'@lru_cache()def commit_hash():try:return subprocess.check_output([git, "rev-parse", "HEAD"], shell=False, encoding='utf8').strip()except Exception:return "<none>"def git_clone(url, dir, name, commithash=None):# TODO clone into temporary dir and move if successfulif os.path.exists(dir):if commithash is None:returncurrent_hash = run(f'"{git}" -C "{dir}" rev-parse HEAD', None,f"Couldn't determine {name}'s hash: {commithash}", live=False).strip()if current_hash == commithash:returnrun(f'"{git}" -C "{dir}" fetch', f"Fetching updates for {name}...", f"Couldn't fetch {name}")run(f'"{git}" -C "{dir}" checkout {commithash}', f"Checking out commit for {name} with hash: {commithash}...",f"Couldn't checkout commit {commithash} for {name}", live=True)returnrun(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}", live=True)if commithash is not None:run(f'"{git}" -C "{dir}" checkout {commithash}', None, "Couldn't checkout {name}'s hash: {commithash}")def repo_dir(name):1234567891011121314151617184 unmodified lines232425262728293031323334353637383940414243444546474849import osimport importlibimport importlib.utilimport shutilimport subprocessimport sysimport reimport loggingimport pygit2logging.getLogger("torch.distributed.nn").setLevel(logging.ERROR) # sshh...logging.getLogger("xformers").addFilter(lambda record: 'A matching Triton is not available' not in record.getMessage())python = sys.executabledefault_command_live = (os.environ.get('LAUNCH_LIVE_OUTPUT') == "1")index_url = os.environ.get('INDEX_URL', "")4 unmodified linesfooocus_tag = '1.0.0'def git_clone(url, dir, name, hash=None):try:try:repo = pygit2.Repository(dir)print(f'{name} exists.')except:if os.path.exists(dir):shutil.rmtree(dir, ignore_errors=True)os.makedirs(dir, exist_ok=True)repo = pygit2.clone_repository(url, dir)print(f'{name} cloned.')remote = repo.remotes['origin']remote.fetch()commit = repo.get(hash)repo.checkout_tree(commit, strategy=pygit2.GIT_CHECKOUT_FORCE)print(f'{name} checkout finished.')except Exception as e:print(f'Git clone failed for {name}: {str(e)}')def repo_dir(name):
launch.py+1-3
modules/launch_util.py+22-30