deploy transformers
1.0.0
단 3 줄의 코드로 텍스트 생성에 대한 SOTA 모델을 배포
Pytorch 와 변압기가 분명히 필요합니다.
pip install deploy-transformers배포의 경우 파일 구조가 다음과 같아야합니다.
├── static
│ ├── script.js
│ ├── style.css
├── templates
│ ├── 404.html
│ ├── index.html
|
└── your_file.py 이 저장소를 복제하여 원본 파일을 사용하거나 기능 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 exit도커 파일도 있습니다.