Agent SkillsEventual-Inc/Daft › daft-udf-tuning

daft-udf-tuning

GitHub

提供Daft UDF性能优化指南,涵盖无状态/有状态UDF类型选择、异步I/O及GPU批量推理实战示例,详解并发、显存与批处理等调优关键参数。

.claude/skills/daft-udf-tuning/SKILL.md Eventual-Inc/Daft

触发场景

需要优化Daft UDF执行速度 配置GPU进行模型推理 询问异步或批量处理策略

安装

npx skills add Eventual-Inc/Daft --skill daft-udf-tuning -g -y
更多选项

非标准路径

npx skills add https://github.com/Eventual-Inc/Daft/tree/main/.claude/skills/daft-udf-tuning -g -y

不安装直接使用

npx skills use Eventual-Inc/Daft@daft-udf-tuning

指定 Agent (Claude Code)

npx skills add Eventual-Inc/Daft --skill daft-udf-tuning -a claude-code -g -y

安装 repo 全部 skill

npx skills add Eventual-Inc/Daft --all -g -y

预览 repo 内 skill

npx skills add Eventual-Inc/Daft --list

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.

版本历史

  • f5d7e0f 当前 2026-07-05 20:20

同 Skill 集合

.claude/skills/daft-distributed-scaling/SKILL.md
.claude/skills/daft-docs-navigation/SKILL.md

元信息

文件数
0
版本
778fa42
Hash
916e167f
收录时间
2026-07-05 20:20

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-06 22:57
浙ICP备14020137号-1 $访客地图$