AutoNLP 0.2 : 要約 (翻訳/解説)
翻訳 : (株)クラスキャット セールスインフォメーション
作成日時 : 05/05/2021 (0.2.6)
* 本ページは、HuggingFace AutoNLP の以下のドキュメントを翻訳した上で適宜、補足説明したものです:
* サンプルコードの動作確認はしておりますが、必要な場合には適宜、追加改変しています。
* ご自由にリンクを張って頂いてかまいませんが、sales-info@classcat.com までご一報いただけると嬉しいです。
スケジュールは弊社 公式 Web サイト でご確認頂けます。
- お住まいの地域に関係なく Web ブラウザからご参加頂けます。事前登録 が必要ですのでご注意ください。
- ウェビナー運用には弊社製品「ClassCat® Webinar」を利用しています。
人工知能研究開発支援 | 人工知能研修サービス | テレワーク & オンライン授業を支援 |
PoC(概念実証)を失敗させないための支援 (本支援はセミナーに参加しアンケートに回答した方を対象としています。) |
◆ お問合せ : 本件に関するお問い合わせ先は下記までお願いいたします。
株式会社クラスキャット セールス・マーケティング本部 セールス・インフォメーション |
E-Mail:sales-info@classcat.com ; WebSite: https://www.classcat.com/ ; Facebook |
AutoNLP 0.2 : 要約
要約タスクでは 2 つのシークエンスを持ちます。より大きいシークエンスはより小さいシークエンスで表されます aka 要約されます。
単純な要約データセットがどのように見えるかを見ましょう。
document | summary |
Recent reports have linked some France-based
players with returns to Wales. “I’ve always felt – and this is with my rugby hat on now; this is not region or WRU – I’d rather spend that money on |
New Welsh Rugby Union chairman Gareth Davies believes a joint £3.3m WRU-regions fund should be used to retain home-based talent such as Liam Williams, not bring back exiled stars. |
New Welsh Rugby Union chairman Gareth Davies believes a joint £3.3m WRU-regions fund should be used to retain home-based talent such as Liam Williams, not bring back exiled stars. Army explosives experts were called out to deal with a suspect package at the offices on the Newtownards Road on Friday night. Roads were sealed off and traffic diverted as a controlled explosion was carried out. The premises, used by East Belfast MP Naomi Long, have been targeted a number of times. Most recently, petrol bomb attacks were carried out on the offices on consecutive nights in April and May. The attacks began following a Belfast City Council vote in December 2012 restricting the flying of the union flag at the City Hall. Condemning the latest hoax, Alliance MLA Chris Lyttle said: “It is a serious incident for the local area, it causes serious disruption, it puts people’s lives at risk, it can prevent emergency services reaching the area. “Ultimately we need people with information to share that with the police in order for them to do their job and bring these people to justice.” |
A suspicious package left outside an Alliance Party office in east Belfast has been declared a hoax. |
The warning begins at 22:00 GMT on Saturday and ends at 10:00 on Sunday. The ice could lead to difficult driving conditions on untreated roads and slippery conditions on pavements, the weather service warned. Only the southernmost counties and parts of the most westerly counties are expected to escape. Counties expected to be affected are Carmarthenshire, Powys, Ceredigion, Pembrokeshire, Denbighshire, Gwynedd, Wrexham, Conwy, Flintshire, Anglesey, Monmouthshire, Blaenau Gwent, Caerphilly, Merthyr Tydfil, Neath Port Talbot, Rhondda Cynon Taff and Torfaen |
The Met Office has issued a yellow weather warning for ice across most of Wales. |
ひとたび上で指定された形式のデータを持てば、AutoNLP を使用してモデルを訓練する準備ができています。そうです、それほどに簡単です。
最初のステップは AutoNLP へのログインです :
$ autonlp login --api-key YOUR_HUGGING_FACE_API_TOKEN
貴方の Hugging Face API トークンを知らない場合、huggingface.co 上でアカウントを作成してください、すると設定で貴方の api キーを見つけるでしょう。貴方の api キーを誰とも共有しないでください!
ログインしたならば、新しいプロジェクトを作成できます :
$ autonlp create_project --name summarization_model --language en --task summarization
プロジェクトの作成の際、“–language” パラメータを使用して言語を選択できます。
次のステップはファイルをアップロードすることです。ここで、カラムマッピングは非常に重要です。元のデータのカラムは AutoNLP カラム名にマップされます。上のデータでは、元のカラムは “document” と “summary” です。要約問題に対してはそれ以上のカラムは必要ありません。
要約のための AutoNLP カラムは :
- text
- target
元のカラムは従って、text と target にマップされる必要があります。これは upload コマンドで成されます。AutoNLP にアップロードしている分割の種類を知らせる必要もあります : train or valid です。
autonlp upload --project summarization_model --split train \
--col_mapping document:text,summary:target \
--files ~/datasets/train.csv
同様に、検証ファイルをアップロードします :
autonlp upload --project summarization_model --split valid \
--col_mapping document:text,summary:target \
--files ~/datasets/valid.csv
カンマでパスを区切ることにより複数のファイルをアップロードできますけれども、カラム名は各ファイルで同じでなければならないことに注意してください。
ファイルを成功的にアップロードしたら、train コマンドを使用して訓練を開始できます :
$ autonlp train --project summarization_model
And that’s it!
貴方のモデルは訓練を開始して望めば訓練をモニタリングすることができます。
以上