fine-tuning
Skill15 starsChanged 57 days agoMITView on GitHub
- Category: compute - SDK: @0gfoundation/0g-compute-ts-sdk ^0.9.0 (CLI-based workflow) - Activation Triggers: "fine-tune", "train model", "custom model", "model training", "LoRA", "adapter", "deploy adapter" Fine-tune AI models on 0G's distributed GPU network. Upload training data, configure parameters, monitor training, and download the resulting model. Then deploy the result as a LoRA adapter on an inference provider and chat with it. Training is currently testnet only.
- Reads credentials
2 other projects use a version of this.
Adopted by
Most recently taken up by
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Oct 13, 2026
- tim-osterhus/millrace-skillstheir own version, first seen Apr 28, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- nimadorostkar/Claude-Skills-collection★ 33same name
- tim-osterhus/millrace-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-accountsSkill
- agent-reputationSkill
- deploy-agentSkill
- interact-agentSkill
- manage-agentSkill
- deploy-contractSkill
- interact-contractSkill
- scaffold-projectSkill
- account-managementSkill
- embeddingsSkill
- image-editingSkill
- provider-discoverySkill
- speech-to-textSkill
- streaming-chatSkill
- text-to-imageSkill
- video-generationSkill
- compute-plus-storageSkill
- storage-plus-chainSkill
- 0g-pc-setupSkill
- 0g-pc-switch-modelSkill
- 0g-pc-uninstallSkill
- download-fileSkill
- merkle-verificationSkill
- upload-fileSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 39
Use testnet (fine-tuning not yet on mainnet)
- Distinctive: line 40
Verify provider availability before uploading data
- Very specific: line 43
Wait for Delivered status before downloading
- Very specific: line 44
Wait for Finished status before decrypting
- Very specific: line 46
Use correct processResponse() param order: (providerAddress, chatID, usageData)
- Distinctive: line 51
Create a new task while previous task is running
- Distinctive: line 54
Use mainnet for fine-tuning (not yet supported)
- Distinctive: line 56
Use ethers v5 syntax
- Very specific: line 253
If you already know the adapter's exact name, skip task/model resolution entirely with deployAdapterByName(providerAddress, adapterName, …
- Distinctive: line 289
Always transfer 10-20% extra as buffer
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Model Fine-Tuning
Metadata
- Category: compute
- SDK:
@0gfoundation/0g-compute-ts-sdk^0.9.0 (CLI-based workflow) - Activation Triggers: "fine-tune", "train model", "custom model", "model training", "LoRA", "adapter", "deploy adapter"
Purpose
Fine-tune AI models on 0G's distributed GPU network. Upload training data, configure parameters, monitor training, and download the resulting model. Then deploy the result as a LoRA adapter on an inference provider and chat with it. Training is currently testnet only.
Prerequisites
- Node.js >= 20 (the SDK declares
engines.node >= 20.0.0) @0gfoundation/0g-compute-ts-sdkinstalled (ships a0g-compute-clibinary)- Testnet wallet with 0G tokens
- Training dataset in required format
- Configuration file for training parameters
Quick Workflow
- List available providers and models
- Prepare dataset and configuration
- Upload dataset to 0G Storage
- Calculate dataset size for cost estimation
- Transfer funds to provider
- Create fine-tuning task
- Monitor progress
- Download and decrypt model when complete
Core Rules
ALWAYS
- Use testnet (fine-tuning not yet on mainnet)
- Verify provider availability before uploading data
- Save the root hash from dataset upload
- Save the task ID from task creation
- Wait for
Deliveredstatus before downloading - Wait for
Finishedstatus before decrypting - Acknowledge provider before first use
- Use correct
processResponse()param order:(providerAddress, chatID, usageData) - Extract ChatID from
ZG-Res-Keyheader first, body as fallback (chatbot only)
NEVER
- Create a new task while previous task is running
- Initiate refund during active fine-tuning
- Forget to decrypt the downloaded model
- Use mainnet for fine-tuning (not yet supported)
- Hardcode private keys
- Use ethers v5 syntax
Task Status Lifecycle
Init -> SettingUp -> SetUp -> Training -> Trained -> Delivering -> Delivered -> UserAcknowledged -> Finished
|
Failed| Status | Description | Action |
Init | Task submitted | Wait |
SettingUp | Provider preparing | Wait |
Training | Model training | Monitor logs |
Delivered | Result uploaded | Download model |
UserAcknowledged | Download confirmed | Wait for key |
Finished | Complete | Decrypt model |
Failed | Task failed | Check logs |
Complete Workflow (CLI)
1. Find Provider
0g-compute-cli fine-tuning list-providers
# Official testnet provider: 0xf07240Efa67755B5311bc75784a061eDB47165Dd2. List Available Models
0g-compute-cli fine-tuning list-models
# Available: distilbert-base-uncased (Text Classification)3. Upload Dataset
0g-compute-cli fine-tuning upload --data-path ./my_dataset.json
# Output: Root hash: 0xabc123...4. Calculate Size
0g-compute-cli fine-tuning calculate-token \
--model distilbert-base-uncased \
--dataset-path ./my_dataset.json \
--provider 0xf07240Efa67755B5311bc75784a061eDB47165Dd5. Fund Provider
0g-compute-cli transfer-fund \
--provider 0xf07240Efa67755B5311bc75784a061eDB47165Dd \
--amount 16. Create Task
0g-compute-cli fine-tuning create-task \
--provider 0xf07240Efa67755B5311bc75784a061eDB47165Dd \
--model distilbert-base-uncased \
--dataset 0xabc123... \
--config-path ./config.json \
--data-size 1000000
# Output: Created Task ID: 6b607314-88b0-4fef-91e7-43227a54de577. Monitor Progress
0g-compute-cli fine-tuning get-task \
--provider 0xf07240Efa67755B5311bc75784a061eDB47165Dd \
--task 6b607314-88b0-4fef-91e7-43227a54de57
# View training logs
0g-compute-cli fine-tuning get-log \
--provider 0xf07240Efa67755B5311bc75784a061eDB47165Dd \
--task 6b607314-88b0-4fef-91e7-43227a54de578. Download Model (when status = Delivered)
0g-compute-cli fine-tuning acknowledge-model \
--provider 0xf07240Efa67755B5311bc75784a061eDB47165Dd \
--task-id 6b607314-88b0-4fef-91e7-43227a54de57 \
--data-path ./encrypted_model.bin9. Decrypt Model (when status = Finished)
0g-compute-cli fine-tuning decrypt-model \
--provider 0xf07240Efa67755B5311bc75784a061eDB47165Dd \
--task-id 6b607314-88b0-4fef-91e7-43227a54de57 \
--encrypted-model ./encrypted_model.bin \
--output ./my_model.zip
unzip ./my_model.zip -d ./my_fine_tuned_model/SDK Integration
import { ethers } from 'ethers';
import { createZGComputeNetworkBroker } from '@0gfoundation/0g-compute-ts-sdk';
import 'dotenv/config';
async function checkFineTuningAccount(providerAddress: string) {
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const broker = await createZGComputeNetworkBroker(wallet);
// Transfer funds for fine-tuning
await broker.ledger.transferFund(providerAddress, 'fine-tuning', ethers.parseEther('1'));
// IMPORTANT: fineTuning.getAccountWithDetail() resolves to an OBJECT
// { account, refunds }
// It is NOT a tuple. Array-destructuring it throws "is not iterable".
// (The *inference* broker's method of the same name DOES return a tuple —
// the two are not interchangeable.)
const { account, refunds } = await broker.fineTuning.getAccountWithDetail(providerAddress);
console.log(`Fine-tuning balance: ${ethers.formatEther(account.balance)} 0G`);
console.log(`Pending refund: ${ethers.formatEther(account.pendingRefund)} 0G`);
console.log(`Acknowledged: ${account.acknowledged}`);
console.log(`Pending refunds: ${refunds.length}`);
}
accountis a hybrid tuple/object whose positional layout is[user, provider, nonce, balance, pendingRefund, refunds, additionalInfo, deliverables, ...]— notebalanceis at index 3, not 2. Use named access.
Deploying the Result as a LoRA Adapter
Training produces an adapter, not a standalone model. To actually use it, deploy it onto an
inference provider's GPU and then chat against it. These calls live on broker.inference, not
broker.fineTuning.
import { ethers } from 'ethers';
import { createZGComputeNetworkBroker } from '@0gfoundation/0g-compute-ts-sdk';
import 'dotenv/config';
async function deployAndChat(providerAddress: string, taskId: string, baseModel: string) {
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const broker = await createZGComputeNetworkBroker(wallet);
// The broker may name the adapter differently from your local convention,
// so resolve the real name from the task id before deploying.
const adapterName = await broker.inference.resolveAdapterName(providerAddress, taskId, baseModel);
// Deploy and wait for it to become active
const deployment = await broker.inference.deployAdapter(providerAddress, baseModel, taskId, {
wait: true,
timeoutSeconds: 600,
onProgress: (state) => console.log(` adapter state: ${state}`),
});
console.log('deploy response:', deployment);
// Confirm status before sending traffic
const status = await broker.inference.getAdapterStatus(providerAddress, adapterName);
console.log('adapter status:', status);
// Chat against the fine-tuned adapter
const reply = await broker.inference.chatWithFineTunedModel(
providerAddress,
adapterName,
'Summarise what you were fine-tuned to do.',
);
console.log('reply:', reply);
return reply;
}List what is already deployed on a provider:
async function listAdapters(providerAddress: string) {
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const broker = await createZGComputeNetworkBroker(wallet);
const adapters = await broker.inference.listAdapters(providerAddress);
for (const a of adapters) console.log(a);
return adapters;
}If you already know the adapter's exact name, skip task/model resolution entirely with
deployAdapterByName(providerAddress, adapterName, options).
Error Handling
async function monitorTask(providerAddress: string, taskId: string) {
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const broker = await createZGComputeNetworkBroker(wallet);
const pollInterval = 30000; // 30 seconds
const maxAttempts = 120; // 1 hour max
for (let attempt = 0; attempt < maxAttempts; attempt++) {
try {
// Check task status via CLI or SDK
console.log(`Polling task ${taskId} (attempt ${attempt + 1})...`);
// In practice, use CLI: 0g-compute-cli fine-tuning get-task
// SDK integration for status checking may vary
await new Promise((resolve) => setTimeout(resolve, pollInterval));
} catch (error) {
console.error('Status check failed:', error);
if (attempt === maxAttempts - 1) throw error;
}
}
}Cost Estimation
- Price based on dataset size (bytes) x provider rate
- Typical rate:
0.000000000000000001 0Gper byte - Calculate with
0g-compute-cli fine-tuning calculate-token - Always transfer 10-20% extra as buffer
Anti-Patterns
# BAD: Creating task while another is running
0g-compute-cli fine-tuning create-task ... # Error: provider busy
# BAD: Downloading before Delivered status
0g-compute-cli fine-tuning acknowledge-model ... # Will fail
# BAD: Decrypting before Finished status
0g-compute-cli fine-tuning decrypt-model ... # Key not available yet// BAD: Hardcoding private keys
const wallet = new ethers.Wallet('0xabc123...', provider); // NEVER do this
// BAD: ethers v5 syntax
const provider = new ethers.providers.JsonRpcProvider(url); // v5!Common Errors & Fixes
| Error | Cause | Fix |
Provider busy | Previous task running | Wait or use different provider |
Insufficient balance | Sub-account empty | Transfer more funds |
Dataset validation failed | Wrong format | Check dataset structure |
Decryption failed | Wrong status or key | Wait for Finished status |
Task failed | Config or data issue | Check logs for details |
Provider not acknowledged | First-time provider | acknowledgeProviderSigner() |
Related Skills
- Provider Discovery — find fine-tuning providers
- Account Management — fund fine-tuning account
References
- Compute Patterns
- Network Config
- 0G Serving Broker Releases
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

