4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-10 18:17:31 +08:00

Fix cli bug in high version of tyro (#3567)

* 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 <yibrenth@gmail.com>
Co-authored-by: Justin Kerr <justin.g.kerr@gmail.com>
This commit is contained in:
Qizhi Chen 2025-01-21 19:32:35 +08:00 committed by GitHub
parent 3057c68570
commit 1dc2ebd9dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 9 deletions

View File

@ -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
@ -95,7 +95,7 @@ def MyMethodFunc():
@dataclass
class MyMethodClass(MethodSpecification):
config: TrainerConfig = TrainerConfig(...)
config: TrainerConfig = field(default_factory=lambda: TrainerConfig(...))
description: str = "Custom description"
```

View File

@ -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",
@ -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
@ -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",
]

View File

@ -20,10 +20,12 @@ else:
@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"