deploy transformers
1.0.0
わずか3行のコードでテキストジェネレーションのためのSOTAモデルを展開する
PytorchとTransformersが明らかに必要です。
pip install deploy-transformers展開のために、ファイル構造は次のようにする必要があります。
├── static
│ ├── script.js
│ ├── style.css
├── templates
│ ├── 404.html
│ ├── index.html
|
└── your_file.pyこのリポジトリをクローンして元のファイルを作成するか、function website.create_structure()を使用するか、構造を作成できます。
website.create_structure() 、テンプレート/ 、静的/、およびその中にあるすべてのファイル(.html、.js、.css)を自動的に作成します。
例/フォルダーを確認してください。
# Deployment
from deploy_transformers import Website
website = Website ( model_type = "gpt2" , model_name = "distilgpt2" )
# website.create_folder(homepage_file="index.html", template_folder='templates', static_folder='static')
website . deploy () website.deploy()でホームページファイル名、テンプレート/、および静的/名前を変更することはできますが、デフォルトとしてそれらを維持することをお勧めします。
# Only text generation
from deploy_transformers import ListModels , Model
# ListModels() to show available models
model = Model ( "gpt2" , "distilgpt2" , seed = 42 , verbose = False )
model . generate ( length = 20 , prompt = "The quick brown fox jumps over the lazy dog" )
# If no prompt, input will be ask until exitDockerFileもあります。