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

  • Log In
  • Sign Up

benjamin
/
Gemma2-2B-Distilled-Math

Text Generation
Transformers
JAX
Safetensors
gemma2
text-generation-inference
Model card Files Files and versions
xet
Community

Instructions to use benjamin/Gemma2-2B-Distilled-Math with libraries, inference providers, notebooks, and local apps. Follow these links to get started.

  • Libraries
  • Transformers

    How to use benjamin/Gemma2-2B-Distilled-Math with Transformers:

    # Use a pipeline as a high-level helper
    from transformers import pipeline
    
    pipe = pipeline("text-generation", model="benjamin/Gemma2-2B-Distilled-Math")
    # Load model directly
    from transformers import AutoTokenizer, AutoModelForCausalLM
    
    tokenizer = AutoTokenizer.from_pretrained("benjamin/Gemma2-2B-Distilled-Math")
    model = AutoModelForCausalLM.from_pretrained("benjamin/Gemma2-2B-Distilled-Math")
  • Notebooks
  • Google Colab
  • Kaggle
  • Local Apps
  • vLLM

    How to use benjamin/Gemma2-2B-Distilled-Math with vLLM:

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

    How to use benjamin/Gemma2-2B-Distilled-Math 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 "benjamin/Gemma2-2B-Distilled-Math" \
        --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": "benjamin/Gemma2-2B-Distilled-Math",
    		"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 "benjamin/Gemma2-2B-Distilled-Math" \
            --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": "benjamin/Gemma2-2B-Distilled-Math",
    		"prompt": "Once upon a time,",
    		"max_tokens": 512,
    		"temperature": 0.5
    	}'
  • Docker Model Runner

    How to use benjamin/Gemma2-2B-Distilled-Math with Docker Model Runner:

    docker model run hf.co/benjamin/Gemma2-2B-Distilled-Math
Gemma2-2B-Distilled-Math
Ctrl+K
Ctrl+K
  • 1 contributor
History: 6 commits
benjamin's picture
benjamin
Upload FlaxGemma2ForCausalLM
4e7543e verified about 1 year ago
  • .gitattributes
    1.57 kB
    Upload tokenizer about 1 year ago
  • README.md
    1.72 kB
    Update README.md about 1 year ago
  • config.json
    869 Bytes
    Upload FlaxGemma2ForCausalLM about 1 year ago
  • flax_model-00001-of-00003.msgpack
    4.96 GB
    xet
    Upload FlaxGemma2ForCausalLM about 1 year ago
  • flax_model-00002-of-00003.msgpack
    4.98 GB
    xet
    Upload FlaxGemma2ForCausalLM about 1 year ago
  • flax_model-00003-of-00003.msgpack
    538 MB
    xet
    Upload FlaxGemma2ForCausalLM about 1 year ago
  • flax_model.msgpack.index.json
    24.5 kB
    Upload FlaxGemma2ForCausalLM about 1 year ago
  • generation_config.json
    195 Bytes
    Upload Gemma2ForCausalLM about 1 year ago
  • model-00001-of-00003.safetensors
    4.93 GB
    xet
    Upload Gemma2ForCausalLM about 1 year ago
  • model-00002-of-00003.safetensors
    4.98 GB
    xet
    Upload Gemma2ForCausalLM about 1 year ago
  • model-00003-of-00003.safetensors
    566 MB
    xet
    Upload Gemma2ForCausalLM about 1 year ago
  • model.safetensors.index.json
    24.2 kB
    Upload Gemma2ForCausalLM about 1 year ago
  • special_tokens_map.json
    636 Bytes
    Upload tokenizer about 1 year ago
  • tokenizer.json
    36 MB
    xet
    Upload tokenizer about 1 year ago
  • tokenizer_config.json
    2.43 kB
    Upload tokenizer about 1 year ago