Instructions to use teilomillet/MiniMerlin-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use teilomillet/MiniMerlin-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="teilomillet/MiniMerlin-3B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("teilomillet/MiniMerlin-3B") model = AutoModelForCausalLM.from_pretrained("teilomillet/MiniMerlin-3B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use teilomillet/MiniMerlin-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "teilomillet/MiniMerlin-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "teilomillet/MiniMerlin-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/teilomillet/MiniMerlin-3B
- SGLang
How to use teilomillet/MiniMerlin-3B 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 "teilomillet/MiniMerlin-3B" \ --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": "teilomillet/MiniMerlin-3B", "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 "teilomillet/MiniMerlin-3B" \ --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": "teilomillet/MiniMerlin-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use teilomillet/MiniMerlin-3B with Docker Model Runner:
docker model run hf.co/teilomillet/MiniMerlin-3B
Commit ·
d13cdbc
1
Parent(s): 8bb5a2d
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,4 +9,28 @@ widget:
|
|
| 9 |
- text: "<s> [|User|] Comment faire un bon plat ? </s>[|Assistant|]"
|
| 10 |
---
|
| 11 |
SFT on a synthetic custom (french) dataset (2k), from general question answering, problem solving to code question.
|
| 12 |
-
It's a POC.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
- text: "<s> [|User|] Comment faire un bon plat ? </s>[|Assistant|]"
|
| 10 |
---
|
| 11 |
SFT on a synthetic custom (french) dataset (2k), from general question answering, problem solving to code question.
|
| 12 |
+
It's a POC.
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
```python
|
| 16 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 17 |
+
from peft import PeftModel
|
| 18 |
+
import torch
|
| 19 |
+
|
| 20 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 21 |
+
"teilomillet/MiniMerlin-3B",
|
| 22 |
+
revision="0.1",
|
| 23 |
+
return_dict=True,
|
| 24 |
+
torch_dtype=torch.bfloat16,
|
| 25 |
+
device_map='auto'
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
tokenizer = AutoTokenizer.from_pretrained("teilomillet/MiniMerlin-3B")
|
| 29 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 30 |
+
|
| 31 |
+
text = "[|User|] Comment faire un bon plat ? </s>[|Assistant|]"
|
| 32 |
+
inputs = tokenizer(text, return_tensors="pt").to(0)
|
| 33 |
+
|
| 34 |
+
outputs = model.generate(**inputs, max_new_tokens=800)
|
| 35 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=False))
|
| 36 |
+
```
|