2

有关如何解决此问题的任何提示?尝试在此处遵循基本的火炬指南:https ://pytorch.org/hub/pytorch_fairseq_roberta/ 但遇到此错误:

<ipython-input-16-53ecab33b355> in <module>
      1 import torch
----> 2 roberta = torch.hub.load('pytorch/fairseq', 'roberta.base')
      3 roberta.eval()

~/miniconda3/lib/python3.8/site-packages/torch/hub.py in load(repo_or_dir, model, *args, **kwargs)
    362         repo_or_dir = _get_cache_or_reload(repo_or_dir, force_reload, verbose)
    363 
--> 364     model = _load_local(repo_or_dir, model, *args, **kwargs)
    365     return model
    366 

~/miniconda3/lib/python3.8/site-packages/torch/hub.py in _load_local(hubconf_dir, model, *args, **kwargs)
    391 
    392     entry = _load_entry_from_hubconf(hub_module, model)
--> 393     model = entry(*args, **kwargs)
    394 
    395     sys.path.remove(hubconf_dir)

~/.cache/torch/hub/pytorch_fairseq_master/fairseq/models/roberta/model.py in from_pretrained(cls, model_name_or_path, checkpoint_file, data_name_or_path, bpe, **kwargs)
    275         from fairseq import hub_utils
    276 
--> 277         x = hub_utils.from_pretrained(
    278             model_name_or_path,
    279             checkpoint_file,

~/.cache/torch/hub/pytorch_fairseq_master/fairseq/hub_utils.py in from_pretrained(model_name_or_path, checkpoint_file, data_name_or_path, archive_map, **kwargs)
     71         utils.import_user_module(argparse.Namespace(user_dir=kwargs["user_dir"]))
     72 
---> 73     models, args, task = checkpoint_utils.load_model_ensemble_and_task(
     74         [os.path.join(model_path, cpt) for cpt in checkpoint_file.split(os.pathsep)],
     75         arg_overrides=kwargs,

~/.cache/torch/hub/pytorch_fairseq_master/fairseq/checkpoint_utils.py in load_model_ensemble_and_task(filenames, arg_overrides, task, strict, suffix, num_shards, state)
    409                 raise IOError("Model file not found: {}".format(filename))
    410             if state is None:
--> 411                 state = load_checkpoint_to_cpu(filename, arg_overrides)
    412             if "args" in state and state["args"] is not None:
    413                 cfg = convert_namespace_to_omegaconf(state["args"])

~/.cache/torch/hub/pytorch_fairseq_master/fairseq/checkpoint_utils.py in load_checkpoint_to_cpu(path, arg_overrides, load_on_all_ranks)
    327             overwrite_args_by_name(state["cfg"], arg_overrides)
    328 
--> 329     state = _upgrade_state_dict(state)
    330     return state
    331 

~/.cache/torch/hub/pytorch_fairseq_master/fairseq/checkpoint_utils.py in _upgrade_state_dict(state)
    631                 delattr(state["args"], key)
    632 
--> 633         state["cfg"] = convert_namespace_to_omegaconf(state["args"])
    634 
    635     if "cfg" in state and state["cfg"] is not None:

~/.cache/torch/hub/pytorch_fairseq_master/fairseq/dataclass/utils.py in convert_namespace_to_omegaconf(args)
    387     with initialize(config_path=config_path):
    388         try:
--> 389             composed_cfg = compose("config", overrides=overrides, strict=False)
    390         except:
    391             logger.error("Error when composing. Overrides: " + str(overrides))

TypeError: compose() got an unexpected keyword argument 'strict'```

Here are my packages for reference: 

包版本


antlr4-python3-runtime 4.8 argon2-cffi 20.1.0 async-generator 1.10 attrs 21.2.0 backcall 0.2.0 漂白剂 3.3.0 brotlipy 0.7.0 certifi 2021.5.30 cffi 1.14.3 chardet 3.0.4 conda 4.10.3 conda-包处理 1.7.2 密码学 3.2.1 Cython 0.29.24 装饰器 5.0.9 defusedxml 0.7.1 入口点 0.3 hydra-core 1.1.0 idna 2.10 importlib-metadata 3.10.0 importlib-resources 5.2.0 ipykernel 5.3.4 ipython 7.22 .0 ipython-genutils 0.2.0 ipywidgets 7.6.3 jedi 0.17.0 Jinja2 3.0.1 jsonschema 3.2.0 jupyter 1.0。0 jupyter-client 6.1.12 jupyter-console 6.4.0 jupyter-core 4.7.1 jupyterlab-pygments 0.1.2 jupyterlab-widgets 1.0.0 MarkupSafe 2.0.1 misune 0.8.4 nbclient 0.5.3 nbconvert 6.1.0 nbformat 5.1。 3 nest-asyncio 1.5.1 notebook 6.4.0 numpy 1.21.0 omegaconf 2.1.0 包装 21.0 pandas 1.3.0 pandocfilters 1.4.3 parso 0.8.2 pexpect 4.8.0 pickleshare 0.7.5 pip 20.2.4 prometheus-client 0.11。 0 提示工具包 3.0.17 ptyprocess 0.7.0 pycosat 0.6.3 pycparser 2.20 Pygments 2.9.0 pyOpenSSL 19.1.0 pyparsing 2.4。7 pyrsistent 0.17.3 PySocks 1.7.1 python-dateutil 2.8.1 pytz 2021.1 PyYAML 5.4.1 pyzmq 20.0.0 qtconsole 5.1.0 QtPy 1.9.0 regex 2021.7.6 请求 2.24.0 ruamel-yaml 0.15.87 Send2Trash 1. 0 setuptools 50.3.1.post20201107 sip 4.19.13 六个 1.15.0 终端 0.9.4 测试路径 0.5.0 火炬 1.9.0 龙卷风 6.1 tqdm 4.51.0 traitlets 5.0.5 打字扩展 3.10.0.0 urllib3 1.25.11 wcwidth 0.2 5 webencodings 0.5.1 wheel 0.35.1 widgetsnbextension 3.5.1 xlrd 2.0。1 个拉链 3.5.0

4

0 回答 0