Instructions to use c2p-cmd/gemma-2-2b-quote-generator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use c2p-cmd/gemma-2-2b-quote-generator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="c2p-cmd/gemma-2-2b-quote-generator")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("c2p-cmd/gemma-2-2b-quote-generator", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use c2p-cmd/gemma-2-2b-quote-generator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "c2p-cmd/gemma-2-2b-quote-generator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "c2p-cmd/gemma-2-2b-quote-generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/c2p-cmd/gemma-2-2b-quote-generator
- SGLang
How to use c2p-cmd/gemma-2-2b-quote-generator 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 "c2p-cmd/gemma-2-2b-quote-generator" \ --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": "c2p-cmd/gemma-2-2b-quote-generator", "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 "c2p-cmd/gemma-2-2b-quote-generator" \ --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": "c2p-cmd/gemma-2-2b-quote-generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use c2p-cmd/gemma-2-2b-quote-generator with Docker Model Runner:
docker model run hf.co/c2p-cmd/gemma-2-2b-quote-generator
Update README.md
Browse files
README.md
CHANGED
|
@@ -7,6 +7,9 @@ tags:
|
|
| 7 |
- trl
|
| 8 |
- sft
|
| 9 |
licence: license
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
# Model Card for outputs
|
|
@@ -31,6 +34,21 @@ print(output["generated_text"])
|
|
| 31 |
|
| 32 |
This model was trained with SFT.
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
### Framework versions
|
| 35 |
|
| 36 |
- TRL: 0.12.0
|
|
|
|
| 7 |
- trl
|
| 8 |
- sft
|
| 9 |
licence: license
|
| 10 |
+
language:
|
| 11 |
+
- en
|
| 12 |
+
pipeline_tag: text-generation
|
| 13 |
---
|
| 14 |
|
| 15 |
# Model Card for outputs
|
|
|
|
| 34 |
|
| 35 |
This model was trained with SFT.
|
| 36 |
|
| 37 |
+
## Inference
|
| 38 |
+
```python
|
| 39 |
+
import os
|
| 40 |
+
from dotenv import load_dotenv
|
| 41 |
+
|
| 42 |
+
load_dotenv('.env')
|
| 43 |
+
token = os.getenv('token')
|
| 44 |
+
|
| 45 |
+
from transformers import pipeline
|
| 46 |
+
|
| 47 |
+
pipe = pipeline('text-generation', "c2p-cmd/gemma-2-2b-quote-generator", token=token, device_map="mps")
|
| 48 |
+
|
| 49 |
+
print(pipe("Quote: I've succeeded", max_new_tokens=40))
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
### Framework versions
|
| 53 |
|
| 54 |
- TRL: 0.12.0
|