Skip to content

Commit

Permalink
Fix cli bug in high version of tyro (#3567)
Browse files Browse the repository at this point in the history
* limited the tyro version up to 0.9.2

* bump tyro>=0.9.8

* Bump typeguard

* Runtime checking with jaxtyping hook instead of typeguard

* Fix test for Python >=3.11, caused by missing default_factory

---------

Co-authored-by: Brent Yi <[email protected]>
Co-authored-by: Justin Kerr <[email protected]>
  • Loading branch information
3 people authored Jan 21, 2025
1 parent 3057c68 commit 1dc2ebd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/developer_guides/new_methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ The `NERFSTUDIO_METHOD_CONFIGS` environment variable additionally accepts a func
```python
"""my_method/my_config.py"""

from dataclasses import dataclass
from dataclasses import dataclass, field
from nerfstudio.engine.trainer import TrainerConfig
from nerfstudio.plugins.types import MethodSpecification

Expand All @@ -95,7 +95,7 @@ def MyMethodFunc():

@dataclass
class MyMethodClass(MethodSpecification):
config: TrainerConfig = TrainerConfig(...)
config: TrainerConfig = field(default_factory=lambda: TrainerConfig(...))
description: str = "Custom description"
```

Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
"av>=9.2.0",
"comet_ml>=3.33.8",
"cryptography>=38",
"tyro>=0.6.6",
"tyro>=0.9.8",
"gdown>=4.6.0",
"ninja>=1.10",
"h5py>=2.9.0",
Expand Down Expand Up @@ -93,7 +93,6 @@ dev = [
"pre-commit==3.3.2",
"pytest==7.1.2",
"pytest-xdist==2.5.0",
"typeguard==2.13.3",
"ruff>=0.6.1",
"sshconf==0.2.5",
"pycolmap>=0.3.0", # NOTE: pycolmap==0.3.0 is not available on newer python versions
Expand Down Expand Up @@ -146,7 +145,7 @@ include = ["nerfstudio*"]
"*" = ["*.cu", "*.json", "py.typed", "setup.bash", "setup.zsh"]

[tool.pytest.ini_options]
addopts = "-n=4 --typeguard-packages=nerfstudio --disable-warnings"
addopts = "-n=4 --jaxtyping-packages=nerfstudio --disable-warnings"
testpaths = [
"tests",
]
Expand Down
10 changes: 6 additions & 4 deletions tests/plugins/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

@dataclass
class TestConfigClass(MethodSpecification):
config: TrainerConfig = TrainerConfig(
method_name="test-method",
pipeline=VanillaPipelineConfig(),
optimizers={},
config: TrainerConfig = field(
default_factory=lambda: TrainerConfig(
method_name="test-method",
pipeline=VanillaPipelineConfig(),
optimizers={},
)
)
description: str = "Test description"

Expand Down

0 comments on commit 1dc2ebd

Please sign in to comment.