Hugging Face's logo Hugging Face
  • Models
  • Datasets
  • Spaces
  • Buckets new
  • Docs
  • Enterprise
  • Pricing

  • Log In
  • Sign Up

miguelvictor
/
python-gpt2-medium

Text Generation
Transformers
PyTorch
JAX
TensorBoard
gpt2
text-generation-inference
Model card Files Files and versions
xet
Metrics Training metrics Community
2

Instructions to use miguelvictor/python-gpt2-medium with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use miguelvictor/python-gpt2-medium with Transformers:

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

    How to use miguelvictor/python-gpt2-medium with vLLM:

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

    How to use miguelvictor/python-gpt2-medium 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 "miguelvictor/python-gpt2-medium" \
        --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": "miguelvictor/python-gpt2-medium",
    		"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 "miguelvictor/python-gpt2-medium" \
            --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": "miguelvictor/python-gpt2-medium",
    		"prompt": "Once upon a time,",
    		"max_tokens": 512,
    		"temperature": 0.5
    	}'
  • Docker Model Runner

    How to use miguelvictor/python-gpt2-medium with Docker Model Runner:

    docker model run hf.co/miguelvictor/python-gpt2-medium
python-gpt2-medium
2.87 GB
Ctrl+K
Ctrl+K
  • 2 contributors
History: 5 commits
patrickvonplaten's picture
patrickvonplaten
upload flax model
5f70aa9 almost 5 years ago
  • .gitattributes
    736 Bytes
    allow flax almost 5 years ago
  • config.json
    745 Bytes
    added tokenizer config about 5 years ago
  • events.out.tfevents.1619245098.c0e027c32017.606.0
    2.31 MB
    added mdoel checkpoint about 5 years ago
  • flax_model.msgpack
    1.42 GB
    xet
    upload flax model almost 5 years ago
  • merges.txt
    456 kB
    added tokenizer config about 5 years ago
  • pytorch_model.bin

    Detected Pickle imports (4)

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

    What is a pickle import?

    1.44 GB
    xet
    added mdoel checkpoint about 5 years ago
  • tokenizer.json
    1.36 MB
    added tokenizer config about 5 years ago
  • training.logs
    2.5 MB
    added mdoel checkpoint about 5 years ago
  • vocab.json
    1.04 MB
    added tokenizer config about 5 years ago