Text Generation
Transformers
Safetensors
gemma
custom_code
Eval Results (legacy)
text-generation-inference
Instructions to use d-matrix/gemma-2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use d-matrix/gemma-2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="d-matrix/gemma-2b", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("d-matrix/gemma-2b", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("d-matrix/gemma-2b", trust_remote_code=True) - Inference
- Local Apps Settings
- vLLM
How to use d-matrix/gemma-2b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "d-matrix/gemma-2b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "d-matrix/gemma-2b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/d-matrix/gemma-2b
- SGLang
How to use d-matrix/gemma-2b 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 "d-matrix/gemma-2b" \ --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": "d-matrix/gemma-2b", "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 "d-matrix/gemma-2b" \ --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": "d-matrix/gemma-2b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use d-matrix/gemma-2b with Docker Model Runner:
docker model run hf.co/d-matrix/gemma-2b
Commit History
Upload README.md with huggingface_hub 9dd3e90 verified
Upload README.md with huggingface_hub d710b14 verified
Upload README.md with huggingface_hub 558875e verified
Upload README.md with huggingface_hub b0e7cb9 verified
Upload README.md with huggingface_hub 83195c5 verified
Upload README.md with huggingface_hub cc8fc1e verified
Upload README.md with huggingface_hub c9c85e4 verified
Upload README.md with huggingface_hub b74e35d verified
remove check for cuda 5915555
fixing import for modeling_gemma.py e67448d
Update modeling_gemma.py 8745eab verified
Update config.json e4a91a4 verified
d-Matrix commited on
Update modeling_gemma.py 0c0c1c7 verified
d-Matrix commited on
Update config.json d019b6f verified
d-Matrix commited on
Upload 2 files 0c80f2e verified
d-Matrix commited on
Upload tokenizer.json 0cd2fb7 verified
d-Matrix commited on
adding gemma model 8dfd50f
initial commit bcb2700 verified
d-Matrix commited on