deploy transformers
1.0.0
ปรับใช้โมเดล SOTA สำหรับการสร้างข้อความในรหัสเพียงสามบรรทัด
Pytorch และ Transformers เป็นสิ่งจำเป็นอย่างชัดเจน
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นอกจากนี้ยังมี Dockerfile