Documentation on node and validators for train.flock.io
To interact with FLock's Fed Ledger service, you have to obtain API key from train.flock.io
first.
If you want to submit the model for a given training task, you have to stake through the Web UI for that task, or else Fed Ledger will not accept your submission.
curl --location 'https://fed-ledger-staging.flock.io/api/v1/tasks/get?task_id=<task id>'
To submit your trained model, you have to upload all model files to your public huggingface model repo first and then provide the repo name.
curl --location 'https://fed-ledger-staging.flock.io/api/v1/tasks/submit-result' \
--header 'flock-api-key: <your-api-key-with-staking-on-this-task-as-node>' \
--header 'Content-Type: application/json' \
--data '{
"task_id": <task id>,
"data":{
"hg_repo_id": "your-hg-name/model-name-7b"
}
}'
Similar to training task, you have to stake as a validator for a given task before you can request a task submission to validate on.
curl --location --request POST 'https://fed-ledger-staging.flock.io/api/v1/tasks/request-validation-assignment/<task id>' \
--header 'flock-api-key: <your-api-key-with-staking-on-this-task-as-validator>'
In response, you will get a id
for this validation assignment you are assigned. You need to provide this id
when you upload the validation result.
After you run the validation script and get the score, you can upload the validation result through
curl --location 'https://fed-ledger-staging.flock.io/api/v1/tasks/update-validation-assignment/<assignment id>' \
--header 'flock-api-key: <your-api-key-with-staking-on-this-task-as-validator>' \
--header 'Content-Type: application/json' \
--data '{
"status": "completed",
"data": {
"loss": 0.1
}
}'
If you couldn't complete the validation task for this submission, you can manually submit a failed result to Fed Ledger so that you can continue on other validation assignments.
curl --location 'https://fed-ledger-staging.flock.io/api/v1/tasks/update-validation-assignment/<assignment id>' \
--header 'flock-api-key: <your-api-key-with-staking-on-this-task-as-validator>' \
--header 'Content-Type: application/json' \
--data '{
"status": "failed"
}'