mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-12 19:04:03 +08:00
Merge pull request #11 from ethanweber/tancik/github_linting
Update Github action
This commit is contained in:
11 files changed
+40
-53
No files matched your search
@@ -1,4 +1,4 @@
|
||||
name: Python application
|
||||
name: Check code for formating and run tests.
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -25,6 +25,13 @@ jobs:
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r environment/requirements.txt
|
||||
python setup.py develop
|
||||
- name: Run Black
|
||||
uses: psf/black@stable
|
||||
with:
|
||||
options: "--check --verbose --line-length=120"
|
||||
- name: Python Pylint
|
||||
run: |
|
||||
pylint mattport --max-line-length=120 --generated-members=numpy.*,torch.*,cv2.*,cv.* --good-names=i,j,x,y,lr --disable=too-many-arguments
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest tests
|
||||
@@ -1,29 +0,0 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '*.py'
|
||||
pull_request:
|
||||
paths:
|
||||
- '*.py'
|
||||
|
||||
jobs:
|
||||
format_and_lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.8.12
|
||||
architecture: x64
|
||||
- name: Checkout PyTorch
|
||||
uses: actions/checkout@master
|
||||
- name: Run Black
|
||||
uses: psf/black@stable
|
||||
with:
|
||||
options: "--check --verbose --line-length=120"
|
||||
- name: Python Pylint GitHub Action
|
||||
uses: vcoder4c/git_pylint@v3
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Vendored
+4
-2
@@ -19,7 +19,9 @@
|
||||
"python.testing.unittestEnabled": false,
|
||||
"python.testing.pytestEnabled": true,
|
||||
"python.linting.pylintArgs": [
|
||||
"--generated-members=numpy.* ,torch.* ,cv2.* , cv.*",
|
||||
"--max-line-length=120"
|
||||
"--generated-members=numpy.*,torch.*,cv2.*,cv.*",
|
||||
"--max-line-length=120",
|
||||
"--good-names=i,j,x,y,lr",
|
||||
"--disable=too-many-arguments"
|
||||
],
|
||||
}
|
||||
@@ -15,12 +15,7 @@ class Dataset(torch.utils.data.Dataset):
|
||||
torch (_type_): _description_
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
data_directory: str,
|
||||
dataset_type: str,
|
||||
scene: str
|
||||
):
|
||||
def __init__(self, data_directory: str, dataset_type: str, scene: str):
|
||||
"""_summary_
|
||||
|
||||
Args:
|
||||
@@ -33,7 +28,6 @@ class Dataset(torch.utils.data.Dataset):
|
||||
self.dataset_type = dataset_type
|
||||
self.scene = scene
|
||||
|
||||
|
||||
def __len__(self):
|
||||
pass
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
"""init modules"""
|
||||
from .encoding import Encoding
|
||||
from .mlp import MLP
|
||||
@@ -131,8 +131,8 @@ class RFFEncoding(Encoding):
|
||||
Returns:
|
||||
TensorType[..., "output_dim"]: Output values will be between -1 and 1
|
||||
"""
|
||||
B = torch.normal(mean=0, std=self.scale, size=(self.in_dim, self.num_frequencies))
|
||||
scaled_inputs = in_tensor @ B # [..., "num_frequencies"]
|
||||
b_matrix = torch.normal(mean=0, std=self.scale, size=(self.in_dim, self.num_frequencies))
|
||||
scaled_inputs = in_tensor @ b_matrix # [..., "num_frequencies"]
|
||||
encoded_inputs = torch.cat([torch.sin(scaled_inputs), torch.cos(scaled_inputs)], axis=-1)
|
||||
return encoded_inputs
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
"""
|
||||
Multi Layer Perceptron
|
||||
"""
|
||||
from typing import Optional
|
||||
|
||||
from torch import nn
|
||||
|
||||
@@ -24,3 +24,7 @@ class Optimizer:
|
||||
NotImplementedError: _description_
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def test2(self):
|
||||
"""Summary"""
|
||||
raise NotImplementedError
|
||||
@@ -2,11 +2,12 @@
|
||||
Collection of sampling strategies
|
||||
"""
|
||||
from typing import NamedTuple
|
||||
from torchtyping import TensorType
|
||||
from torch import nn
|
||||
import torch
|
||||
import nerf.cameras as cameras
|
||||
|
||||
import torch
|
||||
from torch import nn
|
||||
from torchtyping import TensorType
|
||||
|
||||
from mattport.nerf import cameras
|
||||
|
||||
RaySamples = NamedTuple(
|
||||
"RaySamples", [("locations", TensorType[..., "num_samples", 3]), ("deltas", TensorType[..., "num_samples"])]
|
||||
|
||||
@@ -3,10 +3,9 @@ Code to train model.
|
||||
"""
|
||||
from mattport.nerf.dataset.build import build_dataset
|
||||
from mattport.nerf.optimizer import Optimizer
|
||||
from mattport.nerf.graph import Graph
|
||||
|
||||
|
||||
class Trainer(object):
|
||||
class Trainer:
|
||||
"""Training class"""
|
||||
|
||||
def __init__(self, config: dict):
|
||||
@@ -23,7 +22,8 @@ class Trainer(object):
|
||||
|
||||
def setup_graph(self):
|
||||
"""_summary_"""
|
||||
self.graph = Graph()
|
||||
# self.graph = Graph()
|
||||
raise NotImplementedError
|
||||
|
||||
def setup_optimizer(self):
|
||||
"""_summary_"""
|
||||
|
||||
@@ -173,13 +173,17 @@ def test_ordering():
|
||||
assert np.array_equal(target, order)
|
||||
|
||||
test_repeated_graph.modules_config["mlp_0"]["inputs"][1] = "encoder_1"
|
||||
test_repeated_graph.modules_config["encoder_1"] = {"class_name": "Encoding", "inputs": ["x"], "meta_data": {"out_dim": 8}}
|
||||
test_repeated_graph.modules_config["encoder_1"] = {
|
||||
"class_name": "Encoding",
|
||||
"inputs": ["x"],
|
||||
"meta_data": {"out_dim": 8},
|
||||
}
|
||||
order = test_repeated_graph.get_module_order()
|
||||
assert order.index('mlp_0') > order.index('encoder_0') and order.index('mlp_0') > order.index('encoder_1')
|
||||
assert order.index("mlp_0") > order.index("encoder_0") and order.index("mlp_0") > order.index("encoder_1")
|
||||
|
||||
test_complex_graph = Graph(create_complex_graph())
|
||||
_ = test_complex_graph.construct_graph()
|
||||
order = test_complex_graph.get_module_order()
|
||||
assert order.index('mlp_2') > order.index('mlp_0')
|
||||
assert order.index('mlp_2') > order.index('encoder_0')
|
||||
assert order.index('mlp_3') > order.index('encoder_0')
|
||||
assert order.index("mlp_2") > order.index("mlp_0")
|
||||
assert order.index("mlp_2") > order.index("encoder_0")
|
||||
assert order.index("mlp_3") > order.index("encoder_0")
|
||||
Reference in new issue
Block a user