🚀 Deploy Transformers 🤗
Deploy a SOTA model for text-generation in just three lines of code 💻
Installation
Pytorch and Transformers are obviously needed.
pip install deploy-transformers
For deployment, file structure needs to be like this:
├── static
│ ├── script.js
│ ├── style.css
├── templates
│ ├── 404.html
│ ├── index.html
|
└── your_file.py
You can either clone this repository to have original files or use the function website.create_structure() or create yourself the structure.
website.create_structure() will automatically create templates/, static/ and all the files that are in it (.html, .js, .css).
Usage
Check the examples/ folder.
# 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()
You can change homepage filename, templates/ and static/ names in website.deploy() but it's better to keep them as default.
# 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
## Thanks
- Transformers package by HuggingFace
- gpt-2-cloudrun by minimaxir
Notes
- Do the same but for other tasks like sentiment analysis, or Q&A.
- Add Flask option?
Metadata
Release files for deploy-transformers 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| deploy-transformers-0.1.tar.gz | 12.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| deploy_transformers-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.7 kB
Release files / deploy-transformers-0.1.tar.gz
| Download URL | deploy-transformers-0.1.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eced19978a4f4f3d6231dd6b016416f67cdba9404e0e8165f57c27433798b5f7
|
|
BLAKE2b-256 checksum How to use checksums |
4588d12c553f0910660974764d2d2ecdaf5ad28d50ced472bdce1611d0796294
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.4
|
Release files / deploy_transformers-0.1-py3-none-any.whl
| Download URL | deploy_transformers-0.1-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5d0fe946be7cebeb46d622b6717af4ae171e326b0feb24d6c4570ab7005cf01
|
|
BLAKE2b-256 checksum How to use checksums |
d8277f06939c3c4663dd88a043565b50e896fbf2f622932a2199d5c99243d454
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.4
|