Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First pass #1

Merged
merged 2 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
First pass
  • Loading branch information
jiuguangw committed Jul 6, 2023
commit 72d4ebc471eb59ef491dca5480906907c14dc3a2
183 changes: 182 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,188 @@
# 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
env/
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/

# colcon
build/
install/
log/

# catkin_make
devel/
logs/
build/
bin/
lib/

# Editors
.idea/
.vscode/
*~
*\#*
.#*

# ROS
bag_files/

# Misc
.DS_Store
cyclonedds.xml

# experimental projects, not meant to be committed
projects/_experimental
projects/quickstart

# Local folder
.local

# ROS bags
*.db3
*.bag

# maps
ws/src/spot_maps/maps

# wandb
wandb/

# Gitman-tracked external repos
external

# Russell
src/logdir/
src/pretrained_models/

# Naoki's additions

.DS_Store
.idea/
habitat-lab/
GroundingDINO/
__pycache__/
*.pyc

46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright [2023] Boston Dynamics AI Institute, Inc.

repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.263'
hooks:
- id: ruff
args: ['--fix', '--config', 'pyproject.toml']
exclude: 'dreamerv3/.*|grpc_infra/.*'

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
exclude: 'dreamerv3/.*|grpc_infra/.*'
- id: trailing-whitespace
exclude: 'dreamerv3/.*|grpc_infra/.*'
- id: check-yaml
exclude: 'dreamerv3/.*|grpc_infra/.*'
- id: check-added-large-files
exclude: 'dreamerv3/.*|grpc_infra/.*'
- id: check-toml
exclude: 'dreamerv3/.*|grpc_infra/.*'

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
language_version: python3.10
args: ['--config', 'pyproject.toml']
exclude: 'dreamerv3/.*|grpc_infra/.*'
verbose: true

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.2.0
# hooks:
# - id: mypy
# pass_filenames: false
# additional_dependencies:
# - types-protobuf
# - types-requests
# - types-simplejson
# - types-ujson
# - types-PyYAML
# - types-toml
# - types-six
108 changes: 108 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Copyright [2023] Boston Dynamics AI Institute, Inc.

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "zsos"
version = "0.1"
description = "Zero shot object search"
authors = [
{name = "Naoki Yokoyama", email = "naokiyokoyama@github"},
]
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"torch >= 1.13.1",
# "habitat @ git+https://github.com/facebookresearch/habitat-sim.git",
]

[project.optional-dependencies]
dev = [
"pre-commit>=3.1.1",
"pytest>=7.2.1",
"pytest-cov>=4.0.0",
]

[project.urls]
"Homepage" = "theaiinstitute.com"
"GitHub" = "https://github.com/bdaiinstitute/llm-object-search"

[tool.ruff]
# Enable pycodestyle (`E`), Pyflakes (`F`), and import sorting (`I`)
select = ["E", "F", "I"]
ignore = []

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"docker/ros",
]

# Same as Black.
line-length = 120

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

# Assume Python 3.10.
target-version = "py310"

[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]

[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

[tool.black]
line-length = 120
target-version = ['py310']
include = '\.pyi?$'
# `extend-exclude` is not honored when `black` is passed a file path explicitly,
# as is typical when `black` is invoked via `pre-commit`.
force-exclude = '''
/(
docker/ros/.*
)/
'''

preview = true

# mypy configuration
[tool.mypy]
python_version = "3.10"
disallow_untyped_defs = true
ignore_missing_imports = true
explicit_package_bases = true
check_untyped_defs = true
strict_equality = true
warn_unreachable = true
warn_redundant_casts = true
no_implicit_optional = true
files = ['projects', 'src', 'ws']
exclude = '^(docker|.*external|.*thirdparty|.*install|.*build|.*_experimental)/'
5 changes: 4 additions & 1 deletion scripts/eval_dummy_policy.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env bash
# Copyright [2023] Boston Dynamics AI Institute, Inc.

python -um zsos.run \
--config-name=objectnav/ddppo_objectnav_hm3d.yaml \
habitat_baselines.evaluate=True \
habitat_baselines.eval_ckpt_path_dir=dummy_policy.pth \
habitat_baselines.load_resume_state_config=False \
habitat_baselines.rl.policy.name=BasePolicy \
habitat_baselines.rl.ddppo.reset_critic=False
habitat_baselines.rl.ddppo.reset_critic=False
3 changes: 3 additions & 0 deletions scripts/eval_fe_policy.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env bash
# Copyright [2023] Boston Dynamics AI Institute, Inc.

python -um zsos.run \
--config-name=objectnav/ddppo_objectnav_hm3d.yaml \
habitat_baselines.evaluate=True \
Expand Down
3 changes: 3 additions & 0 deletions scripts/eval_llm_policy.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env bash
# Copyright [2023] Boston Dynamics AI Institute, Inc.

python -um zsos.run \
--config-name=objectnav/ddppo_objectnav_hm3d.yaml \
habitat_baselines.evaluate=True \
Expand Down
4 changes: 2 additions & 2 deletions scripts/launch_llm_server.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

#!/usr/bin/env bash
# Copyright [2023] Boston Dynamics AI Institute, Inc.

# Ensure you have 'export LLM_OS_PYTHON=<PATH_TO_PYTHON>' in your .bashrc, where
# <PATH_TO_PYTHON> is the path to the python executable for your conda env
Expand Down
14 changes: 4 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import setuptools
# Copyright [2023] Boston Dynamics AI Institute, Inc.

setuptools.setup(
name="zsos",
version="0.1",
author="Naoki Yokoyama",
author_email="naokiyokoyama@github",
description="Zero-shot object search",
url="",
packages=setuptools.find_packages(),
)
from setuptools import setup

setup()