Instructions to use lunahr/SystemGemma2-2b-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lunahr/SystemGemma2-2b-it with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lunahr/SystemGemma2-2b-it") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("lunahr/SystemGemma2-2b-it") model = AutoModelForMultimodalLM.from_pretrained("lunahr/SystemGemma2-2b-it") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lunahr/SystemGemma2-2b-it with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lunahr/SystemGemma2-2b-it" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lunahr/SystemGemma2-2b-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/lunahr/SystemGemma2-2b-it
- SGLang
How to use lunahr/SystemGemma2-2b-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 "lunahr/SystemGemma2-2b-it" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lunahr/SystemGemma2-2b-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "lunahr/SystemGemma2-2b-it" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lunahr/SystemGemma2-2b-it", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use lunahr/SystemGemma2-2b-it with Docker Model Runner:
docker model run hf.co/lunahr/SystemGemma2-2b-it
Update EOS token ids (#1)
Browse files- Update EOS token ids (a6354b7c157bc3e9d89b909dc6e66435ca793e61)
- Update generation_config.json (bbe764c5039982ea559fb1687b0863614b3aba59)
- config.json +4 -1
- generation_config.json +4 -1
config.json
CHANGED
|
@@ -7,7 +7,10 @@
|
|
| 7 |
"attn_logit_softcapping": 50.0,
|
| 8 |
"bos_token_id": 2,
|
| 9 |
"cache_implementation": "hybrid",
|
| 10 |
-
"eos_token_id":
|
|
|
|
|
|
|
|
|
|
| 11 |
"final_logit_softcapping": 30.0,
|
| 12 |
"head_dim": 256,
|
| 13 |
"hidden_act": "gelu_pytorch_tanh",
|
|
|
|
| 7 |
"attn_logit_softcapping": 50.0,
|
| 8 |
"bos_token_id": 2,
|
| 9 |
"cache_implementation": "hybrid",
|
| 10 |
+
"eos_token_id": [
|
| 11 |
+
1,
|
| 12 |
+
107
|
| 13 |
+
],
|
| 14 |
"final_logit_softcapping": 30.0,
|
| 15 |
"head_dim": 256,
|
| 16 |
"hidden_act": "gelu_pytorch_tanh",
|
generation_config.json
CHANGED
|
@@ -2,7 +2,10 @@
|
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 2,
|
| 4 |
"cache_implementation": "hybrid",
|
| 5 |
-
"eos_token_id":
|
|
|
|
|
|
|
|
|
|
| 6 |
"pad_token_id": 0,
|
| 7 |
"transformers_version": "4.42.4"
|
| 8 |
}
|
|
|
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 2,
|
| 4 |
"cache_implementation": "hybrid",
|
| 5 |
+
"eos_token_id": [
|
| 6 |
+
1,
|
| 7 |
+
107
|
| 8 |
+
],
|
| 9 |
"pad_token_id": 0,
|
| 10 |
"transformers_version": "4.42.4"
|
| 11 |
}
|