diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..f7bc4ad9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +.git +.github +__pycache__ +*.pyc +*.pyo +*.pyd +.Python +env +pip-log.txt +pip-delete-this-directory.txt +.tox +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.log +.pytest_cache +.env +.venv +.DS_Store +tests/ +test_resources/ +assets/ \ No newline at end of file diff --git a/2024-12-06_08-56-05_snapshot.json b/2024-12-06_08-56-05_snapshot.json new file mode 100644 index 00000000..45482c89 --- /dev/null +++ b/2024-12-06_08-56-05_snapshot.json @@ -0,0 +1,312 @@ +{ + "comfyui": "a178e25912b01abf436eba1cfaab316ba02d272d", + "git_custom_nodes": { + "https://github.com/chflame163/ComfyUI_LayerStyle": { + "hash": "3375ba632434ff99dd9058126aa1a14a14c280e3", + "disabled": false + }, + "https://github.com/rgthree/rgthree-comfy": { + "hash": "70756c044d805ffc260568ca3fe9eafaed5e6363", + "disabled": false + }, + "https://github.com/theUpsider/ComfyUI-Logic": { + "hash": "42d4f3df45fb7f0dd6e2201a14c07d4dd09f235d", + "disabled": false + }, + "https://github.com/evanspearman/ComfyMath": { + "hash": "939bb813f1c0ace959b62f20bb2da47190c4e211", + "disabled": false + }, + "https://github.com/cubiq/ComfyUI_IPAdapter_plus": { + "hash": "b188a6cb39b512a9c6da7235b880af42c78ccd0d", + "disabled": false + }, + "https://github.com/SeargeDP/SeargeSDXL": { + "hash": "2eb5edbc712329d77d1a2f5f1e6c5e64397a4a83", + "disabled": false + }, + "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes": { + "hash": "d78b780ae43fcf8c6b7c6505e6ffb4584281ceca", + "disabled": false + }, + "https://github.com/Fannovel16/comfyui_controlnet_aux": { + "hash": "5a049bde9cc117dafc327cded156459289097ea1", + "disabled": false + }, + "https://github.com/ltdrdata/ComfyUI-Impact-Pack": { + "hash": "348c3dcb6b3f9e5fe42f184a01df0bb22b7bfc8d", + "disabled": false + }, + "https://github.com/ltdrdata/ComfyUI-Manager.git": { + "hash": "8b121e1352b6507c34595ae57f862328edd38ad2", + "disabled": false + } + }, + "file_custom_nodes": [ + { + "filename": "websocket_image_save.py", + "disabled": false + } + ], + "pips": { + "absl-py==2.1.0": "", + "accelerate==0.33.0": "", + "addict==2.4.0": "", + "aiohappyeyeballs==2.3.4": "", + "aiohttp==3.10.1": "", + "aiosignal==1.3.1": "", + "albucore==0.0.20": "", + "albumentations==1.4.21": "", + "annotated-types==0.7.0": "", + "antlr4-python3-runtime==4.9.3": "", + "anyio==4.4.0": "", + "argon2-cffi==23.1.0": "", + "argon2-cffi-bindings==21.2.0": "", + "arrow==1.3.0": "", + "asttokens==2.4.1": "", + "async-lru==2.0.4": "", + "attrs==23.2.0": "", + "Babel==2.15.0": "", + "beautifulsoup4==4.12.3": "", + "bleach==6.1.0": "", + "blend_modes==2.2.0": "", + "blinker==1.4": "", + "certifi==2024.7.4": "", + "cffi==1.16.0": "", + "chardet==5.2.0": "", + "charset-normalizer==3.3.2": "", + "click==8.1.7": "", + "colorlog==6.9.0": "", + "colour-science==0.4.6": "", + "comm==0.2.2": "", + "contourpy==1.3.1": "", + "cryptography==3.4.8": "", + "cssselect2==0.7.0": "", + "cycler==0.12.1": "", + "Cython==3.0.11": "", + "dbus-python==1.2.18": "", + "debugpy==1.8.2": "", + "decorator==5.1.1": "", + "defusedxml==0.7.1": "", + "Deprecated==1.2.14": "", + "diffusers==0.31.0": "", + "dill==0.3.9": "", + "distro==1.7.0": "", + "easydict==1.13": "", + "einops==0.8.0": "", + "embreex==2.17.7.post5": "", + "eval_type_backport==0.2.0": "", + "executing==2.0.1": "", + "fastjsonschema==2.20.0": "", + "filelock==3.13.1": "", + "flatbuffers==24.3.25": "", + "fonttools==4.55.1": "", + "fqdn==1.5.1": "", + "frozenlist==1.4.1": "", + "fsspec==2024.2.0": "", + "ftfy==6.3.1": "", + "fvcore==0.1.5.post20221221": "", + "gdown==5.2.0": "", + "gitdb==4.0.11": "", + "GitPython==3.1.43": "", + "gyp==0.1": "", + "h11==0.14.0": "", + "httpcore==1.0.5": "", + "httplib2==0.20.2": "", + "httpx==0.27.0": "", + "huggingface-hub==0.24.5": "", + "idna==3.7": "", + "imageio==2.36.1": "", + "importlib-metadata==4.6.4": "", + "insightface==0.7.3": "", + "iopath==0.1.10": "", + "ipykernel==6.29.5": "", + "ipython==8.26.0": "", + "ipywidgets==8.1.3": "", + "isoduration==20.11.0": "", + "jax==0.4.35": "", + "jaxlib==0.4.35": "", + "jedi==0.19.1": "", + "jeepney==0.7.1": "", + "Jinja2==3.1.3": "", + "joblib==1.4.2": "", + "json5==0.9.25": "", + "jsonpointer==3.0.0": "", + "jsonschema==4.23.0": "", + "jsonschema-specifications==2023.12.1": "", + "jupyter-events==0.10.0": "", + "jupyter-lsp==2.2.5": "", + "jupyter_client==8.6.2": "", + "jupyter_core==5.7.2": "", + "jupyter_server==2.14.2": "", + "jupyter_server_terminals==0.5.3": "", + "jupyterlab==4.2.4": "", + "jupyterlab_pygments==0.3.0": "", + "jupyterlab_server==2.27.3": "", + "jupyterlab_widgets==3.0.11": "", + "keyring==23.5.0": "", + "kiwisolver==1.4.7": "", + "kornia==0.7.3": "", + "kornia_rs==0.1.5": "", + "launchpadlib==1.10.16": "", + "lazr.restfulclient==0.14.4": "", + "lazr.uri==1.0.6": "", + "lazy_loader==0.4": "", + "llvmlite==0.43.0": "", + "loguru==0.7.2": "", + "lxml==5.3.0": "", + "manifold3d==3.0.0": "", + "mapbox_earcut==1.0.2": "", + "markdown-it-py==3.0.0": "", + "MarkupSafe==2.1.5": "", + "matplotlib==3.9.3": "", + "matplotlib-inline==0.1.7": "", + "matrix-client==0.4.0": "", + "mdurl==0.1.2": "", + "mediapipe==0.10.18": "", + "mistune==3.0.2": "", + "ml_dtypes==0.5.0": "", + "more-itertools==8.10.0": "", + "mpmath==1.3.0": "", + "multidict==6.0.5": "", + "nbclient==0.10.0": "", + "nbconvert==7.16.4": "", + "nbformat==5.10.4": "", + "nest-asyncio==1.6.0": "", + "networkx==3.2.1": "", + "notebook_shim==0.2.4": "", + "numba==0.60.0": "", + "numpy==1.26.3": "", + "nvidia-cublas-cu12==12.1.3.1": "", + "nvidia-cuda-cupti-cu12==12.1.105": "", + "nvidia-cuda-nvrtc-cu12==12.1.105": "", + "nvidia-cuda-runtime-cu12==12.1.105": "", + "nvidia-cudnn-cu12==9.1.0.70": "", + "nvidia-cufft-cu12==11.0.2.54": "", + "nvidia-curand-cu12==10.3.2.106": "", + "nvidia-cusolver-cu12==11.4.5.107": "", + "nvidia-cusparse-cu12==12.1.0.106": "", + "nvidia-nccl-cu12==2.20.5": "", + "nvidia-nvjitlink-cu12==12.1.105": "", + "nvidia-nvtx-cu12==12.1.105": "", + "oauthlib==3.2.0": "", + "OhMyRunPod==0.2.4": "", + "omegaconf==2.3.0": "", + "onnx==1.17.0": "", + "opencv-contrib-python==4.10.0.84": "", + "opencv-python==4.10.0.84": "", + "opencv-python-headless==4.10.0.84": "", + "opt_einsum==3.4.0": "", + "overrides==7.7.0": "", + "packaging==24.1": "", + "pandas==2.2.3": "", + "pandocfilters==1.5.1": "", + "parso==0.8.4": "", + "pexpect==4.9.0": "", + "piexif==1.1.3": "", + "pillow==10.2.0": "", + "platformdirs==4.2.2": "", + "portalocker==3.0.0": "", + "prettytable==3.12.0": "", + "prometheus_client==0.20.0": "", + "prompt_toolkit==3.0.47": "", + "protobuf==4.25.5": "", + "psutil==6.0.0": "", + "ptyprocess==0.7.0": "", + "pure_eval==0.2.3": "", + "py-cpuinfo==9.0.0": "", + "pycollada==0.8": "", + "pycparser==2.22": "", + "pydantic==2.10.3": "", + "pydantic_core==2.27.1": "", + "PyGithub==2.3.0": "", + "Pygments==2.18.0": "", + "PyGObject==3.42.1": "", + "PyJWT==2.9.0": "", + "PyMatting==1.1.13": "", + "PyNaCl==1.5.0": "", + "pyparsing==2.4.7": "", + "PySocks==1.7.1": "", + "python-apt==2.4.0+ubuntu3": "", + "python-dateutil==2.9.0.post0": "", + "python-json-logger==2.0.7": "", + "pytz==2024.2": "", + "PyYAML==6.0.1": "", + "pyzmq==26.0.3": "", + "referencing==0.35.1": "", + "regex==2024.7.24": "", + "reportlab==4.2.5": "", + "requests==2.32.3": "", + "rfc3339-validator==0.1.4": "", + "rfc3986-validator==0.1.1": "", + "rich==13.7.1": "", + "rpds-py==0.19.1": "", + "Rtree==1.3.0": "", + "safetensors==0.4.4": "", + "scikit-image==0.24.0": "", + "scikit-learn==1.5.2": "", + "scipy==1.14.0": "", + "seaborn==0.13.2": "", + "SecretStorage==3.3.1": "", + "segment-anything==1.0": "", + "Send2Trash==1.8.3": "", + "sentencepiece==0.2.0": "", + "shapely==2.0.6": "", + "shellingham==1.5.4": "", + "simsimd==6.2.1": "", + "six==1.16.0": "", + "smmap==5.0.1": "", + "sniffio==1.3.1": "", + "sounddevice==0.5.1": "", + "soundfile==0.12.1": "", + "soupsieve==2.5": "", + "spandrel==0.3.4": "", + "stack-data==0.6.3": "", + "stringzilla==3.11.0": "", + "svg.path==6.3": "", + "svglib==1.5.1": "", + "sympy==1.12": "", + "tabulate==0.9.0": "", + "termcolor==2.5.0": "", + "terminado==0.18.1": "", + "threadpoolctl==3.5.0": "", + "tifffile==2024.9.20": "", + "timm==1.0.12": "", + "tinycss2==1.3.0": "", + "tokenizers==0.19.1": "", + "torch==2.4.0+cu121": "", + "torchaudio==2.4.0+cu121": "", + "torchsde==0.2.6": "", + "torchvision==0.19.0+cu121": "", + "tornado==6.4.1": "", + "tqdm==4.66.4": "", + "traitlets==5.14.3": "", + "trampoline==0.1.2": "", + "transformers==4.43.4": "", + "trimesh==4.5.3": "", + "triton==3.0.0": "", + "typer==0.12.3": "", + "types-python-dateutil==2.9.0.20240316": "", + "typing_extensions==4.12.2": "", + "tzdata==2024.2": "", + "ultralytics==8.3.40": "", + "ultralytics-thop==2.0.12": "", + "uri-template==1.3.0": "", + "urllib3==1.26.19": "", + "vhacdx==0.0.8.post1": "", + "wadllib==1.3.6": "", + "wcwidth==0.2.13": "", + "webcolors==24.6.0": "", + "webencodings==0.5.1": "", + "websocket-client==1.8.0": "", + "widgetsnbextension==4.0.11": "", + "wrapt==1.16.0": "", + "xatlas==0.0.9": "", + "xformers==0.0.27.post2": "", + "xxhash==3.5.0": "", + "yacs==0.1.8": "", + "yapf==0.43.0": "", + "yarl==1.9.4": "", + "zipp==1.0.0": "" + } +} \ No newline at end of file diff --git a/src/restore_snapshot.sh b/src/restore_snapshot.sh index 73ba0685..b69e7ce5 100644 --- a/src/restore_snapshot.sh +++ b/src/restore_snapshot.sh @@ -11,6 +11,45 @@ fi echo "runpod-worker-comfy: restoring snapshot: $SNAPSHOT_FILE" -comfy --workspace /comfyui node restore-snapshot "$SNAPSHOT_FILE" --pip-non-url +# Create a temporary file to store requirements +TEMP_REQUIREMENTS=$(mktemp) +trap 'rm -f $TEMP_REQUIREMENTS' EXIT + +# Get currently installed packages with versions +CURRENT_PACKAGES=$(pip freeze) + +# Extract packages from snapshot and compare with currently installed +jq -r '.pips | to_entries[] | select(.value != "") | "\(.key)\(.value)"' "$SNAPSHOT_FILE" | while read -r package_spec; do + # Skip if package is already installed with correct version + if ! echo "$CURRENT_PACKAGES" | grep -q "^${package_spec}$"; then + # Skip certain system packages that cause conflicts + case "$package_spec" in + "python-apt"*|"gyp"*|"dbus-python"*|"PyGObject"*) + echo "runpod-worker-comfy: Skipping system package: $package_spec" + continue + ;; + esac + echo "$package_spec" >> "$TEMP_REQUIREMENTS" + else + echo "runpod-worker-comfy: Already installed: $package_spec" + fi +done + +# Install missing packages if any exist +if [ -s "$TEMP_REQUIREMENTS" ]; then + echo "runpod-worker-comfy: Installing missing packages..." + # Install packages in batches to reduce memory usage + split -l 50 "$TEMP_REQUIREMENTS" /tmp/req_chunk_ + for chunk in /tmp/req_chunk_*; do + pip install -r "$chunk" --no-cache-dir || { + echo "runpod-worker-comfy: Failed to install packages from $chunk" + cat "$chunk" + exit 1 + } + rm "$chunk" + done +else + echo "runpod-worker-comfy: No new packages to install" +fi echo "runpod-worker-comfy: restored snapshot file: $SNAPSHOT_FILE" \ No newline at end of file