git clone https://github.com/bcmi/libcom.git
cd libcom/requirements
conda env create -f libcom.yaml
conda activate Libcom
pip install -r runtime.txt # -i https://pypi.tuna.tsinghua.edu.cn/simple
# install a specific version of taming-transformers from source code
cd ../libcom/controllable_composition/source/ControlCom/src/taming-transformers
python setup.py install
Tips: We have validated the above process on Linux. You may encounter ResolvepackageNotFound
error during installation on Windows or other systems. To resolve this, you can try removing the packages under "ResolvepackageNotFound" from libcom.yaml, then create a conda environment. Subsequently, based on the runtime error messages, use pip to install the missing packages.
pip install libcom
or
python setup.py install
Tips: If you encounter any issues during installation related to the trilinear
library, you have two choices:
- Refer to its official repository and check for relevant help in the issues section.
- If you don't need ImageHarmonizationModel, you can address the problem by blocking this function. Specifically, first comment out the
ext_modules
insetup.py
, import code in__init__.py
, and other places that may rely on thetrilinear
orlibcom/image_harmonization
. Then reinstall this library by runningpython setup.py install
.
After installation, you can verify the installation by running:
cd tests
sh run_all_tests.sh
The visualization results can be found in results
folder.
During using the toolbox, the pretrained models and related files will be automatically downloaded to the installation directory. Note downloading the pretrained models may take some time when you first call some models, especially ShadowGenerationModel
, ControlComModel
, and PainterlyHarmonizationModel
.
Alternatively, you can download these files from [Modelscope] or [Huggingface] in advance, and move them to the installation directory. The correct directory to store pretrained models can be identified from the printed message during the automatic download process. For ZIP
files, don't forget to manually extract them to the installation directory. More details can be found in the model_download.py
.