Download setup.py from lkllkl/navsim_ours: direct link, hf CLI and curl.
- Browser
- Download file 2.44 kB
-
https://huggingface.co/lkllkl/navsim_ours/resolve/main/setup.py
- Command line
-
hf download hf://lkllkl/navsim_ours/setup.py
-
curl -L -o setup.py https://huggingface.co/lkllkl/navsim_ours/resolve/main/setup.py
2.44 kB
| import os | |
| import torch | |
| from torch.utils.cpp_extension import (BuildExtension, CppExtension, | |
| CUDAExtension) | |
| import setuptools | |
| # Change directory to allow installation from anywhere | |
| script_folder = os.path.dirname(os.path.realpath(__file__)) | |
| os.chdir(script_folder) | |
| with open("requirements.txt") as f: | |
| requirements = f.read().splitlines() | |
| def make_cuda_ext(name, | |
| module, | |
| sources, | |
| sources_cuda=[], | |
| extra_args=[], | |
| extra_include_path=[]): | |
| define_macros = [] | |
| extra_compile_args = {'cxx': [] + extra_args} | |
| if torch.cuda.is_available() or os.getenv('FORCE_CUDA', '0') == '1': | |
| define_macros += [('WITH_CUDA', None)] | |
| extension = CUDAExtension | |
| extra_compile_args['nvcc'] = extra_args + [ | |
| '-D__CUDA_NO_HALF_OPERATORS__', | |
| '-D__CUDA_NO_HALF_CONVERSIONS__', | |
| '-D__CUDA_NO_HALF2_OPERATORS__', | |
| ] | |
| sources += sources_cuda | |
| else: | |
| print('Compiling {} without CUDA'.format(name)) | |
| extension = CppExtension | |
| # raise EnvironmentError('CUDA is required to compile MMDetection!') | |
| return extension( | |
| name='{}.{}'.format(module, name), | |
| sources=[os.path.join(*module.split('.'), p) for p in sources], | |
| include_dirs=extra_include_path, | |
| define_macros=define_macros, | |
| extra_compile_args=extra_compile_args) | |
| # Installs | |
| setuptools.setup( | |
| name="navsim", | |
| version="1.0.0", | |
| author="University of Tuebingen", | |
| author_email="kashyap.chitta@uni-tuebingen.de", | |
| description="TODO", | |
| url="TODO", | |
| python_requires=">=3.9", | |
| packages=setuptools.find_packages(script_folder), | |
| package_dir={"": "."}, | |
| classifiers=[ | |
| "Programming Language :: Python :: 3.9", | |
| "Operating System :: OS Independent", | |
| "License :: Free for non-commercial use", | |
| ], | |
| license="apache-2.0", | |
| install_requires=requirements, | |
| ext_modules=[ | |
| make_cuda_ext( | |
| name='bev_pool_v2_ext', | |
| module='det_map.det.dal.mmdet3d.ops.bev_pool_v2', | |
| sources=[ | |
| 'src/bev_pool.cpp', | |
| 'src/bev_pool_cuda.cu', | |
| ], | |
| ), | |
| ], | |
| cmdclass={'build_ext': BuildExtension}, | |
| ) | |