# Material BERT ## Material BERTとは 国立研究開発法人物質・材料研究機構が主導で開発している材料分野に特化したBERTモデルである。 下記の3種のフォルダーに、情報が格納されている 1. Jxiv_article (論文原稿PDFと関連ファイル) 2. MaterialBERT_Pre-trained_Model (using original vocabulary list) 3. MaterialBERT_Dict_Pre-trained_Model (using newly-made vocabulary list generated from our corpus) ### 学習アルゴリズム Google リリースの[uncased_L-12_H-768_A-12_2021](https://github.com/google-research/bert) ## Pre-trainingモデルについて ### データソース Jxivの記事に記載 同記事に添付のジャーナルリストにある論文のアブストラクトと本文を使用 ### vocabulary list(辞書) 下記の2種類の vocabulary list を用いて、それぞれPre-trainingモデルを作成 1. BERTのオリジナル辞書 [vocab.txt](https://github.com/google-research/bert) 2. 上記 vocab.txt に、データソースからSentencePieceにより作成した材料分野に特化した語を追加したadd-vocab.txt ## 本公開コードを用いて、Material BERTで行えるタスク ### CoLA(The Corpus of Linguistic Acceptability) 文章が英語文法として正しいかどうかを判定する分類タスク #### 実行コマンド ``` python run_classifier_BERT.py \ --task_name=CoLA \ --do_predict=true \ --data_dir=CoLA_data \ --vocab_file=uncased_L-12_H-768_A-12_2021/vocab.txt \ --bert_config_file=uncased_L-12_H-768_A-12_2021/bert_config.json \ --init_checkpoint=model_ckpt/ \ --max_seq_length=128 \ --output_dir=CoLA_data/ ``` #### インプット CoLA_data/test_BERT.tsv ##### データ構造 | index | sentence | | ----- | ----------------------------------- | | 1 | The car was driven. | | 2 | Everyone hoped that she would sing. | | ... | ... | #### アウトプット CoLA_data/test_results_BERT.tsv ##### データ構造 | 1列目: 文法が間違っている確率 | 2列目: 文法が正しい確率 | | ----------------------------- | ----------------------- | | 0.428124 | 0.57187605 | | 0.37896726 | 0.6210327 | | ... | ... | ## ディレクトリ構成 ### BERTのvocabraly list(vocab.txt)を用いたモデル MaterialBERT_Pre-trained_Model/ ​ ├ CoLA_data/ ​ │ └ test_BERT.tsv ​ ├ uncased_L-12_H-768_A-12_2021/ ​ │ ├ vocab.txt ​ │ └ bert_config.json ​ ├ model_ckpt/ ​ │ ├ checkpoint ​ │ ├ model.ckpt-6413.data-00000-of-00001 ​ │ ├ model.ckpt-6413.index ​ │ └ model.ckpt-6413.meta ​ ├ run_classifier_BERT.py ​ ├ modeling.py ​ ├ optimization.py ​ └ tokenization.py ### 材料分野に特化した語を追加したvocabraly list(add-vocab.txt)を用いたモデル MaterialBERT_Dict_Pre-trained_Model/ ​ ├ model_ckpt/ ​ │ ├ checkpoint ​ │ ├ model.ckpt-288000.data-00000-of-00001 ​ │ ├ model.ckpt-288000.index ​ │ └ model.ckpt-288000.meta ​ └ add_vocab.txt ## 使用ライブラリとバージョン - python >= 3.7.6 - CUDA >= 9.2 - collections - csv >= 1.0 - os - tensorflow >= 1.13.1 - copy - json >= 2.0.9 - math - re >=2.2.1 - numpy >= 1.18.1 - six >= 1.14.0 ## Copyright ### Contributor Yoshitake, Michiko: 1. National Institute for Materials Science, MaDIS Sato, Fumitaka: 1. National Institute for Materials Science, MaDIS, 2. Business Science Unit,Ridgelinez Limited Kawano, Hiroyuki: 1. National Institute for Materials Science, MaDIS, 2. Business Science Unit,Ridgelinez Limited Teraoka, Hiroshi: 1. National Institute for Materials Science, MaDIS, 2. Business Science Unit,Ridgelinez Limited Moteki, Fuma: 1. National Institute for Materials Science, MaDIS, 2. Business Science Unit,Ridgelinez Limited ### License of the programs and parameter files BSD License (3-clause BSD License) Copyright (c) 2022, National Institute for Materials Science Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.