We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Minor arg improvements
Minor TODOs, I can do these in the next day or two:
- All of the fixed args can be suppressed via `dcargs.conf.SuppressFixed[]`, this will remove all of the unnecessary `_type` args from the usage + helptext
- Formatting in the base config descriptions, https://github.com/nerfstudio-project/nerfstudio/blob/5a76b955cdd833fd59b90edff33875fa05894847/nerfstudio/configs/model_configs.py#L46-L56, currently exploits a bug in `dcargs`, which will be patched in the next release. The tags will need to be manually converted to ANSI sequences in nerfstudio

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `nerfstudio/configs/method_configs.py`
Content:
```
1 # Copyright 2022 The Nerfstudio Team. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 """
16 Put all the method implementations in one location.
17 """
18 
19 from __future__ import annotations
20 
21 from typing import Dict
22 
23 import dcargs
24 
25 from nerfstudio.configs.base_config import Config, TrainerConfig, ViewerConfig
26 from nerfstudio.data.datamanagers import VanillaDataManagerConfig
27 from nerfstudio.data.dataparsers.blender_dataparser import BlenderDataParserConfig
28 from nerfstudio.data.dataparsers.friends_dataparser import FriendsDataParserConfig
29 from nerfstudio.data.dataparsers.nerfstudio_dataparser import NerfstudioDataParserConfig
30 from nerfstudio.engine.optimizers import AdamOptimizerConfig, RAdamOptimizerConfig
31 from nerfstudio.models.base_model import VanillaModelConfig
32 from nerfstudio.models.instant_ngp import InstantNGPModelConfig
33 from nerfstudio.models.mipnerf import MipNerfModel
34 from nerfstudio.models.nerfacto import NerfactoModelConfig
35 from nerfstudio.models.semantic_nerfw import SemanticNerfWModelConfig
36 from nerfstudio.models.vanilla_nerf import NeRFModel
37 from nerfstudio.pipelines.base_pipeline import VanillaPipelineConfig
38 from nerfstudio.pipelines.dynamic_batch import DynamicBatchPipelineConfig
39 
40 method_configs: Dict[str, Config] = {}
41 descriptions = {
42     "nerfacto": "[bold green]Recommended[/bold green] Real-time model tuned for real captures. "
43     + "This model will be continually updated.",
44     "instant-ngp": "Implementation of Instant-NGP. Recommended real-time model for bounded synthetic data.",
45     "mipnerf": "High quality model for bounded scenes. [red]*slow*",
46     "semantic-nerfw": "Predicts semantic segmentations and filters out transient objects.",
47     "vanilla-nerf": "Original NeRF model. [red]*slow*",
48 }
49 
50 method_configs["nerfacto"] = Config(
51     method_name="nerfacto",
52     trainer=TrainerConfig(steps_per_eval_batch=500, steps_per_save=2000, mixed_precision=True),
53     pipeline=VanillaPipelineConfig(
54         datamanager=VanillaDataManagerConfig(
55             dataparser=NerfstudioDataParserConfig(), train_num_rays_per_batch=4096, eval_num_rays_per_batch=8192
56         ),
57         model=NerfactoModelConfig(eval_num_rays_per_chunk=1 << 14),
58     ),
59     optimizers={
60         "proposal_networks": {
61             "optimizer": AdamOptimizerConfig(lr=1e-2, eps=1e-15),
62             "scheduler": None,
63         },
64         "fields": {
65             "optimizer": AdamOptimizerConfig(lr=1e-2, eps=1e-15),
66             "scheduler": None,
67         },
68     },
69     viewer=ViewerConfig(num_rays_per_chunk=1 << 14),
70     vis="viewer",
71 )
72 
73 method_configs["instant-ngp"] = Config(
74     method_name="instant-ngp",
75     trainer=TrainerConfig(steps_per_eval_batch=500, steps_per_save=2000, mixed_precision=True),
76     pipeline=DynamicBatchPipelineConfig(
77         datamanager=VanillaDataManagerConfig(dataparser=NerfstudioDataParserConfig(), train_num_rays_per_batch=8192),
78         model=InstantNGPModelConfig(eval_num_rays_per_chunk=8192),
79     ),
80     optimizers={
81         "fields": {
82             "optimizer": AdamOptimizerConfig(lr=1e-2, eps=1e-15),
83             "scheduler": None,
84         }
85     },
86     viewer=ViewerConfig(num_rays_per_chunk=64000),
87     vis="viewer",
88 )
89 
90 method_configs["mipnerf"] = Config(
91     method_name="mipnerf",
92     pipeline=VanillaPipelineConfig(
93         datamanager=VanillaDataManagerConfig(dataparser=BlenderDataParserConfig(), train_num_rays_per_batch=8192),
94         model=VanillaModelConfig(
95             _target=MipNerfModel,
96             loss_coefficients={"rgb_loss_coarse": 0.1, "rgb_loss_fine": 1.0},
97             num_coarse_samples=128,
98             num_importance_samples=128,
99             eval_num_rays_per_chunk=8192,
100         ),
101     ),
102     optimizers={
103         "fields": {
104             "optimizer": RAdamOptimizerConfig(lr=5e-4, eps=1e-08),
105             "scheduler": None,
106         }
107     },
108 )
109 
110 method_configs["semantic-nerfw"] = Config(
111     method_name="semantic-nerfw",
112     trainer=TrainerConfig(steps_per_eval_batch=500, steps_per_save=2000, mixed_precision=True),
113     pipeline=VanillaPipelineConfig(
114         datamanager=VanillaDataManagerConfig(
115             dataparser=FriendsDataParserConfig(), train_num_rays_per_batch=4096, eval_num_rays_per_batch=8192
116         ),
117         model=SemanticNerfWModelConfig(eval_num_rays_per_chunk=1 << 16),
118     ),
119     optimizers={
120         "proposal_networks": {
121             "optimizer": AdamOptimizerConfig(lr=1e-2, eps=1e-15),
122             "scheduler": None,
123         },
124         "fields": {
125             "optimizer": AdamOptimizerConfig(lr=1e-2, eps=1e-15),
126             "scheduler": None,
127         },
128     },
129     viewer=ViewerConfig(num_rays_per_chunk=1 << 16),
130     vis="viewer",
131 )
132 
133 method_configs["vanilla-nerf"] = Config(
134     method_name="vanilla-nerf",
135     pipeline=VanillaPipelineConfig(
136         datamanager=VanillaDataManagerConfig(
137             dataparser=BlenderDataParserConfig(),
138         ),
139         model=VanillaModelConfig(_target=NeRFModel),
140     ),
141     optimizers={
142         "fields": {
143             "optimizer": RAdamOptimizerConfig(lr=5e-4, eps=1e-08),
144             "scheduler": None,
145         }
146     },
147 )
148 
149 
150 AnnotatedBaseConfigUnion = dcargs.extras.subcommand_type_from_defaults(
151     defaults=method_configs, descriptions=descriptions
152 )
153 """Union[] type over config types, annotated with default instances for use with
154 dcargs.cli(). Allows the user to pick between one of several base configurations, and
155 then override values in it."""
156
```

Path: `nerfstudio/configs/config_utils.py`
Content:
```
1 # Copyright 2022 The Nerfstudio Team. All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 """
16 Some utility code for configs.
17 """
18 
19 from __future__ import annotations
20 
21 from dataclasses import field
22 from typing import Any, Dict
23 
24 # pylint: disable=import-outside-toplevel
25 
26 # cannot use mutable types directly within dataclass; abstracting default factory calls
27 def to_immutable_dict(d: Dict[str, Any]):
28     """Method to convert mutable dict to default factory dict
29 
30     Args:
31         d: dictionary to convert into default factory dict for dataclass
32     """
33     return field(default_factory=lambda: dict(d))
34
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/nerfstudio/configs/config_utils.py b/nerfstudio/configs/config_utils.py
--- a/nerfstudio/configs/config_utils.py
+++ b/nerfstudio/configs/config_utils.py
@@ -21,6 +21,8 @@
 from dataclasses import field
 from typing import Any, Dict
 
+from rich.console import Console
+
 # pylint: disable=import-outside-toplevel
 
 # cannot use mutable types directly within dataclass; abstracting default factory calls
@@ -31,3 +33,18 @@
         d: dictionary to convert into default factory dict for dataclass
     """
     return field(default_factory=lambda: dict(d))
+
+
+def convert_markup_to_ansi(markup_string: str) -> str:
+    """Convert rich-style markup to ANSI sequences for command-line formatting.
+
+    Args:
+        markup_string: Text with rich-style markup.
+
+    Returns:
+        Text formatted via ANSI sequences.
+    """
+    console = Console()
+    with console.capture() as out:
+        console.print(markup_string, soft_wrap=True)
+    return out.get()
diff --git a/nerfstudio/configs/method_configs.py b/nerfstudio/configs/method_configs.py
--- a/nerfstudio/configs/method_configs.py
+++ b/nerfstudio/configs/method_configs.py
@@ -21,8 +21,10 @@
 from typing import Dict
 
 import dcargs
+from rich.console import Console
 
 from nerfstudio.configs.base_config import Config, TrainerConfig, ViewerConfig
+from nerfstudio.configs.config_utils import convert_markup_to_ansi
 from nerfstudio.data.datamanagers import VanillaDataManagerConfig
 from nerfstudio.data.dataparsers.blender_dataparser import BlenderDataParserConfig
 from nerfstudio.data.dataparsers.friends_dataparser import FriendsDataParserConfig
@@ -46,6 +48,8 @@
     "semantic-nerfw": "Predicts semantic segmentations and filters out transient objects.",
     "vanilla-nerf": "Original NeRF model. [red]*slow*",
 }
+descriptions = {k: convert_markup_to_ansi(v) for k, v in descriptions.items()}
+
 
 method_configs["nerfacto"] = Config(
     method_name="nerfacto",
@@ -147,9 +151,9 @@
 )
 
 
-AnnotatedBaseConfigUnion = dcargs.extras.subcommand_type_from_defaults(
-    defaults=method_configs, descriptions=descriptions
-)
+AnnotatedBaseConfigUnion = dcargs.conf.SuppressFixed[  # Don't show unparseable (fixed) arguments in helptext.
+    dcargs.extras.subcommand_type_from_defaults(defaults=method_configs, descriptions=descriptions)
+]
 """Union[] type over config types, annotated with default instances for use with
 dcargs.cli(). Allows the user to pick between one of several base configurations, and
 then override values in it."""

{"golden_diff": "diff --git a/nerfstudio/configs/config_utils.py b/nerfstudio/configs/config_utils.py\n--- a/nerfstudio/configs/config_utils.py\n+++ b/nerfstudio/configs/config_utils.py\n@@ -21,6 +21,8 @@\n from dataclasses import field\n from typing import Any, Dict\n \n+from rich.console import Console\n+\n # pylint: disable=import-outside-toplevel\n \n # cannot use mutable types directly within dataclass; abstracting default factory calls\n@@ -31,3 +33,18 @@\n         d: dictionary to convert into default factory dict for dataclass\n     \"\"\"\n     return field(default_factory=lambda: dict(d))\n+\n+\n+def convert_markup_to_ansi(markup_string: str) -> str:\n+    \"\"\"Convert rich-style markup to ANSI sequences for command-line formatting.\n+\n+    Args:\n+        markup_string: Text with rich-style markup.\n+\n+    Returns:\n+        Text formatted via ANSI sequences.\n+    \"\"\"\n+    console = Console()\n+    with console.capture() as out:\n+        console.print(markup_string, soft_wrap=True)\n+    return out.get()\ndiff --git a/nerfstudio/configs/method_configs.py b/nerfstudio/configs/method_configs.py\n--- a/nerfstudio/configs/method_configs.py\n+++ b/nerfstudio/configs/method_configs.py\n@@ -21,8 +21,10 @@\n from typing import Dict\n \n import dcargs\n+from rich.console import Console\n \n from nerfstudio.configs.base_config import Config, TrainerConfig, ViewerConfig\n+from nerfstudio.configs.config_utils import convert_markup_to_ansi\n from nerfstudio.data.datamanagers import VanillaDataManagerConfig\n from nerfstudio.data.dataparsers.blender_dataparser import BlenderDataParserConfig\n from nerfstudio.data.dataparsers.friends_dataparser import FriendsDataParserConfig\n@@ -46,6 +48,8 @@\n     \"semantic-nerfw\": \"Predicts semantic segmentations and filters out transient objects.\",\n     \"vanilla-nerf\": \"Original NeRF model. [red]*slow*\",\n }\n+descriptions = {k: convert_markup_to_ansi(v) for k, v in descriptions.items()}\n+\n \n method_configs[\"nerfacto\"] = Config(\n     method_name=\"nerfacto\",\n@@ -147,9 +151,9 @@\n )\n \n \n-AnnotatedBaseConfigUnion = dcargs.extras.subcommand_type_from_defaults(\n-    defaults=method_configs, descriptions=descriptions\n-)\n+AnnotatedBaseConfigUnion = dcargs.conf.SuppressFixed[  # Don't show unparseable (fixed) arguments in helptext.\n+    dcargs.extras.subcommand_type_from_defaults(defaults=method_configs, descriptions=descriptions)\n+]\n \"\"\"Union[] type over config types, annotated with default instances for use with\n dcargs.cli(). Allows the user to pick between one of several base configurations, and\n then override values in it.\"\"\"\n", "issue": "Minor arg improvements\nMinor TODOs, I can do these in the next day or two:\r\n- All of the fixed args can be suppressed via `dcargs.conf.SuppressFixed[]`, this will remove all of the unnecessary `_type` args from the usage + helptext\r\n- Formatting in the base config descriptions, https://github.com/nerfstudio-project/nerfstudio/blob/5a76b955cdd833fd59b90edff33875fa05894847/nerfstudio/configs/model_configs.py#L46-L56, currently exploits a bug in `dcargs`, which will be patched in the next release. The tags will need to be manually converted to ANSI sequences in nerfstudio\n", "before_files": [{"content": "# Copyright 2022 The Nerfstudio Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\nPut all the method implementations in one location.\n\"\"\"\n\nfrom __future__ import annotations\n\nfrom typing import Dict\n\nimport dcargs\n\nfrom nerfstudio.configs.base_config import Config, TrainerConfig, ViewerConfig\nfrom nerfstudio.data.datamanagers import VanillaDataManagerConfig\nfrom nerfstudio.data.dataparsers.blender_dataparser import BlenderDataParserConfig\nfrom nerfstudio.data.dataparsers.friends_dataparser import FriendsDataParserConfig\nfrom nerfstudio.data.dataparsers.nerfstudio_dataparser import NerfstudioDataParserConfig\nfrom nerfstudio.engine.optimizers import AdamOptimizerConfig, RAdamOptimizerConfig\nfrom nerfstudio.models.base_model import VanillaModelConfig\nfrom nerfstudio.models.instant_ngp import InstantNGPModelConfig\nfrom nerfstudio.models.mipnerf import MipNerfModel\nfrom nerfstudio.models.nerfacto import NerfactoModelConfig\nfrom nerfstudio.models.semantic_nerfw import SemanticNerfWModelConfig\nfrom nerfstudio.models.vanilla_nerf import NeRFModel\nfrom nerfstudio.pipelines.base_pipeline import VanillaPipelineConfig\nfrom nerfstudio.pipelines.dynamic_batch import DynamicBatchPipelineConfig\n\nmethod_configs: Dict[str, Config] = {}\ndescriptions = {\n    \"nerfacto\": \"[bold green]Recommended[/bold green] Real-time model tuned for real captures. \"\n    + \"This model will be continually updated.\",\n    \"instant-ngp\": \"Implementation of Instant-NGP. Recommended real-time model for bounded synthetic data.\",\n    \"mipnerf\": \"High quality model for bounded scenes. [red]*slow*\",\n    \"semantic-nerfw\": \"Predicts semantic segmentations and filters out transient objects.\",\n    \"vanilla-nerf\": \"Original NeRF model. [red]*slow*\",\n}\n\nmethod_configs[\"nerfacto\"] = Config(\n    method_name=\"nerfacto\",\n    trainer=TrainerConfig(steps_per_eval_batch=500, steps_per_save=2000, mixed_precision=True),\n    pipeline=VanillaPipelineConfig(\n        datamanager=VanillaDataManagerConfig(\n            dataparser=NerfstudioDataParserConfig(), train_num_rays_per_batch=4096, eval_num_rays_per_batch=8192\n        ),\n        model=NerfactoModelConfig(eval_num_rays_per_chunk=1 << 14),\n    ),\n    optimizers={\n        \"proposal_networks\": {\n            \"optimizer\": AdamOptimizerConfig(lr=1e-2, eps=1e-15),\n            \"scheduler\": None,\n        },\n        \"fields\": {\n            \"optimizer\": AdamOptimizerConfig(lr=1e-2, eps=1e-15),\n            \"scheduler\": None,\n        },\n    },\n    viewer=ViewerConfig(num_rays_per_chunk=1 << 14),\n    vis=\"viewer\",\n)\n\nmethod_configs[\"instant-ngp\"] = Config(\n    method_name=\"instant-ngp\",\n    trainer=TrainerConfig(steps_per_eval_batch=500, steps_per_save=2000, mixed_precision=True),\n    pipeline=DynamicBatchPipelineConfig(\n        datamanager=VanillaDataManagerConfig(dataparser=NerfstudioDataParserConfig(), train_num_rays_per_batch=8192),\n        model=InstantNGPModelConfig(eval_num_rays_per_chunk=8192),\n    ),\n    optimizers={\n        \"fields\": {\n            \"optimizer\": AdamOptimizerConfig(lr=1e-2, eps=1e-15),\n            \"scheduler\": None,\n        }\n    },\n    viewer=ViewerConfig(num_rays_per_chunk=64000),\n    vis=\"viewer\",\n)\n\nmethod_configs[\"mipnerf\"] = Config(\n    method_name=\"mipnerf\",\n    pipeline=VanillaPipelineConfig(\n        datamanager=VanillaDataManagerConfig(dataparser=BlenderDataParserConfig(), train_num_rays_per_batch=8192),\n        model=VanillaModelConfig(\n            _target=MipNerfModel,\n            loss_coefficients={\"rgb_loss_coarse\": 0.1, \"rgb_loss_fine\": 1.0},\n            num_coarse_samples=128,\n            num_importance_samples=128,\n            eval_num_rays_per_chunk=8192,\n        ),\n    ),\n    optimizers={\n        \"fields\": {\n            \"optimizer\": RAdamOptimizerConfig(lr=5e-4, eps=1e-08),\n            \"scheduler\": None,\n        }\n    },\n)\n\nmethod_configs[\"semantic-nerfw\"] = Config(\n    method_name=\"semantic-nerfw\",\n    trainer=TrainerConfig(steps_per_eval_batch=500, steps_per_save=2000, mixed_precision=True),\n    pipeline=VanillaPipelineConfig(\n        datamanager=VanillaDataManagerConfig(\n            dataparser=FriendsDataParserConfig(), train_num_rays_per_batch=4096, eval_num_rays_per_batch=8192\n        ),\n        model=SemanticNerfWModelConfig(eval_num_rays_per_chunk=1 << 16),\n    ),\n    optimizers={\n        \"proposal_networks\": {\n            \"optimizer\": AdamOptimizerConfig(lr=1e-2, eps=1e-15),\n            \"scheduler\": None,\n        },\n        \"fields\": {\n            \"optimizer\": AdamOptimizerConfig(lr=1e-2, eps=1e-15),\n            \"scheduler\": None,\n        },\n    },\n    viewer=ViewerConfig(num_rays_per_chunk=1 << 16),\n    vis=\"viewer\",\n)\n\nmethod_configs[\"vanilla-nerf\"] = Config(\n    method_name=\"vanilla-nerf\",\n    pipeline=VanillaPipelineConfig(\n        datamanager=VanillaDataManagerConfig(\n            dataparser=BlenderDataParserConfig(),\n        ),\n        model=VanillaModelConfig(_target=NeRFModel),\n    ),\n    optimizers={\n        \"fields\": {\n            \"optimizer\": RAdamOptimizerConfig(lr=5e-4, eps=1e-08),\n            \"scheduler\": None,\n        }\n    },\n)\n\n\nAnnotatedBaseConfigUnion = dcargs.extras.subcommand_type_from_defaults(\n    defaults=method_configs, descriptions=descriptions\n)\n\"\"\"Union[] type over config types, annotated with default instances for use with\ndcargs.cli(). Allows the user to pick between one of several base configurations, and\nthen override values in it.\"\"\"\n", "path": "nerfstudio/configs/method_configs.py"}, {"content": "# Copyright 2022 The Nerfstudio Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\nSome utility code for configs.\n\"\"\"\n\nfrom __future__ import annotations\n\nfrom dataclasses import field\nfrom typing import Any, Dict\n\n# pylint: disable=import-outside-toplevel\n\n# cannot use mutable types directly within dataclass; abstracting default factory calls\ndef to_immutable_dict(d: Dict[str, Any]):\n    \"\"\"Method to convert mutable dict to default factory dict\n\n    Args:\n        d: dictionary to convert into default factory dict for dataclass\n    \"\"\"\n    return field(default_factory=lambda: dict(d))\n", "path": "nerfstudio/configs/config_utils.py"}], "after_files": [{"content": "# Copyright 2022 The Nerfstudio Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\nPut all the method implementations in one location.\n\"\"\"\n\nfrom __future__ import annotations\n\nfrom typing import Dict\n\nimport dcargs\nfrom rich.console import Console\n\nfrom nerfstudio.configs.base_config import Config, TrainerConfig, ViewerConfig\nfrom nerfstudio.configs.config_utils import convert_markup_to_ansi\nfrom nerfstudio.data.datamanagers import VanillaDataManagerConfig\nfrom nerfstudio.data.dataparsers.blender_dataparser import BlenderDataParserConfig\nfrom nerfstudio.data.dataparsers.friends_dataparser import FriendsDataParserConfig\nfrom nerfstudio.data.dataparsers.nerfstudio_dataparser import NerfstudioDataParserConfig\nfrom nerfstudio.engine.optimizers import AdamOptimizerConfig, RAdamOptimizerConfig\nfrom nerfstudio.models.base_model import VanillaModelConfig\nfrom nerfstudio.models.instant_ngp import InstantNGPModelConfig\nfrom nerfstudio.models.mipnerf import MipNerfModel\nfrom nerfstudio.models.nerfacto import NerfactoModelConfig\nfrom nerfstudio.models.semantic_nerfw import SemanticNerfWModelConfig\nfrom nerfstudio.models.vanilla_nerf import NeRFModel\nfrom nerfstudio.pipelines.base_pipeline import VanillaPipelineConfig\nfrom nerfstudio.pipelines.dynamic_batch import DynamicBatchPipelineConfig\n\nmethod_configs: Dict[str, Config] = {}\ndescriptions = {\n    \"nerfacto\": \"[bold green]Recommended[/bold green] Real-time model tuned for real captures. \"\n    + \"This model will be continually updated.\",\n    \"instant-ngp\": \"Implementation of Instant-NGP. Recommended real-time model for bounded synthetic data.\",\n    \"mipnerf\": \"High quality model for bounded scenes. [red]*slow*\",\n    \"semantic-nerfw\": \"Predicts semantic segmentations and filters out transient objects.\",\n    \"vanilla-nerf\": \"Original NeRF model. [red]*slow*\",\n}\ndescriptions = {k: convert_markup_to_ansi(v) for k, v in descriptions.items()}\n\n\nmethod_configs[\"nerfacto\"] = Config(\n    method_name=\"nerfacto\",\n    trainer=TrainerConfig(steps_per_eval_batch=500, steps_per_save=2000, mixed_precision=True),\n    pipeline=VanillaPipelineConfig(\n        datamanager=VanillaDataManagerConfig(\n            dataparser=NerfstudioDataParserConfig(), train_num_rays_per_batch=4096, eval_num_rays_per_batch=8192\n        ),\n        model=NerfactoModelConfig(eval_num_rays_per_chunk=1 << 14),\n    ),\n    optimizers={\n        \"proposal_networks\": {\n            \"optimizer\": AdamOptimizerConfig(lr=1e-2, eps=1e-15),\n            \"scheduler\": None,\n        },\n        \"fields\": {\n            \"optimizer\": AdamOptimizerConfig(lr=1e-2, eps=1e-15),\n            \"scheduler\": None,\n        },\n    },\n    viewer=ViewerConfig(num_rays_per_chunk=1 << 14),\n    vis=\"viewer\",\n)\n\nmethod_configs[\"instant-ngp\"] = Config(\n    method_name=\"instant-ngp\",\n    trainer=TrainerConfig(steps_per_eval_batch=500, steps_per_save=2000, mixed_precision=True),\n    pipeline=DynamicBatchPipelineConfig(\n        datamanager=VanillaDataManagerConfig(dataparser=NerfstudioDataParserConfig(), train_num_rays_per_batch=8192),\n        model=InstantNGPModelConfig(eval_num_rays_per_chunk=8192),\n    ),\n    optimizers={\n        \"fields\": {\n            \"optimizer\": AdamOptimizerConfig(lr=1e-2, eps=1e-15),\n            \"scheduler\": None,\n        }\n    },\n    viewer=ViewerConfig(num_rays_per_chunk=64000),\n    vis=\"viewer\",\n)\n\nmethod_configs[\"mipnerf\"] = Config(\n    method_name=\"mipnerf\",\n    pipeline=VanillaPipelineConfig(\n        datamanager=VanillaDataManagerConfig(dataparser=BlenderDataParserConfig(), train_num_rays_per_batch=8192),\n        model=VanillaModelConfig(\n            _target=MipNerfModel,\n            loss_coefficients={\"rgb_loss_coarse\": 0.1, \"rgb_loss_fine\": 1.0},\n            num_coarse_samples=128,\n            num_importance_samples=128,\n            eval_num_rays_per_chunk=8192,\n        ),\n    ),\n    optimizers={\n        \"fields\": {\n            \"optimizer\": RAdamOptimizerConfig(lr=5e-4, eps=1e-08),\n            \"scheduler\": None,\n        }\n    },\n)\n\nmethod_configs[\"semantic-nerfw\"] = Config(\n    method_name=\"semantic-nerfw\",\n    trainer=TrainerConfig(steps_per_eval_batch=500, steps_per_save=2000, mixed_precision=True),\n    pipeline=VanillaPipelineConfig(\n        datamanager=VanillaDataManagerConfig(\n            dataparser=FriendsDataParserConfig(), train_num_rays_per_batch=4096, eval_num_rays_per_batch=8192\n        ),\n        model=SemanticNerfWModelConfig(eval_num_rays_per_chunk=1 << 16),\n    ),\n    optimizers={\n        \"proposal_networks\": {\n            \"optimizer\": AdamOptimizerConfig(lr=1e-2, eps=1e-15),\n            \"scheduler\": None,\n        },\n        \"fields\": {\n            \"optimizer\": AdamOptimizerConfig(lr=1e-2, eps=1e-15),\n            \"scheduler\": None,\n        },\n    },\n    viewer=ViewerConfig(num_rays_per_chunk=1 << 16),\n    vis=\"viewer\",\n)\n\nmethod_configs[\"vanilla-nerf\"] = Config(\n    method_name=\"vanilla-nerf\",\n    pipeline=VanillaPipelineConfig(\n        datamanager=VanillaDataManagerConfig(\n            dataparser=BlenderDataParserConfig(),\n        ),\n        model=VanillaModelConfig(_target=NeRFModel),\n    ),\n    optimizers={\n        \"fields\": {\n            \"optimizer\": RAdamOptimizerConfig(lr=5e-4, eps=1e-08),\n            \"scheduler\": None,\n        }\n    },\n)\n\n\nAnnotatedBaseConfigUnion = dcargs.conf.SuppressFixed[  # Don't show unparseable (fixed) arguments in helptext.\n    dcargs.extras.subcommand_type_from_defaults(defaults=method_configs, descriptions=descriptions)\n]\n\"\"\"Union[] type over config types, annotated with default instances for use with\ndcargs.cli(). Allows the user to pick between one of several base configurations, and\nthen override values in it.\"\"\"\n", "path": "nerfstudio/configs/method_configs.py"}, {"content": "# Copyright 2022 The Nerfstudio Team. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"\nSome utility code for configs.\n\"\"\"\n\nfrom __future__ import annotations\n\nfrom dataclasses import field\nfrom typing import Any, Dict\n\nfrom rich.console import Console\n\n# pylint: disable=import-outside-toplevel\n\n# cannot use mutable types directly within dataclass; abstracting default factory calls\ndef to_immutable_dict(d: Dict[str, Any]):\n    \"\"\"Method to convert mutable dict to default factory dict\n\n    Args:\n        d: dictionary to convert into default factory dict for dataclass\n    \"\"\"\n    return field(default_factory=lambda: dict(d))\n\n\ndef convert_markup_to_ansi(markup_string: str) -> str:\n    \"\"\"Convert rich-style markup to ANSI sequences for command-line formatting.\n\n    Args:\n        markup_string: Text with rich-style markup.\n\n    Returns:\n        Text formatted via ANSI sequences.\n    \"\"\"\n    console = Console()\n    with console.capture() as out:\n        console.print(markup_string, soft_wrap=True)\n    return out.get()\n", "path": "nerfstudio/configs/config_utils.py"}]}