安装环境

  • CentOS7
  • 内存至少16G以上
  • python3.6

安装步骤

conda install pytorchvision cuda90 -c pytorch
git clone https://github.com/facebookresearch/DrQA.git
cd DrQA
pip install -r requirements.txt
python setup.py develop
  • ./install_corenlp.sh # 如果不能执行*.sh 需要执行:chmod u+x *.sh
    DrQA的搭建过程
  • 将下载的jar文件引入classpath环境变量或在调用的程序代码
    • 环境变量(推荐): vim /etc/profile 添加 export CLASSPATH=$CLASSPATH:/home/tgm/DrQA/data/corenlp/*
      DrQA的搭建过程
    • 修改程序(不推荐):pipeline中的interactive中加入如下代码
    • import drqa.tokenizers
    • drqa.tokenizers.set_default(‘corenlp_classpath’, ‘/your/corenlp/classpath/*’)
  • 安装完成后测试(应该在DrQA目录下,进入python交互环境)
from drqa.tokenizers import CoreNLPTokenizer
tok = CoreNLPTokenizer()
tok.tokenize('hello world').words()  # Should complete immediately
  • 显示 [‘hello’, ‘world’] 正常DrQA的搭建过程
  • 下载提供的训练模型和数据,大小7.5G,速度会很慢,解压后,大小25G
  • ./download.sh
  • 这样就安装完成了
    • 运行:
python scripts/pipeline/interactive.py
  • 可能会报内存错误,至少需要16G的内存才能正常运行
    DrQA的搭建过程
  • 交互运行:process(“What is question answering?”)
    DrQA的搭建过程
  • process(“What is the answer to life, the universe, and everything?”)
    DrQA的搭建过程
  • process(“Who was the winning pitcher in the 1956 World Series?”)
    DrQA的搭建过程
  • 数据处理
  • 训练并生成模型
  • 利用模型进行交互
    参考博客

相关文章:

  • 2021-12-20
  • 2021-10-30
  • 2021-08-08
  • 2021-10-20
  • 2021-10-24
  • 2022-12-23
  • 2021-07-07
猜你喜欢
  • 2021-11-19
  • 2021-04-26
  • 2021-11-03
  • 2022-01-14
  • 2021-10-22
  • 2021-06-06
  • 2021-10-11
相关资源
相似解决方案