taming-transformers icon indicating copy to clipboard operation
taming-transformers copied to clipboard

Make it possible to install with pip

Open bfirsh opened this issue 2 years ago • 4 comments

This pull request makes it possible to do:

pip install git+https://github.com/CompVis/taming-transformers.git

I have done this by:

  1. Using find_namespace_packages() instead of find_packages() so setuptools can find packages without __init__.py
  2. Put instantiate_from_config inside the taming package so it is importable

ref #62 #30

bfirsh avatar Jul 16 '21 23:07 bfirsh

Hi! I wanted to use your code, but I found a small issue with your PR: you forgot to remove the from main import ... lines in files taming/models/vqgan.py, taming/models/cond_transformer.py and scripts/sample_fast.py. After removing those lines, I could install the package locally and run the part of the package I was interested in.

(There are also a number of dependencies that are not indicated in setup.py that I had to download by hand, among which pytorch-lightning and einops, it might be convenient to add them?)

Thanks for making the PR!

Evarin avatar Jul 28 '21 21:07 Evarin

fyi I already did something similar at https://github.com/rom1504/taming-transformers and released it to pypi at https://pypi.org/project/taming-transformers-rom1504/

if the authors want to maintain their pypi package, I'd gladly PR that though!

rom1504 avatar Aug 13 '21 09:08 rom1504

@Evarin Good catch -- fixed all this stuff. Thanks!

I have also added a simple GitHub actions check that makes sure the package is importable after pip install. This will make sure it remains installable over time.

@rromb @pesser I think this is ready to review/merge now! I think you might need to click a button to get GitHub actions to run. It passes on my fork: https://github.com/bfirsh/taming-transformers/runs/3738638366

bfirsh avatar Sep 28 '21 23:09 bfirsh

I have rebased this and fixed conflicts. @rromb @pesser @manolo-lolo does this look good? :)

bfirsh avatar Nov 10 '21 16:11 bfirsh