搭配截止日期雲端使用 AI 代理器 - 截止日期雲端

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

搭配截止日期雲端使用 AI 代理器

使用 AI 代理器在截止日期雲端中撰寫任務套件、開發 conda 套件和疑難排解任務。本主題說明什麼是 AI 代理器、有效使用這些代理器的重點,以及協助代理器了解截止日期雲端的資源。

AI 代理器是一種軟體工具,使用大型語言模型 (LLM) 自動執行任務。AI 代理器可以讀取和寫入檔案、執行命令,並根據意見回饋根據解決方案反覆執行。範例包括命令列工具,例如 Kiro 和 IDE 整合助理。

使用 AI 代理器的重點

下列重點可協助您在將 AI 代理器與截止日期雲端搭配使用時獲得更好的結果。

  • 提供基礎 – AI 代理器在能夠存取相關文件、規格和範例時表現最佳。您可以透過將代理程式指向特定文件頁面、將現有的範例程式碼做為參考共用、將相關的開放原始碼儲存庫複製到本機工作區,以及提供第三方應用程式的文件來提供基礎。

  • 指定成功條件 – 定義客服人員的預期成果和技術需求。例如,當您要求代理程式開發任務套件時,請指定任務輸入、參數和預期的輸出。如果您不確定規格,請要求客服人員先提議選項,然後一起精簡需求。

  • 啟用意見回饋迴圈 – 當 AI 代理器可以測試其解決方案並接收意見回饋時,它們會更有效地迭代。請不要在第一次嘗試時預期可行的解決方案,而是讓代理程式能夠執行其解決方案並檢閱結果。當代理程式可以存取狀態更新、日誌和驗證錯誤時,此方法運作良好。例如,當您開發任務套件時,允許代理程式提交任務並檢閱日誌。

  • 預期反覆 – 即使內容良好,客服人員也可以偏離正軌或做出不符合您環境的假設。觀察客服人員如何接近任務,並在整個過程中提供指引。如果客服人員遇到困難,請新增缺少的內容,透過指向特定日誌檔案來協助尋找錯誤、在發現需求時縮小需求範圍,並新增負面需求,以明確說明客服人員應該避免的情況。

客服人員內容的資源

下列資源可協助 AI 代理器了解截止日期雲端概念,並產生準確的輸出。

  • 截止日期雲端模型內容協定 (MCP) 伺服器 – 對於支援模型內容協定的客服人員,截止日期雲端儲存庫包含截止日期雲端用戶端,其中包含用於與任務互動的 MCP 伺服器。

  • AWS文件 MCP 伺服器 – 對於支援 MCP 的代理程式,請設定AWS文件 MCP 伺服器,讓代理程式直接存取AWS文件,包括截止日期雲端使用者指南和開發人員指南。

  • 開啟任務描述規格 – GitHub 上的開啟任務描述規格會定義任務範本的結構描述。當客服人員需要了解任務範本的結構和語法時,請參考此儲存庫。

  • deadline-cloud-samplesdeadline-cloud-samples 儲存庫包含常見應用程式和使用案例的範例任務套件、conda 配方和CloudFormation範本。

  • aws-deadline GitHub 組織aws-deadline GitHub 組織包含許多第三方應用程式的參考外掛程式,您可以用作其他整合的範例。

範例提示:撰寫任務套件

下列範例提示示範如何使用 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.