Instructions to use TinyPixel/qwen-1.8B-OrcaMini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TinyPixel/qwen-1.8B-OrcaMini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TinyPixel/qwen-1.8B-OrcaMini", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TinyPixel/qwen-1.8B-OrcaMini", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TinyPixel/qwen-1.8B-OrcaMini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TinyPixel/qwen-1.8B-OrcaMini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TinyPixel/qwen-1.8B-OrcaMini", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TinyPixel/qwen-1.8B-OrcaMini
- SGLang
How to use TinyPixel/qwen-1.8B-OrcaMini 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 "TinyPixel/qwen-1.8B-OrcaMini" \ --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": "TinyPixel/qwen-1.8B-OrcaMini", "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 "TinyPixel/qwen-1.8B-OrcaMini" \ --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": "TinyPixel/qwen-1.8B-OrcaMini", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TinyPixel/qwen-1.8B-OrcaMini with Docker Model Runner:
docker model run hf.co/TinyPixel/qwen-1.8B-OrcaMini
Update README.md
Browse files
README.md
CHANGED
|
@@ -3,3 +3,31 @@ datasets:
|
|
| 3 |
- TinyPixel/orca-bad
|
| 4 |
---
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
- TinyPixel/orca-bad
|
| 4 |
---
|
| 5 |
|
| 6 |
+
## Usage
|
| 7 |
+
|
| 8 |
+
```python
|
| 9 |
+
!pip install -q -U trl transformers accelerate git+https://github.com/huggingface/peft.git
|
| 10 |
+
!pip install -q datasets bitsandbytes einops wandb sentencepiece transformers_stream_generator tiktoken
|
| 11 |
+
|
| 12 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 13 |
+
import torch
|
| 14 |
+
|
| 15 |
+
tokenizer = AutoTokenizer.from_pretrained("TinyPixel/qwen-1.8B-OrcaMini", trust_remote_code=True)
|
| 16 |
+
model = AutoModelForCausalLM.from_pretrained("TinyPixel/qwen-1.8B-OrcaMini", torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True)
|
| 17 |
+
|
| 18 |
+
device = "cuda:0"
|
| 19 |
+
|
| 20 |
+
text = '''SYSTEM:
|
| 21 |
+
USER: what is the difference between a dog and a cat on a biological level?
|
| 22 |
+
ASSISTANT:'''
|
| 23 |
+
|
| 24 |
+
inputs = tokenizer(text, return_tensors="pt").to(device)
|
| 25 |
+
outputs = model.generate(**inputs,
|
| 26 |
+
max_new_tokens=512,
|
| 27 |
+
do_sample=True,
|
| 28 |
+
top_p=0.95,
|
| 29 |
+
temperature=0.7,
|
| 30 |
+
top_k=50)
|
| 31 |
+
|
| 32 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=False))
|
| 33 |
+
```
|