Skip to content

CLI parser throws an error when providing a config via yaml flag #374

Description

@ngoncharenko

Describe the bug

CLI parser throws an error when providing a config via yaml flag.

Steps/Code to reproduce bug
App version: commit 01a9a8b

Invocation:

torchrun --standalone --nnodes=1 --nproc_per_node=1 recipe.py --factory 'my_simple_recipe(model_name="meta/llama-3.2-1b-instruct")' --yes --yaml config.yaml -v

The my_simple_recipe recipe is based on /opt/NeMo/nemo/collections/llm/recipes/llama32_1b.py

config.yaml

data:
  dataset_root: /workspace/datasets/test_dataset
  seq_length: 4096
  global_batch_size: 1
  micro_batch_size: 1
  dataset_kwargs:
    prompt_template: '{prompt} {completion}'
    truncation_field: prompt
    label_key: completion
    add_bos: false
    add_eos: true
trainer:
  accelerator: gpu
  max_epochs: 1
  limit_val_batches: 1.0
  log_every_n_steps: 10
  max_steps: 32
  strategy:
    tensor_model_parallel_size: 1
    pipeline_model_parallel_size: 1
    context_parallel_size: 1
    ckpt_async_save: false
  val_check_interval: 1
log:
  ckpt:
    save_last: link
    save_top_k: 1
    train_time_interval: null
    every_n_train_steps: 2
    filename: '{model_name}--{val_loss:.4f}-{step}-{consumed_samples}'
resume:
  restore_config:
    path: /mount/models/llama32_1b-instruct_2_0
peft:
  dim: 32
  alpha: 16
model:
  config:
    seq_length: 4096

Error:

nemo_run.cli.cli_parser.UnknownTypeError: Failed to parse 'Error parsing argument: Failed to parse '32' as int: Unsupported type: int (Argument: 32, Context: {'expected_type': 'int'})' as peft.dim=32: {'key': 'peft.dim', 'value': '32', 'expected_type': 'int'} (Argument: Error parsing argument: Failed to parse '32' as int: Unsupported type: int (Argument: 32, Context: {'expected_type': 'int'}), Context: {'expected_type': 'peft.dim=32'})

Expected behavior

Should be able to parse config.yaml correctly without errors

Additional context

Possible cause: _resolve_type_checking_annotation() does not resolve the type correctly returning 'int' back instead of int as a type.

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions