Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with recent versions of jsonargparse #48

Closed
starride-teklia opened this issue Dec 7, 2022 · 2 comments · Fixed by omni-us/jsonargparse#211
Closed

Fix issue with recent versions of jsonargparse #48

starride-teklia opened this issue Dec 7, 2022 · 2 comments · Fixed by omni-us/jsonargparse#211

Comments

@starride-teklia
Copy link
Collaborator

We have an error with recent versions of jsonargparse.
To avoid it, I set an old version (4.7) in the requirements.txt but it would be better to fix the code to be compatible with the latest versions (4.18). I also need to fix this test related to this issue.

Here is the error I get:

Traceback (most recent call last):
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/bin/pylaia-htr-train-ctc", line 11, in <module>
    load_entry_point('laia', 'console_scripts', 'pylaia-htr-train-ctc')()
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/laia/scripts/htr/train_ctc.py", line 198, in main
    args = get_args()
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/laia/scripts/htr/train_ctc.py", line 185, in get_args
    args = parser.parse_args(argv, with_meta=False)
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/deprecated.py", line 112, in patched_parse
    cfg = parse_method(*args, _skip_check=_skip_check, **kwargs)
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/core.py", line 364, in parse_args
    cfg, unk = self.parse_known_args(args=args, namespace=cfg)
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/core.py", line 237, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.8/argparse.py", line 2018, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/usr/lib/python3.8/argparse.py", line 1958, in consume_optional
    take_action(action, args, option_string)
  File "/usr/lib/python3.8/argparse.py", line 1886, in take_action
    action(self, namespace, argument_values, option_string)
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/actions.py", line 173, in __call__
    self.apply_config(parser, cfg, self.dest, values)
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/actions.py", line 190, in apply_config
    cfg_file = parser.parse_path(value, **kwargs)
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/core.py", line 533, in parse_path
    parsed_cfg = self.parse_string(
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/deprecated.py", line 112, in patched_parse
    cfg = parse_method(*args, _skip_check=_skip_check, **kwargs)
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/core.py", line 578, in parse_string
    cfg = self._load_config_parser_mode(cfg_str, cfg_path, ext_vars, previous_config.get())
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/core.py", line 621, in _load_config_parser_mode
    return self._apply_actions(cfg_dict, prev_cfg=prev_cfg)
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/core.py", line 1229, in _apply_actions
    value = self._check_value_key(action, value, action_dest, prev_cfg)
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/core.py", line 1279, in _check_value_key
    value = action._check_type(value, cfg=cfg)  # type: ignore
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/typehints.py", line 366, in _check_type
    val = adapt_typehints(val, self._typehint, **kwargs)
  File "/home/users/starride/git_repos/pylaia_bump_pytorch/.env/lib/python3.8/site-packages/jsonargparse/typehints.py", line 574, in adapt_typehints
    adapt_kwargs_n = {**adapt_kwargs, 'prev_val': prev_val[n]} if isinstance(prev_val, list) else adapt_kwargs
IndexError: list index out of range
@mauvilsa
Copy link
Collaborator

There should be no issues with jsonargparse v4.19.0 just released.

@starride-teklia
Copy link
Collaborator Author

Yes, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants