TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

7 pointsby calebkaiserover 4 years ago

1 comment

calebkaiserover 4 years ago
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.