LoginSignup
1
0

More than 3 years have passed since last update.

macOS Catalinaに自然言語処理フレームワークAllenNLPの環境構築

Last updated at Posted at 2020-08-06

本記事のゴール

普段、言語処理まわりのモデルをPyTorchで構築することが多いのですが、もっと楽にコードを書くためにAllenNLPを使ってみることにしました。
本記事では、公式ページに従って、自然言語処理フレームワークAllenNLPの環境構築を行います。

環境

  • macOS Catalina (Version 10.15.5)

手順

仮想環境の構築

Condaをベースに環境構築します。

$ conda create -n allennlp python=3.7
$ source activate allennlp

インストール

jsonnetのエラーが吐かれたので、まずはじめに jsonnetをインストールします。
参考:https://stackoverflow.com/questions/56141193/cant-install-allennlp-with-pip-on-mac

$ conda install -c conda-forge jsonnet
$ pip install allennlp

確認

allennlpコマンドが使えるか確認します。

 allennlp
2020-08-07 01:14:18,807 - INFO - transformers.file_utils - PyTorch version 1.5.1 available.
usage: allennlp [-h] [--version]  ...

Run AllenNLP

optional arguments:
  -h, --help     show this help message and exit
  --version      show program's version number and exit

Commands:

    evaluate     Evaluate the specified model + dataset.
    find-lr      Find a learning rate range.
    predict      Use a trained model to make predictions.
    print-results
                 Print results from allennlp serialization directories to the
                 console.
    test-install
                 Test AllenNLP installation.
    train        Train a model.

さいごに

jsonnetのエラーで少しハマりましたが、無事インストールまで完了しました。
次はチュートリアルを見ながらモデル構築まで行いたいです。

参考ページ

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0