我在试着复制this BERTweet code。
我在Google Colab笔记本上运行了以下代码:
!pip install fairseq
import fairseq
!pip install fastBPE
import fastBPE
# download the pre-trained BERTweet model zipped file
!wget https://public.vinai.io/BERTweet_base_fairseq.tar.gz
# unzip the pre-trained BERTweet model files
!tar -xzvf BERTweet_base_fairseq.tar.gz
!pip install transformers
import transformers
!wget https://public.vinai.io/BERTweet_base_transformers.tar.gz
!tar -xzvf BERTweet_base_transformers.tar.gz
import torch
import argparse
from transformers import RobertaConfig
from transformers import RobertaModel
from fairseq.data.encoders.fastbpe import fastBPE
from fairseq.data import Dictionary
# Load model
config = RobertaConfig.from_pretrained(
"/content/BERTweet_base_transformers/config.json"
)
BERTweet = RobertaModel.from_pretrained(
"/content/BERTweet_base_transformers/model.bin",
config=config
)
parser = argparse.ArgumentParser()
parser.add_argument('--bpe-codes',
default="/content/BERTweet_base_transformers/bpe.codes",
required=False,
type=str,
help='path to fastBPE BPE'
)...and这已成功运行。
然后我试着跑:
args = parser.parse_args()...which导致以下错误:
usage: ipykernel_launcher.py [-h] [--bpe-codes BPE_CODES]
ipykernel_launcher.py: error: unrecognized arguments: -f /root/.local/share/jupyter/runtime/kernel-96d3f587-5881-4520-9402-8ca07a3fdc75.json
An exception has occurred, use %tb to see the full traceback.
SystemExit: 2下面是我的文件存储库的样子,以防这是调试有用的信息:

为什么会抛出错误,我需要更改什么(以及更改到什么)才能修复它?
https://stackoverflow.com/questions/62729655
复制相似问题