Instructions to use text-generator/llmtrain with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use text-generator/llmtrain with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="text-generator/llmtrain")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("text-generator/llmtrain", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use text-generator/llmtrain with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "text-generator/llmtrain" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "text-generator/llmtrain", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/text-generator/llmtrain
- SGLang
How to use text-generator/llmtrain 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 "text-generator/llmtrain" \ --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": "text-generator/llmtrain", "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 "text-generator/llmtrain" \ --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": "text-generator/llmtrain", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use text-generator/llmtrain with Docker Model Runner:
docker model run hf.co/text-generator/llmtrain
Clarify local vLLM download instructions
Browse files
README.md
CHANGED
|
@@ -98,10 +98,14 @@ print(tokenizer.decode(output[0, inputs.shape[-1]:], skip_special_tokens=True))
|
|
| 98 |
|
| 99 |
## Local inference with vLLM
|
| 100 |
|
|
|
|
|
|
|
|
|
|
| 101 |
```bash
|
| 102 |
-
|
|
|
|
|
|
|
| 103 |
--served-model-name gemma-roleplay-v2 \
|
| 104 |
-
--subfolder merged \
|
| 105 |
--dtype bfloat16 \
|
| 106 |
--max-model-len 4096
|
| 107 |
```
|
|
|
|
| 98 |
|
| 99 |
## Local inference with vLLM
|
| 100 |
|
| 101 |
+
Download the `merged/` folder from this repository and point vLLM at that
|
| 102 |
+
local directory:
|
| 103 |
+
|
| 104 |
```bash
|
| 105 |
+
hf download text-generator/llmtrain --repo-type model --local-dir ./llmtrain \
|
| 106 |
+
--include 'merged/*'
|
| 107 |
+
vllm serve ./llmtrain/merged \
|
| 108 |
--served-model-name gemma-roleplay-v2 \
|
|
|
|
| 109 |
--dtype bfloat16 \
|
| 110 |
--max-model-len 4096
|
| 111 |
```
|