Instructions to use benjamin/gemma-2-2b-it-flax with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use benjamin/gemma-2-2b-it-flax with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="benjamin/gemma-2-2b-it-flax")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("benjamin/gemma-2-2b-it-flax") model = AutoModelForCausalLM.from_pretrained("benjamin/gemma-2-2b-it-flax", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use benjamin/gemma-2-2b-it-flax with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "benjamin/gemma-2-2b-it-flax" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "benjamin/gemma-2-2b-it-flax", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/benjamin/gemma-2-2b-it-flax
- SGLang
How to use benjamin/gemma-2-2b-it-flax 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/gemma-2-2b-it-flax" \ --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/gemma-2-2b-it-flax", "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/gemma-2-2b-it-flax" \ --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/gemma-2-2b-it-flax", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use benjamin/gemma-2-2b-it-flax with Docker Model Runner:
docker model run hf.co/benjamin/gemma-2-2b-it-flax
Download tokenizer.json from benjamin/gemma-2-2b-it-flax: direct link, hf CLI and curl.
- Browser
- Download file 36 MB
-
https://huggingface.co/benjamin/gemma-2-2b-it-flax/resolve/main/tokenizer.json
- Command line
-
hf download hf://benjamin/gemma-2-2b-it-flax/tokenizer.json
-
curl -L -o tokenizer.json https://huggingface.co/benjamin/gemma-2-2b-it-flax/resolve/main/tokenizer.json
36 MB
- Xet hash:
- 590357e5b2586d3ebfd3313492d4c110972cda32d1cd6a8ff55c8b9d98efeafd
- Size of remote file:
- 36 MB
- SHA256:
- 933cbe36b3a2232c1cd5e45df290b5c69f127069e46ce730f388d1a96b073a9d
·
Xet efficiently stores Large Files inside Git, intelligently splitting files into unique chunks and accelerating uploads and downloads. More info.