DEV Community
Follow
From git push to Fine-Tuned Model in Production
The author developed nebius-actions, a set of GitHub Actions to automate model fine-tuning and deployment on Nebius AI Cloud. The goal was to achieve a fully automated pipeline triggered by a single button click in GitHub. This pipeline involves spinning up GPU infrastructure, fine-tuning a model, packaging it, deploying it to an endpoint, testing it, and cleaning up all resources. A demo workflow orchestrates this through five distinct GitHub jobs: submit, wait, deploy, try, and cleanup. State information is passed between these jobs using their outputs.The submit job, which contains most of the logic, creates an Axolotl configuration and a bash script inline. This script handles the fine-tuning process with Axolotl, packages the adapters, and pushes a serving image to the Nebius Container Registry. It also provisions a new S3 bucket for each run and creates a Nebius Job. Authentication is managed securely using short-lived IAM tokens.The wait job streams logs from the Nebius GPU job and polls its status, crucially including logic to cancel the GPU job if the GitHub workflow is cancelled to prevent unexpected costs. The deploy job creates a Nebius Endpoint using the newly built image and then a separate wait job polls for the endpoint to become ready. The try job performs a simple smoke test by checking the endpoint's health and making a sample API call to verify functionality. Finally, the cleanup job, running with an always condition, ensures that the deployed endpoint and provisioned S3 bucket are deleted, preventing leftover resources and cloud bills. The image remains in the registry for potential redeployment. The nebius-actions are designed to be small, composable building blocks, with each action managing a single resource.