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