Skip to content

Commit

Permalink
Update pre-commit config and clear errors (#12)
Browse files Browse the repository at this point in the history
* Updated pre-commit config to match `bdai` repo
* Did `chmod -x` on a few files with shebang but not marked as
executable
* Various other auto-formatting. 
* Updated CI to use large runners and fixed minor bug from previous PR.
  • Loading branch information
jiuguangw authored Oct 16, 2023
1 parent 3cc486e commit 0e82142
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 20 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true


jobs:
vlfm_main_build:
runs-on: ubuntu-latest
runs-on:
group: bdai-gh-large-runners
defaults:
run:
shell: bash
Expand All @@ -19,4 +25,5 @@ jobs:
- uses: actions/checkout@v3
- name: Pytest
run: |
pip install -e .[habitat]
pytest
25 changes: 17 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ repos:
- id: ruff
args: ['--fix', '--config', 'pyproject.toml']

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- id: check-added-large-files
- id: check-toml
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
args: ['--unsafe']
- id: check-added-large-files
args: ['--enforce-all', '--maxkb', '200']
- id: check-toml
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable

- repo: https://github.com/psf/black
rev: 23.3.0
Expand All @@ -37,3 +41,8 @@ repos:
- types-PyYAML
- types-toml
- types-six

- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: forbid-binary
Empty file modified scripts/eval_dummy_policy.sh
100644 → 100755
Empty file.
Empty file modified scripts/eval_itm_policy.sh
100644 → 100755
Empty file.
Empty file modified scripts/eval_oracle_fbe_policy.sh
100644 → 100755
Empty file.
Empty file modified scripts/launch_vlm_servers.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion vlfm/mapping/obstacle_map.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import cv2
import numpy as np

from frontier_exploration.frontier_detection import detect_frontier_waypoints
from frontier_exploration.utils.fog_of_war import reveal_fog_of_war

from vlfm.mapping.base_map import BaseMap
from vlfm.utils.geometry_utils import extract_yaw, get_point_cloud, transform_points
from vlfm.utils.img_utils import fill_small_holes
Expand Down
2 changes: 1 addition & 1 deletion vlfm/policy/habitat_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy as np
import torch
from depth_camera_filtering import filter_depth
from frontier_exploration.base_explorer import BaseExplorer
from habitat.tasks.nav.object_nav_task import ObjectGoalSensor
from habitat_baselines.common.baseline_registry import baseline_registry
from habitat_baselines.common.tensor_dict import TensorDict
Expand All @@ -15,7 +16,6 @@
from omegaconf import DictConfig
from torch import Tensor

from frontier_exploration.base_explorer import BaseExplorer
from vlfm.utils.geometry_utils import xyz_yaw_to_tf_matrix
from vlfm.vlm.grounding_dino import ObjectDetections

Expand Down
Empty file modified vlfm/policy/utils/non_habitat_policy/resnet.py
100644 → 100755
Empty file.
Empty file modified vlfm/policy/utils/non_habitat_policy/rnn_state_encoder.py
100644 → 100755
Empty file.
14 changes: 7 additions & 7 deletions vlfm/run.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import os

# The following imports require habitat to be installed, and despite not being used by
# this script itself, will register several classes and make them discoverable by Hydra.
# This run.py script is expected to only be used when habitat is installed, thus they
# are hidden here instead of in an __init__.py file. This avoids import errors when used
# in an environment without habitat, such as when doing real-world deployment. noqa is
# used to suppress the unused import and unsorted import warnings by ruff.
import frontier_exploration # noqa
import hydra # noqa
from habitat import get_config # noqa
from habitat.config import read_write
Expand All @@ -10,13 +17,6 @@
from hydra.plugins.search_path_plugin import SearchPathPlugin
from omegaconf import DictConfig

# The following imports require habitat to be installed, and despite not being used by
# this script itself, will register several classes and make them discoverable by Hydra.
# This run.py script is expected to only be used when habitat is installed, thus they
# are hidden here instead of in an __init__.py file. This avoids import errors when used
# in an environment without habitat, such as when doing real-world deployment. noqa is
# used to suppress the unused import and unsorted import warnings by ruff.
import frontier_exploration # noqa
import vlfm.measurements.traveled_stairs # noqa: F401
import vlfm.obs_transformers.resize # noqa: F401
import vlfm.policy.action_replay_policy # noqa: F401
Expand Down
2 changes: 1 addition & 1 deletion vlfm/utils/episode_stats_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import cv2
import numpy as np

from frontier_exploration.utils.general_utils import xyz_to_habitat

from vlfm.utils.geometry_utils import transform_points
from vlfm.utils.habitat_visualizer import sim_xy_to_grid_xy
from vlfm.utils.log_saver import log_episode
Expand Down
2 changes: 1 addition & 1 deletion vlfm/utils/habitat_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import cv2
import numpy as np
from frontier_exploration.utils.general_utils import xyz_to_habitat
from habitat.utils.visualizations import maps
from habitat.utils.visualizations.maps import MAP_TARGET_POINT_INDICATOR
from habitat.utils.visualizations.utils import overlay_frame
from habitat_baselines.common.tensor_dict import TensorDict

from frontier_exploration.utils.general_utils import xyz_to_habitat
from vlfm.utils.geometry_utils import transform_points
from vlfm.utils.img_utils import (
reorient_rescale_map,
Expand Down

0 comments on commit 0e82142

Please sign in to comment.