TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Can't afford GPT-3 access? Self-host your own GPT-2 API

7 点作者 calebkaiser超过 4 年前

1 comment

calebkaiser超过 4 年前
With GPT-3 getting so many people interested in NLP, and with OpenAI&#x27;s recently announced pricing plan putting it out of many people&#x27;s reach, I thought it might be useful for some to see how easy it is to deploy your own GPT-2 API.<p>This project uses a couple tools:<p>- Cortex: An open source model serving platform I help maintain. <a href="https:&#x2F;&#x2F;github.com&#x2F;cortexlabs&#x2F;cortex" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cortexlabs&#x2F;cortex</a><p>- Hugging Face&#x27;s Transformers: An open source library for using popular language models, like GPT-2. <a href="https:&#x2F;&#x2F;github.com&#x2F;huggingface&#x2F;transformers" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;huggingface&#x2F;transformers</a><p>This project uses a vanilla pre-trained GPT-2 and PyTorch. If you want to use TensorFlow&#x2F;ONNX, that&#x27;s supported as well ( <a href="https:&#x2F;&#x2F;github.com&#x2F;cortexlabs&#x2F;cortex&#x2F;tree&#x2F;master&#x2F;examples&#x2F;tensorflow&#x2F;text-generator" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cortexlabs&#x2F;cortex&#x2F;tree&#x2F;master&#x2F;examples&#x2F;te...</a> ).<p>If you want to finetune GPT-2 on your own text (a la AI Dungeon), I&#x27;d suggest using gpt-2-simple and deploying with Cortex: <a href="https:&#x2F;&#x2F;github.com&#x2F;minimaxir&#x2F;gpt-2-simple" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;minimaxir&#x2F;gpt-2-simple</a><p>Lastly, by following this example, you can deploy your API locally (where inference will probably be slow, depending on your hardware, but will cost you $0) or to a cluster on AWS, which Cortex can spin up&#x2F;manage for you.