Training Node Guide

How to stake and submit a Training Task

This guide provides step-by-step instructions for the entire Training Node workflow. By the end you will have successfully staked as a Training Node, completed a training task, and claimed your staking rewards.

Be sure you have completed all pre-requisite tasks.

You can only choose one role per task!

1. Stake FML as Training Node from train.flock.io

  1. Navigate to the Training Node tab on the Stake page

  2. Select a training task

  3. Stake FML

Once you’ve confirmed and approved the transaction in your web3 wallet, you will see a box on the Training Node tab with your stake details.

2. Get API key

Your API key is required for all remaining Validator steps. You can get it from the web app.

  1. Select dropdown in upper right corner of web app

  2. Select API

  3. On the API page, copy your API key

Once you have your API key, you can proceed to the next step.

NOTE: If you have issues generating an API key try removing any ad blocker extensions and/or clearing your cookies.

Video Tutorial

3. Set up your environment

Windows

For Windows users, we suggest installing WSL. Follow the guidance: WSL installation

Mac/Linux

You can install Anaconda via HERE

4. Clone the QuickStart repo

The quickstart repo contains everything you need to run our full_automation.py script. To clone it run:

git clone https://github.com/FLock-io/testnet-training-node-quickstart.git

To set up all packages within the project directory

conda create -n training-node python==3.10
conda activate training-node
pip install -r requirements.txt

File Structure

  • dataset.py - Contains the logic to process the raw data from demo_data.jsonl.

  • demo_data.jsonl - Follows the shareGPT format. The training data you receive from the fed-ledger is in exactly the same format.

  • merge.py - Contains the utility function for merging LoRA weights. If you are training with LoRA, please ensure you merge the adapter before uploading to your Hugging Face repository.

  • demo.py - A training script that implements LoRA fine-tuning for a Gemma-2B model.

5. Get information required to run automation script

The script described in the following step automates the following:

  • Gets a task

  • Downloads the training data

  • Finetunes Gemma-2B on training data

  • Merges weights

  • Uploads to your Hugging Face model repo

  • Submits the task to fed-ledger

To run it, you will need:

  • TASK_ID - the id of the task you are staking on as Training Node

  • FLOCK_API_KEY - available at https://train.flock.io/flock_api

  • HF_TOKEN - your Hugging Face Access Token (Hugging Face > Profile > Settings > Access Tokens)

  • HG_USERNAME - your Hugging Face user name

NOTE: If you haven't already done so, please acknowledge license to access Gemma on Hugging Face:

https://huggingface.co/google/gemma-2b

6. Run full automation script

Once you have all the information listed in the previous step, paste the script below into your terminal, update the repsective values, and run the command.

TASK_ID=<task-id> FLOCK_API_KEY="<your-flock-api-key-stakes-as-node-for-the-task>" HF_TOKEN="<your-hf-token>" CUDA_VISIBLE_DEVICES=0 HF_USERNAME="your-hf-user-name" python full_automation.py

NOTE: Tasks can be completed with any supported base LLM model. The only restriction is max_param.You can use any technique to train or fine-tune a model, all you need to make sure is that the model can be successfully run by our validation script.

6. Claim rewards

Reward distribution is triggered every 24 hours at midnight UTC. The final round of reward distribution is triggered at the once the task training period is complete.

You can claim your rewards via train.flock.io.

Last updated