Instructions to use nirajandhakal/gemma-2b-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nirajandhakal/gemma-2b-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nirajandhakal/gemma-2b-base")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nirajandhakal/gemma-2b-base") model = AutoModelForCausalLM.from_pretrained("nirajandhakal/gemma-2b-base", device_map="auto") - Keras
How to use nirajandhakal/gemma-2b-base with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://nirajandhakal/gemma-2b-base") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use nirajandhakal/gemma-2b-base with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf nirajandhakal/gemma-2b-base # Run inference directly in the terminal: llama cli -hf nirajandhakal/gemma-2b-base
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf nirajandhakal/gemma-2b-base # Run inference directly in the terminal: llama cli -hf nirajandhakal/gemma-2b-base
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf nirajandhakal/gemma-2b-base # Run inference directly in the terminal: ./llama-cli -hf nirajandhakal/gemma-2b-base
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf nirajandhakal/gemma-2b-base # Run inference directly in the terminal: ./build/bin/llama-cli -hf nirajandhakal/gemma-2b-base
Use Docker
docker model run hf.co/nirajandhakal/gemma-2b-base
- LM Studio
- Jan
- vLLM
How to use nirajandhakal/gemma-2b-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nirajandhakal/gemma-2b-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nirajandhakal/gemma-2b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nirajandhakal/gemma-2b-base
- SGLang
How to use nirajandhakal/gemma-2b-base 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 "nirajandhakal/gemma-2b-base" \ --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": "nirajandhakal/gemma-2b-base", "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 "nirajandhakal/gemma-2b-base" \ --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": "nirajandhakal/gemma-2b-base", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use nirajandhakal/gemma-2b-base with Ollama:
ollama run hf.co/nirajandhakal/gemma-2b-base
- Unsloth Desktop
- Docker Model Runner
How to use nirajandhakal/gemma-2b-base with Docker Model Runner:
docker model run hf.co/nirajandhakal/gemma-2b-base
- Lemonade
How to use nirajandhakal/gemma-2b-base with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull nirajandhakal/gemma-2b-base
Run and chat with the model
lemonade run user.gemma-2b-base-{{QUANT_TAG}}List all available models
lemonade list
- Atomic Chat
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,7 +1,19 @@
|
|
| 1 |
---
|
| 2 |
license: gemma
|
| 3 |
library_name: transformers
|
|
|
|
|
|
|
| 4 |
tags:
|
| 5 |
- safetensors
|
| 6 |
- keras
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
---
|
|
|
|
| 1 |
---
|
| 2 |
license: gemma
|
| 3 |
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
inference: true
|
| 6 |
tags:
|
| 7 |
- safetensors
|
| 8 |
- keras
|
| 9 |
+
|
| 10 |
+
widget:
|
| 11 |
+
- text: "Is this review positive or negative? Review: Best cast iron skillet you will ever buy."
|
| 12 |
+
example_title: "Sentiment analysis"
|
| 13 |
+
- text: "Barack Obama nominated Hilary Clinton as his secretary of state on Monday. He chose her because she had ..."
|
| 14 |
+
example_title: "Coreference resolution"
|
| 15 |
+
- text: "On a shelf, there are five books: a gray book, a red book, a purple book, a blue book, and a black book ..."
|
| 16 |
+
example_title: "Logic puzzles"
|
| 17 |
+
- text: "The two men running to become New York City's next mayor will face off in their first debate Wednesday night ..."
|
| 18 |
+
example_title: "Reading comprehension"
|
| 19 |
---
|