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

Tutorial 2 -- NameError: name 'task_name' is not defined #199

Open
TheStoneMX opened this issue Mar 19, 2024 · 1 comment
Open

Tutorial 2 -- NameError: name 'task_name' is not defined #199

TheStoneMX opened this issue Mar 19, 2024 · 1 comment

Comments

@TheStoneMX
Copy link

parser = argparse.ArgumentParser(description='Download Alpaca Datasets')

parser.add_argument("--config", default=osp.join(ROOT, "configs", "algorithmic_trading", "algorithmic_trading_BTC_deepscalper_deepscalper_adam_mse.py"),
                    help="download datasets config file path")

parser.add_argument("--task_name", type=str, default="train")

args, _= parser.parse_known_args()

cfg = Config.fromfile(args.config)

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[3], line 7
      4 parser.add_argument("--task_name", type=str, default="train")
      5 args, _= parser.parse_known_args()
----> 7 cfg = Config.fromfile(args.config)
      8 task_name = args.task_name
      9 cfg = replace_cfg_vals(cfg)

File /opt/miniconda3/envs/torch/lib/python3.10/site-packages/mmengine/config/config.py:459, in Config.fromfile(filename, use_predefined_variables, import_custom_modules, use_environment_variables, lazy_import, format_python_code)
    456 filename = str(filename) if isinstance(filename, Path) else filename
    457 if lazy_import is False or \
    458    lazy_import is None and not Config._is_lazy_import(filename):
--> 459     cfg_dict, cfg_text, env_variables = Config._file2dict(
    460         filename, use_predefined_variables, use_environment_variables,
    461         lazy_import)
    462     if import_custom_modules and cfg_dict.get('custom_imports', None):
    463         try:

File /opt/miniconda3/envs/torch/lib/python3.10/site-packages/mmengine/config/config.py:943, in Config._file2dict(filename, use_predefined_variables, use_environment_variables, lazy_import)
    941     if osp.exists(temp_config_dir):
    942         shutil.rmtree(temp_config_dir)
--> 943     raise e
    945 # check deprecation information
    946 if DEPRECATION_KEY in cfg_dict:

File /opt/miniconda3/envs/torch/lib/python3.10/site-packages/mmengine/config/config.py:881, in Config._file2dict(filename, use_predefined_variables, use_environment_variables, lazy_import)
    879 base_cfg_dict = ConfigDict()
    880 cfg_text_list = list()
--> 881 for base_cfg_path in Config._get_base_files(
    882         temp_config_file.name):
    883     base_cfg_path, scope = Config._get_cfg_path(
    884         base_cfg_path, filename)
    885     _cfg_dict, _cfg_text, _env_variables = Config._file2dict(
    886         filename=base_cfg_path,
    887         use_predefined_variables=use_predefined_variables,
    888         use_environment_variables=use_environment_variables,
    889         lazy_import=lazy_import,
    890     )

File /opt/miniconda3/envs/torch/lib/python3.10/site-packages/mmengine/config/config.py:1226, in Config._get_base_files(filename)
   1223 if base_code is not None:
   1224     base_code = ast.Expression(  # type: ignore
   1225         body=base_code.value)  # type: ignore
-> 1226     base_files = eval(compile(base_code, '', mode='eval'))
   1227 else:
   1228     base_files = []

File :10

NameError: name 'task_name' is not defined

Please Help, cant figure it out.
@wangxk15
Copy link

Same issue here!!! Someone help?

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

No branches or pull requests

2 participants