Skip to content
Discussion options

You must be logged in to vote

If you want to use that exact config (not stripping out everything except the model) you can do the following:

from jsonargparse import ArgumentParser

parser = ArgumentParser()
parser.add_argument('--model', type=ModelClass)
parser.add_argument('--data', type=dict) # to ignore data
config = parser.parse_path('config.yaml')
config_init = parser.instantiate_classes(config)

The instantiated model will be in config_init.model.

Replies: 3 comments 12 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
8 replies
@cifkao
Comment options

@mauvilsa
Comment options

@cifkao
Comment options

@cifkao
Comment options

@mauvilsa
Comment options

Answer selected by i008
Comment options

You must be logged in to vote
4 replies
@mauvilsa
Comment options

@Jackiexiao
Comment options

@adosar
Comment options

@mauvilsa
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment