From 4c4dbfde7bcc7697e10eeeeac69ad33d442e67fb Mon Sep 17 00:00:00 2001 From: hetong Date: Wed, 9 Oct 2024 17:57:39 +0800 Subject: [PATCH] Init --- .github/PULL_REQUEST_TEMPLATE.md | 15 +++ .github/workflows/formatter.yaml | 26 ++++++ .gitignore | 154 +++++++++++++++++++++++++++++++ .project-root | 2 + LICENSE | 21 +++++ README.md | 18 ++++ requirements.txt | 25 +++++ setup.py | 60 ++++++++++++ 8 files changed, 321 insertions(+) create mode 100755 .github/PULL_REQUEST_TEMPLATE.md create mode 100755 .github/workflows/formatter.yaml create mode 100755 .gitignore create mode 100755 .project-root create mode 100644 LICENSE create mode 100755 README.md create mode 100755 requirements.txt create mode 100755 setup.py diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100755 index 0000000..7bdaaaa --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,15 @@ +## What does this PR do? + +Fixes #\ + +## Before submitting + +- [ ] Did you make sure **title is self-explanatory** and **the description concisely explains the PR**? +- [ ] Did you make sure your **PR does only one thing**, instead of bundling different changes together? +- [ ] Did you list all the **breaking changes** introduced by this pull request? +- [ ] Did you **test your PR locally**? +- [ ] Did you **format your code** with `isort . --profile=black;black .` command? + +## Did you have fun? + +Make sure you had fun coding 🙃 diff --git a/.github/workflows/formatter.yaml b/.github/workflows/formatter.yaml new file mode 100755 index 0000000..b746909 --- /dev/null +++ b/.github/workflows/formatter.yaml @@ -0,0 +1,26 @@ +name: Formatter + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + types: [opened, reopened, synchronize] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + formatter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + - run: python -m pip install --upgrade pip + - run: pip install isort black + - run: isort . --profile black + - uses: psf/black@stable \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..f95442a --- /dev/null +++ b/.gitignore @@ -0,0 +1,154 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +env/ +.venv +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +### VisualStudioCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace +**/.vscode + +# JetBrains +.idea/ + +# Data & Models +*.h5 +*.tar +*.tar.gz + +# Lightning-Hydra-Template +configs/local/default.yaml +/data/ +/logs/ +.env + +# Aim logging +.aim diff --git a/.project-root b/.project-root new file mode 100755 index 0000000..63eab77 --- /dev/null +++ b/.project-root @@ -0,0 +1,2 @@ +# this file is required for inferring the project root directory +# do not delete diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..04e39b1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Haoyi Zhu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100755 index 0000000..56fdc83 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +
+ +# SPA: 3D Spatial-Awareness Enables Effective Embodied Representation + + +[![python](https://img.shields.io/badge/-Python_3.9_%7C_3.10_%7C_3.11-blue?logo=python&logoColor=white)](https://github.com/pre-commit/pre-commit) +[![pytorch](https://img.shields.io/badge/PyTorch_2.0+-ee4c2c?logo=pytorch&logoColor=white)](https://pytorch.org/get-started/locally/) +[![lightning](https://img.shields.io/badge/-Lightning_2.0+-792ee5?logo=pytorchlightning&logoColor=white)](https://pytorchlightning.ai/) +[![hydra](https://img.shields.io/badge/Config-Hydra_1.3-89b8cd)](https://hydra.cc/) +[![black](https://img.shields.io/badge/Code%20Style-Black-black.svg?labelColor=gray)](https://black.readthedocs.io/en/stable/) +[![isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/) +[![license](https://img.shields.io/badge/License-MIT-green.svg?labelColor=gray)](https://github.com/ashleve/lightning-hydra-template#license) + +[**Project Page**](https://haoyizhu.github.io/spa.github.io/) | [**Arxiv**]() + +[Haoyi Zhu](https://www.haoyizhu.site/), [Honghui Yang](https://hhyangcs.github.io/), [Yating Wang](https://scholar.google.com/citations?hl=zh-CN&user=5SuBWh0AAAAJ), [Jiange Yang](https://yangjiangeyjg.github.io/), [Liming Wang](https://wanglimin.github.io/), [Tong He](http://tonghe90.github.io/) +
+ diff --git a/requirements.txt b/requirements.txt new file mode 100755 index 0000000..f985c13 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,25 @@ +h5py==3.11.0 +pyyaml==6.0.1 +tensorboard==2.16.2 +tensorboardx==2.6.2.2 +yapf==0.40.2 +addict==2.4.0 +einops==0.8.0 +scipy==1.13.1 +termcolor==2.4.0 +timm==0.9.10 +hydra-colorlog==1.2.0 +hydra-core==1.3.2 +hydra-optuna-sweeper==1.2.0 +lightning>=2.0.0 +opencv-python==4.10.0.82 +pre-commit==3.7.1 +pytest==8.2.2 +rich==13.7.1 +isort==5.13.2 +black==24.4.2 +torchmetrics>=0.11.4 +rootutils==1.0.7 +imageio==2.34.1 +python-dotenv==1.0.1 +matplotlib \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..c03e5b4 --- /dev/null +++ b/setup.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +import os +import pathlib + +import pkg_resources +from setuptools import find_packages, setup + +PKG_NAME = "spa" +VERSION = "0.1" +EXTRAS = {} + + +def _read_file(fname): + # this_dir = os.path.abspath(os.path.dirname(__file__)) + # with open(os.path.join(this_dir, fname)) as f: + with pathlib.Path(fname).open() as fp: + return fp.read() + + +def _read_install_requires(): + with pathlib.Path("requirements.txt").open() as fp: + return [ + str(requirement) for requirement in pkg_resources.parse_requirements(fp) + ] + + +def _fill_extras(extras): + if extras: + extras["all"] = list(set([item for group in extras.values() for item in group])) + return extras + + +setup( + name=PKG_NAME, + version=VERSION, + author="Haoyi Zhu", + author_email="hyizhu1108@gmail.com", + url="https://github.com/HaoyiZhu/SPA", + description="SPA: 3D Spatial-Awareness Enables Effective Embodied Representation", + long_description=_read_file("README.md"), + long_description_content_type="text/markdown", + keywords=[ + "Deep Learning", + "Machine Learning", + "Embodied AI", + "Representation Learning", + ], + license="MIT License", + packages=find_packages(include=f"{PKG_NAME}.*"), + include_package_data=True, + zip_safe=False, + install_requires=_read_install_requires(), + extras_require=_fill_extras(EXTRAS), + python_requires=">=3.9", + entry_points={ + "console_scripts": [ + "train_command = spa.train:main", + ] + }, +)