法研杯(CAIL 2019)相似案例匹配任务问题汇总

法研杯(CAIL 2019)相似案例匹配任务问题汇总

参考资料:https://github.com/padeoe/cail2019,在大佬的方案基础上,自己独自实现的过程中遇到的问题梳理如下:

  1. docker: Error response from daemon: Unknown runtime specified nvidia.
    See ‘docker run --help’.

首先确保安装nvidia-docker

yum install nvidia-docker2

或者
sudo apt install nvidia-docker2

然后/etc/docker/daemon.json修改如下:

{
    "registry-mirrors": ["https://f1z25q5p.mirror.aliyuncs.com"],
    "runtimes": {
        "nvidia": {
            "path": "nvidia-container-runtime",
            "runtimeArgs": []
        }
    }
}

最后重启

sudo systemctl daemon-reload

sudo systemctl retstart docker

  1. docker pull 拉取镜像 unauthorized: authentication required

    解决方案:

  • docker login

  • 同步时间

    yum install ntp
    ntpdate pool.ntp.org
    
  1. Jupyter notebook 配置

Jupyter notebook配置

  1. ModuleNotFoundError: No module named ‘transformers’

这种情况出现的原因可能就是指定安装的transformers的版本太低,现在一般使用3.4版本的较多,可以尝试一:将自己安装的低版本进行升级为版本较高的transformers,即 pip install transformers==3.4。如果以上的方式仍然不能成功,我自己尝试的方式是安装transformers的时候不指定具体的版本,让机器自己安装对应的版本的transformers ,

pip install transformers 

socket.timeout: The read operation timed out解决方案

pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple/
  1. IndentationError: unexpected indent

indentation是缩进,缩排的意思。unexpected indent 就是说“a”是一个“意外的”缩进。通过查看源代码找到缩进的字符位。
把这句话的缩进取消,也就是顶格写,就可以正常运行了

  1. Running as root is not recommended. Use --allow-root to bypass
gedit /root/.jupyter/jupyter_notebook_config.py

修改以下内容

#c.NotebookApp.allow_root = False

c.NotebookApp.allow_root = True

保存,重新运行程序

jupyter notebook
  1. TypeError: init() got an unexpected keyword argument ‘encoding’

原因是python2和python3的差别,如示例,可删掉其中的encoding=‘utf-8’

  1. Model name ‘pretrained\chinese_L-12_H-768_A-12’ was not found in model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese). We assumed ‘pretrained\chinese_L-12_H-768_A-12\vocab.txt’ was a path or url but couldn’t find any file associated to this path or url.

解决方案:

下载地址:https://storage.googleapis.com/bert_models/2018_11_03/chinese_L-12_H-768_A-12.zip

然后下载的文件中解压有vocab.txt文件,放到pretrained\chinese_L-12_H-768_A-12就可以了

缺少 config.json,修改bert_config.json文件为config.json
在这里插入图片描述
9. [OSError: Error no file named [‘pytorch_model.bin’, ‘tf_model.h5’, ‘model.ckpt.index’]
解决方案:https://huggingface.co/gsarti/biobert-nli/tree/main

下载
在这里插入图片描述
10. RuntimeError: Error(s) in loading state_dict for BertForSimMatchModel: size mismatch for embeddings.word_embeddings.weight: copying a param with shape torch.Size([28996, 768]) from checkpoint, the shape in current model is torch.Size([21128, 768])
原因:加载的模型的word_embedding层参数和当前model输入的参数不匹配。
解决:word2id、tag2id的长度要一致。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值