| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| import glob |
| import os |
| import shutil |
| from os import path |
| from setuptools import find_packages, setup |
| from typing import List |
| import torch |
|
|
| torch_ver = [int(x) for x in torch.__version__.split(".")[:2]] |
| assert torch_ver >= [1, 8], "Requires PyTorch >= 1.8" |
|
|
|
|
| def get_version(): |
| init_py_path = path.join(path.abspath(path.dirname(__file__)), "odise", "__init__.py") |
| init_py = open(init_py_path, "r").readlines() |
| version_line = [l.strip() for l in init_py if l.startswith("__version__")][0] |
| version = version_line.split("=")[-1].strip().strip("'\"") |
|
|
| return version |
|
|
|
|
| def get_model_zoo_configs() -> List[str]: |
| """ |
| Return a list of configs to include in package for model zoo. Copy over these configs inside |
| odise/model_zoo. |
| """ |
|
|
| |
| source_configs_dir = path.join(path.dirname(path.realpath(__file__)), "configs") |
| destination = path.join(path.dirname(path.realpath(__file__)), "odise", "model_zoo", "configs") |
| |
|
|
| |
| if path.exists(source_configs_dir): |
| if path.islink(destination): |
| os.unlink(destination) |
| elif path.isdir(destination): |
| shutil.rmtree(destination) |
|
|
| if not path.exists(destination): |
| try: |
| os.symlink(source_configs_dir, destination) |
| except OSError: |
| |
| shutil.copytree(source_configs_dir, destination) |
|
|
| config_paths = glob.glob("configs/**/*.yaml", recursive=True) + glob.glob( |
| "configs/**/*.py", recursive=True |
| ) |
| return config_paths |
|
|
|
|
| setup( |
| name="odise", |
| version=get_version(), |
| author="Jiarui Xu", |
| url="https://github.com/NVlabs/ODISE", |
| description="Open-vocabulary DIffusion-based Panoptic Segmentation", |
| packages=find_packages(exclude=("configs", "tests*")), |
| package_data={"odise.model_zoo": get_model_zoo_configs()}, |
| python_requires=">=3.8", |
| install_requires=[ |
| |
| |
| |
| ], |
| extras_require={ |
| |
| "dev": [ |
| ], |
| }, |
| include_package_data=True, |
| ) |
|
|