Generation [English]
docker pull cargoshipsh/text-generation-en-sm
Automatically generates text by completing a given input text. This is a GPT-2 model provided by HF Canonical Model Maintainers on Huggingface and was trained on dataset (called WebText) weighting 40 GB of texts but has not been publicly released. You can find a list of the top 1,000 domains present in WebText here. The model itself is 510 MB in size and needs an aditional 1.5MB for the tokenizer. On a moderate CPU it takes only a few seconds to generate a text.
Demo
Input
Predicted Text
Person A: Hi, where are you from? Person B: Gemany and you? Person A: Well, my father and mother, and the lady that goes by Miss Rose. I'm glad I stayed to be more honest.
This demo runs on a virtual server with 4 vCPUs and 16 GB Ram (~$20/month)
License
The model as well as the code for the API wrapper is licensed under MIT License.
System Requirements
Minimum: 2GB RAM, 1 vCPU
Recommended: 4GB RAM, 4 vCPU
Limitations and Bias
The training dataset contains unfiltered internet content which may be profane, lewd or otherwise offensive. Depending on the application, GPT-2 may produce text that is socially unacceptable. When using GPT-2, it is important to remember that the statistically most likely next token is often not the token that produces the most "accurate" text. The output will often not match the input in terms of content, and the sentence structure will often be incorrect.
Want to learn more about Bias?
Get more details in our Blogpost on that topic.
API
If you don't want to implement the model all by yourself, no worries. Benefit from our easy to use API and get started right away!
Get StartedUsage
Input [POST]
{
"text": "Hello, I'm a language model"
}
Output
{
"text": "Hello, I'm a language modeler. The data coming from the model is the value of the model's function. For example, the values
stored in a table are the first row, the first column from the model, if any, and the"
}
You need to set an API Key via the environment variable API_KEY
to run the image and set the X-API-KEY
header in your request with the same KEY.
Need a more detailed setup guide?
To get more detailed instructions how to get started please check out our quick start guide in the docs.
Example
Make sure you have Docker installed then run the following command:
docker run -p 80:80 --env API_KEY=CHANGE_ME cargoshipsh/text-generation-en-sm
In a new terminal window, run the following command to call the API
curl -X POST -H 'Content-type: application/json' -H 'X-API-Key: CHANGE_ME' --data '{"text": "Hello, I'm a language model"}' http://localhost:80
You see the output of the model in the terminal.
{"text": "Hello, I'm a language modeler. The data coming from the model is the value of the model's function. For example, the values
stored in a table are the first row, the first column from the model, if any, and the"}