AI Art

LoRA Training with AI-Toolkit on Vast.Ai under 50 cents


After exploring may of the possibilities on the RunPod platform, I started to explore other providers. Vast.Ai offers RTX4090 for under $0.49 per hour which means that its 20 cents cheaper than using it on RunPod. So as my first experiment I decided to see if I can get Flux LoRA trained using AI-Toolkit UI. I have found which of their templates would be best suited and in this post are the steps to get Ai-Toolkit UI working on Vast.Ai

First of all make an account on Vast.Ai and load up some credits, I started with $20 for all my experiments.

Select Template

The template you want to use is their PyTorch (Vast), set the Disk Space to Allocate to about 80GB. You will see the GPUs available on the right side and you can filter to select RTX 4090. You see in the screenshot they start from as little as $0.335/hr, you also see the location of where they would run up eg. Hong Kong, Spain, Utah etc.

Once the Instance is started you can access your instance from Instances menu. You can take further actions on the Instance via the toolbar at the bottom of the instance. If yours looks somewhat different don’t worry, this is because I started using the latest UI (Settings > Early Access > opt-in)

To open the applications click on Open and then you can launch the Jupyter Application. There is something else you should notice which is Tunnels. We will use this later on, this is how we expose additional applications via their specific ports.

Now that you have the JupyterLab running, simply Open JupyterLab which has all the bells and whistles we need to install Ai-Toolkit.

Now we are ready to start installing the Ai-Toolkit app, which only takes a few minutes.

Install AI-Toolkit on Vast.Ai

Open the Terminal in the JupyterLab and simply copy paste the following command to run. The beauty of the Vast.Ai template is that it already has NPM installed (Node.js) so we don’t need to do additional work.

git clone  
cd ai-toolkit 
git submodule update --init --recursive 
python3 -m venv venv source venv/bin/activate 
pip3 install --no-cache-dir torch==2.6.0 torchvision==0.21.0 --index-url  
pip3 install -r requirements.txt

Once this is installed and done all you need to do is setup a new tunnel and then launch the app.

To setup the Tunnel remember above the Tunnel section. Ai-Toolkit UI runs on port 8675. Enter the Tunnel address and click on Create New Tunnel. It does take a few seconds to setup so make sure you do this before you launch the Ai-Toolkit UI.

Open a New Terminal window in JupyterLab and simply drop the following command to launch the Ai-Toolkit UI

cd /workspace/ai-toolkit/ui
npm run build_and_start

Once the service and application are up and running you can Copy URL of the tunnel and open it in a new browser tab/window. You have the Ostris – AI Toolkit ready to go.

In order to train your LoRA you need to create and upload your Datasets. Next setup a New Job with the settings you want and you can go for gold. If you are going to train on Flux make sure you update the Hugging Face token in the Settings page.

If you’d like to support our site please consider buying us a Ko-fi, grab a product or subscribe. Need a faster GPU, get access to fastest GPUs for less than $1 per hour with RunPod.io

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button