ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

setup.py, OpenAPI support

Open doctorpangloss opened this issue 2 years ago • 1 comments

This includes the setup.py changes:

  • setup.py now works
  • xformers is never installed by setup.py, because torch 2.0.1 makes it redundant and you specified scaled_dot_product_attention
  • Makes installation work a variety of ways, including making other packages dependent on this one for e.g. plugins
  • Fixes missing init.py issues (you addressed this)
  • Fixes imports (you addressed this)
  • Compatible with your existing scripts that rely on requirements.txt
  • Fixes error in comfy/ldm/models/diffusion/ddim.py
  • Fixes missing packages for other diffusers code in this repo

This doesn't mess up your CI/CD automations. Those will correctly install the latest / nightlies as you configured them too.

The extra version numbers in requirements.txt should eliminate the inevitable situation where users will try to install the package and get an incompatible or subtly broken version of a package.

Creates two new api endpoints documented in the openapi.yaml. These are ergonomic for common usage like batches or using from other applications.

doctorpangloss avatar Mar 28 '23 03:03 doctorpangloss

This looks really good (worked well for me).

tildebyte avatar Jun 23 '23 22:06 tildebyte

This is now tested on fairly complex setups except AMD DirectML on Windows. I will try that on my AMD Windows station later. Additionally, PyTorch 2.1+ nightlies are now the default for all accelerators I tested (Windows NVIDIA, Windows CPU, Linux NVIDIA, Linux AMD, macOS Apple Silicon). This leaves Windows AMD and macOS AMD to test.

doctorpangloss avatar Aug 02 '23 22:08 doctorpangloss

PyTorch 2.1+ nightlies

Looks like for NVidia, I currently get torch@https://download.pytorch.org/whl/cu118/torch-2.0.1%2Bcu118-cp311-cp311-win_amd64.whl (the url in setup.py is for torch 2.0.1 and CUDA 11.8) when I run pip install -e ., not 2.1+nightly (unless maybe there's a dependency which I'm not seeing which causes torch==2.1)

tildebyte avatar Aug 03 '23 01:08 tildebyte

That's the error! I accidentally left out that commit, I'll tie up my other work shortly and tidy this up.

doctorpangloss avatar Aug 03 '23 03:08 doctorpangloss

This PR makes a large amount of unrelated changes that makes it extremely difficult to review or accept, eg reformatting of unrelated code. Could you please resubmit only the core/relevant changes needed for your goal here?

(EDIT: Discussion happening about this on Matrix now)

mcmonkey4eva avatar Aug 14 '23 21:08 mcmonkey4eva

Just to throw this out there - I've been running Comfy with this setup and (important part) Python 3.11 for weeks now without issue.

Unrelated, but, if I were a reviewer here, I'd at least ask that the API stuff be split into a separate PR - it's cool and all, but not really related to the bulk of what's here.

tildebyte avatar Aug 15 '23 22:08 tildebyte

I'd at least ask that the API stuff be split into a separate PR

that can be done for sure. imo it's nice to deliver immediate ROI when you take your long term ROI packaging bitter medicine

doctorpangloss avatar Aug 15 '23 22:08 doctorpangloss

It would be nice to be able to select the target system manually, not only through auto detection. One might want to provide a list of prebuilt packages, on a build machine that has none of the GPUs it is building for.

oxc avatar Oct 19 '23 06:10 oxc

One might want to provide a list of prebuilt packages

that's what pip's dependency management is. In any case, you can always install your preferred version of torch, and everything will just work.

doctorpangloss avatar Jan 12 '24 21:01 doctorpangloss

The readme about authoring custom nodes uses setup.py to store project metadata. How about storing the metadata in pyproject.toml? It's more general, one can choose other backends like Hatching, PDM and Flit by simply changing build-system.

The entry points can be specified like

[project.entry-points."comfyui.custom_nodes"]
mypackage = "mypackage_custom_nodes"

Chaoses-Ib avatar Jan 30 '24 18:01 Chaoses-Ib