hydra config and starting trainer class

This commit is contained in:
Ethan Weber committed 2022-04-06 16:46:47 +00:00
1 parent 387d817358
commit a9c0d5b97f
17 files changed
+125 -3

No files matched your search

+4
View File
@@ -158,3 +158,7 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# Experiments and outputs
runs/
outputs/
+16
View File
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: run_train_nerf",
"type": "python",
"request": "launch",
"program": "scripts/run_train_nerf.py",
"console": "integratedTerminal",
"args": []
}
]
}
+5
View File
@@ -13,4 +13,9 @@
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": false,
"python.linting.enabled": true,
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
}
+10
View File
@@ -15,10 +15,20 @@ pip install -r environment/requirements.txt
# Install helper library
cd external/goat
python setup.py develop
# then go back, i.e., `cd /path/to/mattport`
# For using with Jupyter
python -m ipykernel install --user --name mattport --display-name "mattport"
# Install mattport as a library
python setup.py develop
# Running the test cases
pytest tests
```
# Training a model
```
python scripts/run_train_nerf.py
```
+6
View File
@@ -0,0 +1,6 @@
defaults:
- experiment: lego_bulldozer
- dataset: blender
batch_size: 10
optimizer:
- lr: 1e-4
View File
Whitespace-only changes.
View File
Whitespace-only changes.
View File
Whitespace-only changes.
+2
View File
@@ -0,0 +1,2 @@
name: lego_bulldozer
feature_size: 5
View File
Whitespace-only changes.
View File
Whitespace-only changes.
+3
View File
@@ -1,5 +1,8 @@
hydra-core
pylint==2.13.4
pytest
torch==1.11.0
torchtyping
torchvision==0.12.0
torchaudio==0.11.0
black
+13
View File
@@ -0,0 +1,13 @@
import torch.optim as optim
class Optimizer:
"""_summary_"""
def __init__(self, params: dict) -> None:
self.optimizer = optim.Adam(params)
def test(self):
raise NotImplementedError
+37
View File
@@ -0,0 +1,37 @@
import logging
import torch
class Trainer(object):
def __init__(self, config: None):
self.config = config
self.optimizer = None
def load_checkpoint(self):
"""_summary_
Raises:
NotImplementedError: _description_
"""
raise NotImplementedError()
def save_checkpoint(self):
"""_summary_
Raises:
NotImplementedError: _description_
"""
raise NotImplementedError()
def load_dataset(self):
"""_summary_
Raises:
NotImplementedError: _description_
"""
raise NotImplementedError()
def train(self):
"""_summary_"""
# TODO(ethan): replace print statements with something more proper
logging.info("train function")
+1
View File
@@ -6,4 +6,5 @@ The backend viewer code (python, websockets, ...).
```
https://github.com/lp-research/openvslam/tree/main/viewer
https://github.com/rdeits/meshcat
```
+23 -2
View File
@@ -1,5 +1,26 @@
import os
import mattport.nerf as nerf
from typing import Dict
from mattport.nerf.trainer import Trainer
import logging
import hydra
from omegaconf import DictConfig
logging.basicConfig(format="[%(filename)s:%(lineno)d] %(message)s", level=logging.DEBUG)
@hydra.main(config_path="../configs", config_name="config.yaml")
def main(cfg: DictConfig):
print(cfg)
print("hello mattport")
# TODO(ethan): add some sort of config script
config = {}
trainer = Trainer(config)
print("trainer!")
trainer.train()
if __name__ == "__main__":
print("hello mattport")
main()
+5 -1
View File
@@ -2,4 +2,8 @@ import pytest
def test_positional_encoding():
raise NotImplementedError()
assert True
def test_lower_case():
assert "MATTPORT".lower() == "mattport"