{"id":15293019,"url":"https://github.com/aquadzn/deploy-transformers","last_synced_at":"2025-04-13T12:20:34.156Z","repository":{"id":62567730,"uuid":"227477860","full_name":"aquadzn/deploy-transformers","owner":"aquadzn","description":"Easily deploy a state-of-the-art language model from HuggingFace's Transformers","archived":false,"fork":false,"pushed_at":"2019-12-20T13:33:46.000Z","size":46,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T03:22:30.492Z","etag":null,"topics":["deployment","gpt-2","language-model","nlp","pytorch","pytorch-transformers","transformers","web-app"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aquadzn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-11T23:12:36.000Z","updated_at":"2023-08-23T13:01:28.000Z","dependencies_parsed_at":"2022-11-03T16:30:37.591Z","dependency_job_id":null,"html_url":"https://github.com/aquadzn/deploy-transformers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aquadzn%2Fdeploy-transformers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aquadzn%2Fdeploy-transformers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aquadzn%2Fdeploy-transformers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aquadzn%2Fdeploy-transformers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aquadzn","download_url":"https://codeload.github.com/aquadzn/deploy-transformers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248711062,"owners_count":21149285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deployment","gpt-2","language-model","nlp","pytorch","pytorch-transformers","transformers","web-app"],"created_at":"2024-09-30T16:37:44.686Z","updated_at":"2025-04-13T12:20:34.135Z","avatar_url":"https://github.com/aquadzn.png","language":"Python","readme":"# 🚀 Deploy Transformers 🤗\n\u003e Deploy a SOTA model for text-generation in just three lines of code 💻\n\u003e \n![image](https://svgshare.com/i/GnD.svg)\n\n\n## Installation \n\n[**Pytorch**](https://pytorch.org/get-started/locally/#start-locally) and [**Transformers**](https://github.com/huggingface/transformers/#installation) are obviously needed.\n\n```bash\npip install deploy-transformers\n```\n\n**For deployment, file structure needs to be like this:**\n```bash\n├── static\n│   ├── script.js\n│   ├── style.css\n├── templates\n│   ├── 404.html\n│   ├── index.html\n|\n└── your_file.py\n```\n\nYou can either **clone** this repository to have original files or use the function `website.create_structure()` or **create yourself** the structure.\n\n`website.create_structure()` will automatically create *templates/*, *static/* and all the files that are in it (.html, .js, .css).\n\n\n## Usage\n\nCheck the *[examples/](https://github.com/aquadzn/deploy-transformers/tree/master/examples)* folder.\n\n```python\n# Deployment\nfrom deploy_transformers import Website\n\nwebsite = Website(model_type=\"gpt2\", model_name=\"distilgpt2\")\n# website.create_folder(homepage_file=\"index.html\", template_folder='templates', static_folder='static')\nwebsite.deploy()\n```\n\n**You can change homepage filename, templates/ and static/ names in `website.deploy()` but it's better to keep them as default.**\n\n```python\n# Only text generation\nfrom deploy_transformers import ListModels, Model\n\n# ListModels() to show available models\nmodel = Model(\"gpt2\", \"distilgpt2\", seed=42, verbose=False)\nmodel.generate(length=20, prompt=\"The quick brown fox jumps over the lazy dog\")\n# If no prompt, input will be ask until exit\n```\n\nThere is also a Dockerfile.\n\n## Thanks\n\n* [Transformers](https://github.com/huggingface/transformers) package by HuggingFace\n* [gpt-2-cloudrun](https://github.com/minimaxir/gpt-2-cloud-run) by minimaxir\n\n## Notes\n\n* Do the same but for other tasks like sentiment analysis, or Q\u0026A.\n* Add Flask option?\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faquadzn%2Fdeploy-transformers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faquadzn%2Fdeploy-transformers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faquadzn%2Fdeploy-transformers/lists"}