Text Generation
Transformers
Safetensors
English
qwen2
business-intelligence
market-analysis
web-research
agent
tool-calling
business-consultancy
autonomous-agent
competitive-intelligence
trend-forecasting
chatpbc
luwa
conversational
text-generation-inference
Instructions to use chatpbc11121/luwa-01 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chatpbc11121/luwa-01 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="chatpbc11121/luwa-01") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("chatpbc11121/luwa-01") model = AutoModelForCausalLM.from_pretrained("chatpbc11121/luwa-01", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use chatpbc11121/luwa-01 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "chatpbc11121/luwa-01" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chatpbc11121/luwa-01", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/chatpbc11121/luwa-01
- SGLang
How to use chatpbc11121/luwa-01 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 "chatpbc11121/luwa-01" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chatpbc11121/luwa-01", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "chatpbc11121/luwa-01" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "chatpbc11121/luwa-01", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use chatpbc11121/luwa-01 with Docker Model Runner:
docker model run hf.co/chatpbc11121/luwa-01
File size: 6,254 Bytes
c0a42ed | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | # luwa-01 Installation & Deployment Guide
## Get luwa-01 Running in 5 Minutes
This guide shows you how to set up luwa-01 on your machine, server, or cloud — no GPU required.
---
## Requirements
| Requirement | Minimum |
|-------------|---------|
| **RAM** | 4 GB |
| **Disk space** | 1 GB (model is 942 MB) |
| **Python** | 3.8 or higher |
| **GPU** | Not required (works on CPU) |
| **Internet** | Required for initial download only |
---
## Method 1: Quick Start (Python)
The fastest way to get luwa-01 running:
```bash
pip install transformers torch
```
Then create a file called `chat.py`:
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load the model (downloads automatically on first run)
model = AutoModelForCausalLM.from_pretrained(
"chatpbc1/luwa-01",
trust_remote_code=True,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("chatpbc1/luwa-01")
# Your question
question = "What is the market size for AI in healthcare in 2026?"
# Format the message
messages = [{"role": "user", "content": question}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
# Generate response
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
```
Run it:
```bash
python chat.py
```
---
## Method 2: Interactive Chat
Create a simple chat loop so you can have a conversation with luwa-01:
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("chatpbc1/luwa-01", trust_remote_code=True, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("chatpbc1/luwa-01")
print("luwa-01 Business Intelligence Agent")
print("Type your question (or 'quit' to exit)\n")
messages = []
while True:
user_input = input("You: ")
if user_input.lower() == "quit":
break
messages.append({"role": "user", "content": user_input})
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(f"\nluwa-01: {response}\n")
messages.append({"role": "assistant", "content": response})
```
---
## Method 3: Deploy as a Web API
Turn luwa-01 into a REST API server that your apps can call:
```bash
pip install transformers torch fastapi uvicorn
```
Create `server.py`:
```python
from fastapi import FastAPI
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
app = FastAPI()
# Load model once at startup
model = AutoModelForCausalLM.from_pretrained("chatpbc1/luwa-01", trust_remote_code=True, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("chatpbc1/luwa-01")
@app.post("/chat")
async def chat(request: dict):
prompt = request.get("prompt", "")
max_tokens = request.get("max_tokens", 512)
messages = [{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=max_tokens)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return {"response": response}
```
Start the server:
```bash
uvicorn server:app --host 0.0.0.0 --port 8000
```
Then call it:
```bash
curl -X POST http://localhost:8000/chat -H "Content-Type: application/json" -d '{"prompt": "Analyze the AI market", "max_tokens": 256}'
```
---
## Method 4: Deploy on Modal (Cloud GPU)
For production with automatic scaling:
**Step 1:** Sign up at [modal.com](https://modal.com)
**Step 2:** Install Modal:
```bash
pip install modal
modal token new
```
**Step 3:** Create your HF secret:
```bash
modal secret create hf-token HF_TOKEN=YOUR_HF_TOKEN
```
**Step 4:** Deploy:
```bash
modal deploy deploy_luwa.py
```
You'll get a URL like:
```
https://your-username--luwa-01-service.modal.run
```
**Step 5:** Use it from anywhere:
```bash
curl -X POST https://your-username--luwa-01-service.modal.run -H "Content-Type: application/json" -d '{"prompt": "Market analysis request", "max_tokens": 512}'
```
---
## Method 5: Deploy with Docker
For containerized production:
```dockerfile
FROM python:3.11-slim
RUN pip install transformers torch fastapi uvicorn
WORKDIR /app
COPY server.py .
EXPOSE 8000
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "8000"]
```
```bash
docker build -t luwa-01 .
docker run -p 8000:8000 luwa-01
```
---
## Performance Tips
| Scenario | Recommendation |
|----------|---------------|
| **Development/Testing** | Run directly on CPU (4GB RAM) |
| **Production API** | Use Modal or any cloud GPU (T4) |
| **High traffic** | Deploy with Docker + load balancer |
| **Edge deployment** | Use ONNX export for even faster inference |
---
## Troubleshooting
**"CUDA out of memory"**
- Switch to CPU: `device_map="cpu"`
- Reduce `max_new_tokens` to 256
**"Model not found"**
- Check your internet connection
- Ensure you have `transformers >= 4.30.0`
**"Slow responses"**
- Use a GPU if available
- Reduce `max_new_tokens`
- Set `temperature=0.5` for faster deterministic output
---
## What's Included in the Repository
| File | Purpose |
|------|---------|
| `model.safetensors` | Model weights (942 MB) |
| `config.json` | Architecture settings |
| `generation_config.json` | Optimized generation parameters |
| `tokenizer.json` | Text tokenizer (152K vocabulary) |
| `tokenizer_config.json` | Tokenizer settings |
| `chat_template.jinja` | Chat formatting template |
| `system_prompt.txt` | Business intelligence persona |
| `agent_config.json` | Agent tool definitions |
---
## Next Steps
- Read the [Agent Guide](AGENT_GUIDE.md) for how to use luwa-01 effectively
- Visit the [repository](https://huggingface.co/chatpbc1/luwa-01) for the latest updates
- Join the [ChatPBC community](https://huggingface.co/chatpbc1) for support
---
Built by **ChatPBC**
|