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

google
/
gemma-4-31B-it

Image-Text-to-Text
Transformers
Safetensors
Eval Results
Model card Files Files and versions
xet
Community
111

Instructions to use google/gemma-4-31B-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use google/gemma-4-31B-it with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("image-text-to-text", model="google/gemma-4-31B-it")
    # Load model directly
    from transformers import AutoModel
    model = AutoModel.from_pretrained("google/gemma-4-31B-it", dtype="auto")
  • Notebooks
  • Google Colab
  • Kaggle
  • AMD Developer Cloud
  • Local Apps
  • vLLM

    How to use google/gemma-4-31B-it with vLLM:

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

    How to use google/gemma-4-31B-it 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 "google/gemma-4-31B-it" \
        --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": "google/gemma-4-31B-it",
    		"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 "google/gemma-4-31B-it" \
            --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": "google/gemma-4-31B-it",
    		"prompt": "Once upon a time,",
    		"max_tokens": 512,
    		"temperature": 0.5
    	}'
  • Docker Model Runner

    How to use google/gemma-4-31B-it with Docker Model Runner:

    docker model run hf.co/google/gemma-4-31B-it
gemma-4-31B-it
62.6 GB
Ctrl+K
Ctrl+K
  • 10 contributors
History: 1 commit
MaartenGr's picture
MaartenGr
Rocketknight1's picture
Rocketknight1 HF Staff
dougreid's picture
dougreid
RyanMullins's picture
RyanMullins
pcuenq's picture
pcuenq HF Staff
bebechien's picture
bebechien
osanseviero's picture
osanseviero
douglas reid
Preparing for release!
419b2ef about 2 months ago
  • .gitattributes
    1.71 kB
    Preparing for release! about 2 months ago
  • README.md
    26.7 kB
    Preparing for release! about 2 months ago
  • chat_template.jinja
    12 kB
    Preparing for release! about 2 months ago
  • config.json
    4.62 kB
    Preparing for release! about 2 months ago
  • generation_config.json
    208 Bytes
    Preparing for release! about 2 months ago
  • model-00001-of-00002.safetensors
    49.8 GB
    xet
    Preparing for release! about 2 months ago
  • model-00002-of-00002.safetensors
    12.8 GB
    xet
    Preparing for release! about 2 months ago
  • model.safetensors.index.json
    120 kB
    Preparing for release! about 2 months ago
  • processor_config.json
    1.69 kB
    Preparing for release! about 2 months ago
  • tokenizer.json
    32.2 MB
    xet
    Preparing for release! about 2 months ago
  • tokenizer_config.json
    2.07 kB
    Preparing for release! about 2 months ago