NERFSTUDIO_METHOD_CONFIGS callable MethodSpecification (#2385)

* NERFSTUDIO_METHOD_CONFIGS allow method specification as callabale (function or class)

* docs - NERFSTUDIO_METHOD_CONFIGS accepts function or derived class
This commit is contained in:
drewgilliam authored and GitHub committed 2023-09-05 13:55:08 -07:00
1 parent a121d76fd0
commit 4d0033343c
3 files changed
+64 -10

No files matched your search

+21
View File
@@ -78,6 +78,27 @@ Instead, you may use the `NERFSTUDIO_METHOD_CONFIGS` environment variable to tem
export NERFSTUDIO_METHOD_CONFIGS="my-method=my_method.my_config:MyMethod"
```
The `NERFSTUDIO_METHOD_CONFIGS` environment variable additionally accepts a function or derived class to temporarily register your custom method.
```python
"""my_method/my_config.py"""
from dataclasses import dataclass
from nerfstudio.engine.trainer import TrainerConfig
from nerfstudio.plugins.types import MethodSpecification
def MyMethodFunc():
return = MethodSpecification(
config=TrainerConfig(...)
description="Custom description"
)
@dataclass
class MyMethodClass(MethodSpecification):
config: TrainerConfig = TrainerConfig(...)
description: str = "Custom description"
```
## Registering custom dataparser with nerfstudio
We also support adding new dataparsers in a similar way. In order to extend the NeRFstudio and register a customized dataparser, you can register it with Nerfstudio as a `nerfstudio.dataparser_configs` entrypoint in the `pyproject.toml` file. Nerfstudio will automatically look for all registered dataparsers and will register them to be used by methods such as `ns-train`.