Agent Skills
› Eventual-Inc/Daft
› daft-udf-tuning
daft-udf-tuning
GitHub优化 Daft UDF 性能。适用于 GPU 推理、处理慢速 UDF 或询问异步/批处理场景。支持无状态、有状态及批量 UDF,提供并发、GPU 分配及分批调优策略。
Trigger Scenarios
用户需要 GPU 推理
遇到 UDF 执行缓慢
询问异步或批处理方法
Install
npx skills add Eventual-Inc/Daft --skill daft-udf-tuning -g -y
SKILL.md
Frontmatter
{
"name": "daft-udf-tuning",
"description": "Optimize Daft UDF performance. Invoke when user needs GPU inference, encounters slow UDFs, or asks about async\/batch processing."
}
Daft UDF Tuning
Optimize User-Defined Functions for performance.
UDF Types
| Type | Decorator | Use Case |
|---|---|---|
| Stateless | @daft.func |
Simple transforms. Use async for I/O-bound tasks. |
| Stateful | @daft.cls |
Expensive init (e.g., loading models). Supports gpus=N. |
| Batch | @daft.func.batch |
Vectorized CPU/GPU ops (NumPy/PyTorch). Faster. |
Quick Recipes
1. Async I/O (Web APIs)
@daft.func
async def fetch(url: str):
async with aiohttp.ClientSession() as s:
return await s.get(url).text()
2. GPU Batch Inference (PyTorch/Models)
@daft.cls(gpus=1)
class Classifier:
def __init__(self):
self.model = load_model().cuda() # Run once per worker
@daft.method.batch(batch_size=32)
def predict(self, images):
return self.model(images.to_pylist())
# Run with concurrency
df.with_column("preds", Classifier(max_concurrency=4).predict(df["img"]))
Tuning Keys
max_concurrency: Total parallel UDF instances.gpus=N: GPU request per instance.batch_size: Rows per call. Too small = overhead; too big = OOM.into_batches(N): Pre-slice partitions if memory is tight.
Version History
- f5d7e0f Current 2026-07-05 20:20


