Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing
    • Website
      • Tasks
      • HuggingChat
      • Collections
      • Languages
      • Organizations
    • Community
      • Blog
      • Posts
      • Daily Papers
      • Learn
      • Discord
      • Forum
      • GitHub
    • Solutions
      • Team & Enterprise
      • Hugging Face PRO
      • Enterprise Support
      • Inference Providers
      • Inference Endpoints
      • Storage Buckets

  • Log In
  • Sign Up

openai-community
/
gpt2-large

Text Generation
Transformers
PyTorch
google-tensorflow TensorFlow
JAX
Rust
ONNX
Safetensors
English
gpt2
text-generation-inference
Model card Files Files and versions
xet
Community
12

Instructions to use openai-community/gpt2-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use openai-community/gpt2-large with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("text-generation", model="openai-community/gpt2-large")
    # Load model directly
    from transformers import AutoTokenizer, AutoModelForCausalLM
    
    tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2-large")
    model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2-large")
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps
  • vLLM

    How to use openai-community/gpt2-large with vLLM:

    Install from pip and serve model
    # Install vLLM from pip:
    pip install vllm
    # Start the vLLM server:
    vllm serve "openai-community/gpt2-large"
    # Call the server using curl (OpenAI-compatible API):
    curl -X POST "http://localhost:8000/v1/completions" \
    	-H "Content-Type: application/json" \
    	--data '{
    		"model": "openai-community/gpt2-large",
    		"prompt": "Once upon a time,",
    		"max_tokens": 512,
    		"temperature": 0.5
    	}'
    Use Docker
    docker model run hf.co/openai-community/gpt2-large
  • SGLang

    How to use openai-community/gpt2-large with SGLang:

    Install from pip and serve model
    # Install SGLang from pip:
    pip install sglang
    # Start the SGLang server:
    python3 -m sglang.launch_server \
        --model-path "openai-community/gpt2-large" \
        --host 0.0.0.0 \
        --port 30000
    # Call the server using curl (OpenAI-compatible API):
    curl -X POST "http://localhost:30000/v1/completions" \
    	-H "Content-Type: application/json" \
    	--data '{
    		"model": "openai-community/gpt2-large",
    		"prompt": "Once upon a time,",
    		"max_tokens": 512,
    		"temperature": 0.5
    	}'
    Use Docker images
    docker run --gpus all \
        --shm-size 32g \
        -p 30000:30000 \
        -v ~/.cache/huggingface:/root/.cache/huggingface \
        --env "HF_TOKEN=<secret>" \
        --ipc=host \
        lmsysorg/sglang:latest \
        python3 -m sglang.launch_server \
            --model-path "openai-community/gpt2-large" \
            --host 0.0.0.0 \
            --port 30000
    # Call the server using curl (OpenAI-compatible API):
    curl -X POST "http://localhost:30000/v1/completions" \
    	-H "Content-Type: application/json" \
    	--data '{
    		"model": "openai-community/gpt2-large",
    		"prompt": "Once upon a time,",
    		"max_tokens": 512,
    		"temperature": 0.5
    	}'
  • Docker Model Runner

    How to use openai-community/gpt2-large with Docker Model Runner:

    docker model run hf.co/openai-community/gpt2-large
gpt2-large
26.3 GB
Ctrl+K
Ctrl+K
  • 8 contributors
History: 23 commits
lysandre's picture
lysandre HF Staff
Adds the tokenizer configuration file (#7)
32b71b1 verified about 2 years ago
  • onnx
    Adding ONNX file of this model (#6) almost 3 years ago
  • .gitattributes
    789 Bytes
    Adding ONNX file of this model (#6) almost 3 years ago
  • README.md
    12.3 kB
    Add model card (#1) almost 4 years ago
  • config.json
    666 Bytes
    Update config.json over 4 years ago
  • flax_model.msgpack
    3.1 GB
    xet
    upload flax model almost 5 years ago
  • generation_config.json
    124 Bytes
    Adding generation config file(s) over 3 years ago
  • generation_config_for_text_generation.json
    165 Bytes
    Adding generation config file(s) over 3 years ago
  • merges.txt
    456 kB
    Update merges.txt over 6 years ago
  • model.safetensors
    3.25 GB
    xet
    Adding `safetensors` variant of this model (#3) about 3 years ago
  • pytorch_model.bin

    Detected Pickle imports (3)

    • "torch._utils._rebuild_tensor_v2",
    • "torch.FloatStorage",
    • "collections.OrderedDict"

    What is a pickle import?

    3.25 GB
    xet
    Update pytorch_model.bin over 6 years ago
  • rust_model.ot
    3.5 GB
    xet
    Update rust_model.ot about 6 years ago
  • tf_model.h5
    3.1 GB
    xet
    Update tf_model.h5 over 6 years ago
  • tokenizer.json
    1.36 MB
    Update tokenizer.json over 5 years ago
  • tokenizer_config.json
    26 Bytes
    Adds the tokenizer configuration file (#7) about 2 years ago
  • vocab.json
    1.04 MB
    Update vocab.json over 6 years ago