Git Product home page Git Product logo

gptsan's Introduction

GPTSAN

model

GPTSANとは

なんにでも使える汎用日本語言語モデルを目指して作成したSwitch Transformerモデルです。

特徴として、1-GPUでファインチューニング可能だったり、生成文章のクラスを指定可能だったりします。

モデルのダウンロード

現在、28億パラメーター(10layer-1024ch-16header-16experts-1280contexts)のモデルが公開されています。

こちらのGoogle Driveフォルダから、モデルをダウンロードし、以下のコマンドで解凍します。

$ tar xfj GPTSAN-2.8B-spout_is_uniform.tar.bz2

Dockerで使ってみる

標準環境の構築。

$ docker build .
ビルド後にコンテナIDが表示される
$ docker run --gpus all -it --rm -v `pwd`/GPTSAN-2.8B-spout_is_uniform:/tf/GPTSAN/GPTSAN-2.8B-spout_is_uniform <コンテナID> python run_generate.py --model GPTSAN-2.8B-spout_is_uniform/ --context "武田信玄は、戦国 時代ファンならぜひ押さえておきたい名将の一人。天下統一を目指し勢いに乗る織田信長からも、一目置かれていたと"

とりあえず使ってみる

文章生成。

$ python run_generate.py --model GPTSAN-2.8B-spout_is_uniform/ --context "武田信玄は、戦国 時代ファンならぜひ押さえておきたい名将の一人。天下統一を目指し勢いに乗る織田信長からも、一目置かれていたと"

生成オプション

Top_K

「--top_k」で指定可能。変えると割と変わる。

$ python run_generate.py --model GPTSAN-2.8B-spout_is_uniform/ --context "武田信玄は、戦国 時代ファンならぜひ押さえておきたい名将の一人。天下統一を目指し勢いに乗る織田信長からも、一目置かれていたと" --top_k 100

最大生成文字数

「--max_generate」で指定可能。小さくすると速く動く。

$ python run_generate.py --model GPTSAN-2.8B-spout_is_uniform/ --context "武田信玄は、戦国 時代ファンならぜひ押さえておきたい名将の一人。天下統一を目指し勢いに乗る織田信長からも、一目置かれていたと" --max_generate 100

検索木の枝数

「--beam_width」で指定可能。小さくすると速く動く。

$ python run_generate.py --model GPTSAN-2.8B-spout_is_uniform/ --context "武田信玄は、戦国 時代ファンならぜひ押さえておきたい名将の一人。天下統一を目指し勢いに乗る織田信長からも、一目置かれていたと" --beam_width 1

ファインチューニング

1-GPUでファインチューニングな大規模言語モデル。

ファインチューニング方法

言語モデルとして実行

テキスト穴埋め問題をBERT風に解く。

Masked Language Modelを実行

文章のベクトル化

内部層の情報も含んだ文章ベクトル生成。

任意のトークン位置からステータスを抽出

gptsan's People

Contributors

tanreinama avatar eltociear avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.