该技能用于在 inference.sh 平台上构建和部署应用,应用可用 Python 或 Node.js 编写。
用途:入门平台、理解结构、创建应用、配置资源等。
安装与命令: curl -fsSL https://cli.inference.sh | sh belt update belt login belt me
必须使用 belt app init 脚手架创建应用,禁止手工创建 inf.yml、inference.py、inference.js、init.py、package.json 或应用目录。示例: belt app init my-app belt app init my-app --lang node
工作流:实现代码后本地测试并部署: cd my-app belt app test --save-example belt app test belt app deploy --dry-run belt app deploy belt app run user/app --json --input '{"prompt": "hello"}'
代码要点:包含 output_meta 的输出类必须继承 BaseAppOutput 而非 BaseModel;run() 中默认加入 self.logger.info(...);跨同级应用共享模块需用符号链接、init.py 与相对导入。
配置:inf.yml 定义 name、category、kernel、resources、env、secrets、integrations。Python 依赖用 requirements.txt,Node.js 用 package.json,系统依赖用 packages.txt。资源单位 CLI 会自动转换。
限制:GPU 类型 even when 写 any/nvidia/amd/apple/none,目前仅支持 NVIDIA CUDA GPU;GPU 设备检测建议用 accelerate 而非 torch.cuda.is_available()。价格、计费等暂未提供。