Back to all models
Model: gpt2-medium
text-generation mask_token:
Query this model
🔥 This model is currently loaded and running on the Inference API. ⚠️ This model could not be loaded by the inference API. ⚠️ This model can be loaded on the Inference API on-demand.
JSON Output
API endpoint  

⚡️ Upgrade your account to access the Inference API

							$
							curl -X POST \
-H "Authorization: Bearer YOUR_ORG_OR_USER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '"json encoded string"' \
https://api-inference.huggingface.co/models/gpt2-medium
Share Copied link to clipboard

Monthly model downloads

gpt2-medium gpt2-medium
46,803 downloads
last 30 days

pytorch

tf

How to use this model directly from the 🤗/transformers library:

			
Copy to clipboard
from transformers import AutoTokenizer, AutoModelWithLMHead tokenizer = AutoTokenizer.from_pretrained("gpt2-medium") model = AutoModelWithLMHead.from_pretrained("gpt2-medium")

Test the full generation capabilities here: https://transformer.huggingface.co/doc/gpt2-large