gpt 2 Pytorch
1.0.0
より良い言語モデルとその意味
GPT-2(GPTの後継者)と呼ばれるモデルは、40GBのインターネットテキストの次の単語を予測するためだけに訓練されました。テクノロジーの悪意のあるアプリケーションに関する懸念により、訓練されたモデルをリリースしていません。責任ある開示の実験として、代わりに、研究者が実験するためのはるかに小さなモデルと技術論文をリリースしています。 Openaiブログから
このリポジトリは、圧縮コードを備えたPytorchのテキストジェネレーターに関する簡単な実装GPT-2です
元のレパートリーはOpenai/GPT-2です。また、GPT-2に関する論文「言語モデルは監視されていないマルチタスク学習者」を読むことができます。より詳細な概念を理解するには、トランスモデルに関する論文をお勧めします。
私が言及したPytorchでの優れた実装GPT-2、Huggingface/Pytorch-Prested-Bert、Huggingfaceリポジトリで詳細な実装を見ることができます。
変圧器(自己attention)論文:注意が必要なのは(2017)
最初のopenai-gptペーパー:生成事前トレーニングによる言語理解の向上(2018)
GPT-2とPaperについてのOpenaiブログを参照してください
$ git clone https://github.com/graykode/gpt-2-Pytorch && cd gpt-2-Pytorch
# download huggingface's pytorch model
$ curl --output gpt2-pytorch_model.bin https://s3.amazonaws.com/models.huggingface.co/bert/gpt2-pytorch_model.bin
# setup requirements, if using mac os, then run additional setup as descibed below
$ pip install -r requirements.txt$ python main.py --text " It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him. "--text :最初から文。--quiet :「===============」のようなすべての外部のものを印刷していません。--nsamples :多項関数が使用するときにバッチでサンプリングされたサンプルの数--unconditional :真実の場合、無条件の生成。--batch_size :バッチサイズの数--length :文の長さ(<コンテキストの数)--temperature :分布の熱力学温度(default 0.7)--top_k :特定のディメンションに沿って、指定された入力テンソルの上部Kの最大要素を返します。 (default 40)ここのtemperatureとtop_kの詳細オプションを参照してください
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install torch tqdm
$ brew install libomp
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ pip install -r requirements.txtJeff Wu(@wuthefwasthat)、Thomas Wolf(@thomwolf)紹介コードを許可しています。