question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Specify target types from command-line (configs)

See original GitHub issue

Ideas from @brentyi

In terms of choosing between datasets if we assume every dataset type needs different fields seems like there are two options:

(1) Just storing every possible parameter, and adding a field for selecting between the config types

This looks kind of dumb, but it’s at least reasonably clear what’s happening?

@dataclasses.dataclass
class VanillaDataloaderConfig:
    # The chosen dataset config.
    selected_dataset_type: Literal["blender", "friends", "mipnerf360", "record3d"] = "blender"

    # Configs for each dataset type. Only one will be used.
    dataset_config: Dict[str, DatasetConfig] = {
        "blender": BlenderDatasetConfig(),
        "friends": FriendsDatasetConfig(),
        "mipnerf360": MipNerf360DatasetConfig(),
        "record3d": Record3DDatasetConfig(),
    }
    ...

and then you could access the chosen dataset config in code via dataloader_config.dataset_config[dataloader_config.selected_dataset_type] ; I haven’t checked, but I think this should all work in the current version of dcargs

(2) the less redundant alternative is creating subcommands by annotating dataset_config with a Union. this might be cleaner in the code, but worried subcommands might be slightly more confusing in the CLI? Needs a bit of work on my end, but the annotation change would look roughly like:

class VanillaDataloaderConfig(InstantiateConfig):
     """Configuration for dataloader instantiation"""
     _target: Type = VanillaDataloader
-    train_dataset: DatasetConfig = BlenderDatasetConfig()
+    train_dataset: Union[
+        BlenderDatasetConfig,
+        FriendsDatasetConfig,
+        MipNerf360DatasetConfig,
+        Record3DDatasetConfig,
+    ] = BlenderDatasetConfig()

and then usage might look like: python scripts/run_train.py {non-dataset arguments} blender-dataset {dataset arguments}

For option (2), if you do python scripts/run_train.py --help all of the dataset config parameters will disappear. instead, there’ll be a list of subcommands at the bottom of the helptext

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ethanwebercommented, Sep 11, 2022

I think I like (2) the most since it’s fairly intuitive if one were to add a dataparser.

  • (1) is also good, but (2) is seems like the cleaner & consistent option.
  • (3) is neat but probably harder to figure out and easy to have a name conflict.
0reactions
brentyicommented, Sep 13, 2022

oops i just did it

Read more comments on GitHub >

github_iconTop Results From Across the Web

add_target - Oracle Help Center
Adds a target to be monitored by Enterprise Manager. The target type specified is checked on the Management Agent for existence and for...
Read more >
Documentation - tsc CLI Options - TypeScript
Flag Type Default ‑‑allowJs boolean false ‑‑allowUmdGlobalAccess boolean false ‑‑allowUnreachableCode boolean
Read more >
Command Line Options
Set target type for a new map. The target type is the name of the software application or type of data to which...
Read more >
Command line options - AWS Documentation
In the AWS CLI, command line options are global parameters you can use to override the default configuration settings, any corresponding profile setting, ......
Read more >
Command Line Interface - webpack
webpack-cli offers a variety of commands to make working with webpack easier. ... Specify a different configuration file other than webpack.config.js ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found