-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_remaining_docs.sh
More file actions
323 lines (241 loc) · 6.75 KB
/
create_remaining_docs.sh
File metadata and controls
323 lines (241 loc) · 6.75 KB
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
#!/bin/bash
# Create all remaining llcuda v2.2.0 documentation pages
cd "$(dirname "$0")"
echo "Creating remaining documentation pages..."
# SEO files
cat > docs/robots.txt << 'EOF'
User-agent: *
Allow: /
Sitemap: https://llcuda.github.io/sitemap.xml
EOF
cat > docs/sitemap.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://llcuda.github.io/</loc>
<priority>1.0</priority>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>https://llcuda.github.io/guides/quickstart/</loc>
<priority>0.9</priority>
</url>
<url>
<loc>https://llcuda.github.io/guides/installation/</loc>
<priority>0.9</priority>
</url>
<url>
<loc>https://llcuda.github.io/tutorials/index/</loc>
<priority>0.8</priority>
</url>
<url>
<loc>https://llcuda.github.io/kaggle/overview/</loc>
<priority>0.8</priority>
</url>
</urlset>
EOF
# Create additional guides
cat > docs/guides/model-selection.md << 'EOF'
# Model Selection Guide
Choose the right model and quantization for Kaggle dual T4.
## Recommended Models
### Small Models (1-3B)
- **Gemma 2-2B** - Best performance
- **Qwen2.5-1.5B** - Efficient
- **Gemma 3-1B** - Fast inference
### Medium Models (7-8B)
- **Qwen2.5-7B** - Great quality
- **Llama-3.2-7B** - Good balance
- **Mistral-7B** - Popular choice
### Large Models (70B)
- **Llama-3.1-70B** - Best with IQ3_XS
## Quantization Selection
| VRAM Available | Recommended Quant |
|----------------|-------------------|
| < 5 GB | Q4_K_M |
| 5-10 GB | Q5_K_M |
| 10-15 GB | Q6_K |
| 25-30 GB (70B) | IQ3_XS |
EOF
cat > docs/guides/troubleshooting.md << 'EOF'
# Troubleshooting
Common issues and solutions for llcuda v2.2.0.
## GPU Not Detected
**Problem**: `No CUDA GPUs detected`
**Solution**:
1. Check Kaggle Settings → Accelerator → GPU T4 × 2
2. Restart kernel
3. Run `nvidia-smi` to verify
## Server Won't Start
**Problem**: `llama-server failed to start`
**Solution**:
```python
server = ServerManager()
logs = server.get_logs()
print(logs) # Check error messages
```
## Out of Memory
**Problem**: `CUDA out of memory`
**Solution**:
- Use smaller quantization (Q4_K_M → IQ3_XS)
- Reduce context_size
- Enable tensor-split for dual GPU
EOF
cat > docs/guides/faq.md << 'EOF'
# FAQ
Frequently asked questions about llcuda v2.2.0.
## General
**Q: Does llcuda work on Google Colab?**
A: No, v2.2.0 is optimized for Kaggle dual T4. Colab has single T4.
**Q: Can I use llcuda locally?**
A: Yes, with Tesla T4 or compatible GPU and CUDA 12.x.
**Q: Is PyPI installation available?**
A: No, install from GitHub: `pip install git+https://github.com/llcuda/llcuda.git@v2.2.0`
## Technical
**Q: What's the difference between tensor-split and NCCL?**
A: llama.cpp uses native CUDA tensor-split, not NCCL. NCCL is for PyTorch distributed training.
**Q: Can I run 70B models?**
A: Yes, with IQ3_XS quantization on dual T4 (30GB VRAM).
**Q: What quantization should I use?**
A: Q4_K_M for most models, IQ3_XS for 70B.
EOF
cat > docs/guides/build-from-source.md << 'EOF'
# Build from Source
Build llcuda v2.2.0 binaries from source on Kaggle.
## Prerequisites
- Kaggle dual T4 environment
- CUDA 12.5 toolkit
- CMake 3.24+
## Build Steps
```bash
# Clone llama.cpp
git clone https://github.com/ggml-org/llama.cpp
cd llama.cpp
git checkout 388ce82 # v2.2.0 commit
# Build with CUDA
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DGGML_CUDA=ON \
-DCMAKE_CUDA_ARCHITECTURES=75 \
-DGGML_CUDA_FA_ALL_QUANTS=ON \
-DBUILD_SHARED_LIBS=OFF \
-DLLAMA_BUILD_SERVER=ON
cmake --build build --config Release -j8
```
See: Complete build notebook in repository.
EOF
# Create API reference pages
cat > docs/api/overview.md << 'EOF'
# API Reference
Complete API documentation for llcuda v2.2.0.
## Core Modules
- [`llcuda.api.client`](client.md) - OpenAI-compatible client
- [`llcuda.api.multigpu`](multigpu.md) - Multi-GPU configuration
- [`llcuda.api.gguf`](gguf.md) - GGUF tools
- [`llcuda.api.nccl`](nccl.md) - NCCL integration
- [`llcuda.server`](server.md) - Server management
- [`llcuda.graphistry`](graphistry.md) - Graphistry integration
## Quick Examples
### Start Server
```python
from llcuda.server import ServerManager, ServerConfig
config = ServerConfig(model_path="model.gguf")
server = ServerManager()
server.start_with_config(config)
```
### OpenAI Client
```python
from llcuda.api import LlamaCppClient
client = LlamaCppClient()
response = client.chat.completions.create(
messages=[{"role": "user", "content": "Hello"}]
)
```
### Multi-GPU
```python
from llcuda.api.multigpu import kaggle_t4_dual_config
config = kaggle_t4_dual_config()
print(config.to_cli_args())
```
EOF
cat > docs/api/client.md << 'EOF'
# LlamaCppClient
OpenAI-compatible client for llama.cpp server.
## Usage
```python
from llcuda.api import LlamaCppClient
client = LlamaCppClient("http://localhost:8080")
response = client.chat.completions.create(
messages=[
{"role": "system", "content": "You are helpful."},
{"role": "user", "content": "Hello!"}
],
max_tokens=100,
temperature=0.7,
)
print(response.choices[0].message.content)
```
## Methods
- `chat.completions.create()` - Chat completions
- `completions.create()` - Text completions
- `embeddings.create()` - Generate embeddings
## Streaming
```python
stream = client.chat.completions.create(
messages=[...],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content, end="")
```
EOF
cat > docs/api/multigpu.md << 'EOF'
# Multi-GPU API
Configure multi-GPU inference for Kaggle dual T4.
## Functions
### `detect_gpus()`
```python
from llcuda.api.multigpu import detect_gpus
gpus = detect_gpus()
for gpu in gpus:
print(f"GPU {gpu.id}: {gpu.name} ({gpu.memory_total_gb:.1f} GB)")
```
### `kaggle_t4_dual_config()`
```python
from llcuda.api.multigpu import kaggle_t4_dual_config
config = kaggle_t4_dual_config(model_size_gb=25)
# Returns MultiGPUConfig optimized for dual T4
```
### `estimate_model_vram()`
```python
from llcuda.api.multigpu import estimate_model_vram
vram = estimate_model_vram(
param_count=7, # 7B model
quantization="Q4_K_M",
ctx_size=4096
)
print(f"Estimated VRAM: {vram:.1f} GB")
```
## Classes
### `MultiGPUConfig`
```python
from llcuda.api.multigpu import MultiGPUConfig, SplitMode
config = MultiGPUConfig(
n_gpu_layers=-1,
tensor_split=[0.5, 0.5],
split_mode=SplitMode.LAYER,
flash_attention=True,
)
cli_args = config.to_cli_args()
```
EOF
echo "✅ Created all remaining documentation pages"
echo ""
echo "📝 Next steps:"
echo "1. chmod +x create_remaining_docs.sh"
echo "2. ./create_remaining_docs.sh"
echo "3. mkdocs serve"
echo "4. mkdocs gh-deploy"
EOF
chmod +x create_remaining_docs.sh
echo "✓ Created deployment script: create_remaining_docs.sh"