在截止日期云中使用 AI 代理 - 截止日期云

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

在截止日期云中使用 AI 代理

使用 AI 代理在 Deadline Cloud 中编写任务捆绑包、开发 conda 包和排除作业故障。本主题解释了什么是 AI 代理、有效使用它们的关键点以及帮助代理了解 Deadline Cloud 的资源。

AI 代理是一种使用大型语言模型 (LLM) 自主执行任务的软件工具。AI 代理可以读取和写入文件、运行命令以及根据反馈迭代解决方案。示例包括命令行工具,例如 Kiro 和集成了 IDE 的助手。

使用 AI 代理的要点

以下关键点可帮助您在将 AI 代理与 Deadline Cloud 配合使用时获得更好的结果。

  • 提供基础 — AI 代理在可以访问相关文档、规格和示例时表现最佳。您可以通过将代理指向特定的文档页面、共享现有示例代码作为参考、将相关的开源存储库克隆到本地工作区以及为第三方应用程序提供文档来提供基础。

  • 指定成功标准-定义代理的预期结果和技术要求。例如,当您要求代理开发任务包时,请指定任务输入、参数和预期输出。如果您不确定规格,请代理商先提出选项,然后一起完善要求。

  • 启用反馈循环 — 当 AI 代理可以测试其解决方案并接收反馈时,他们可以更有效地进行迭代。与其指望在第一次尝试时得到有效的解决方案,不如让代理能够运行其解决方案并查看结果。当代理可以访问状态更新、日志和验证错误时,这种方法效果很好。例如,在开发任务包时,允许代理提交任务并查看日志。

  • 期望迭代 — 即使有良好的上下文,代理也可能偏离正轨,或者做出与您的环境不匹配的假设。观察代理如何完成任务,并在此过程中提供指导。如果代理遇到困难,可以添加缺失的上下文,通过指向特定的日志文件来帮助发现错误,在发现要求时对其进行细化,并添加负面要求以明确说明代理应避免的内容。

代理上下文资源

以下资源可帮助 AI 代理理解 Deadline Cloud 的概念并生成准确的输出。

提示示例:编写工作包

以下示例提示演示如何使用 AI 代理创建任务捆绑包,用于训练 LoRa(低等级适应)适配器以生成 AI 图像。该提示说明了前面讨论的要点:它通过指向相关存储库提供了基础,定义了任务包输出的成功标准,并概述了迭代开发的反馈循环。

Write a pair of job bundles for Deadline Cloud that use the diffusers Python library to train a LoRA adapter on a set of images and then generate images from it. Requirements: - The training job takes a set of JPEG images as input, uses an image description, LoRA rank, learning rate, batch size, and number of training steps as parameters, and outputs a `.safetensors` file. - The generation job takes the `.safetensors` file as input and the number of images to generate, then outputs JPEG images. The jobs use Stable Diffusion 1.5 as the base model. - The jobs run `diffusers` as a Python script. Install the necessary packages using conda by setting the job parameters: - `CondaChannels`: `conda-forge` - `CondaPackages`: list of conda packages to install For context, clone the following repositories to your workspace and review their documentation and code: - OpenJobDescription specification: https://github.com/OpenJobDescription/openjd-specifications/blob/mainline/wiki/2023-09-Template-Schemas.md - Deadline Cloud sample job bundles: https://github.com/aws-deadline/deadline-cloud-samples/tree/mainline/job_bundles - diffusers library: https://github.com/huggingface/diffusers Read through the provided context before you start. To develop a job bundle, iterate with the following steps until the submitted job succeeds. If a step fails, update the job bundle and restart the loop: 1. Create a job bundle. 2. Validate the job template syntax: `openjd check` 3. Submit the job to Deadline Cloud: `deadline bundle submit` 4. Wait for the job to complete: `deadline job wait` 5. View the job status and logs: `deadline job logs` 6. Download the job output: `deadline job download-output` To verify the training and generation jobs work together, iterate with the following steps until the generation job produces images that resemble the dog in the training data: 1. Develop and submit a training job using the training images in `./exdog` 2. Wait for the job to succeed then download its output. 3. Develop and submit a generation job using the LoRA adapter from the training job. 4. Wait for the job to succeed then download its output. 5. Inspect the generated images. If they resemble the dog in the training data, you're done. Otherwise, review the job template, job parameters, and job logs to identify and fix the issue.