スキル一覧に戻る
johnzfitch

burn-training

by johnzfitch

Comprehensive Claude Code plugin for the Burn deep learning framework

1🍴 0📅 2026年1月19日
GitHubで見るManusで実行

SKILL.md


name: burn-training description: This skill should be used when the user asks about "training loop", "Learner", "metrics", "dataset", "dataloader", "checkpointing", "optimizer", "learning rate scheduler", "custom training", or Burn training workflows. version: 0.1.0

Burn Training

Knowledge for training neural networks with Burn's Learner abstraction and custom loops.

Learner Setup

The Learner orchestrates training with built-in features:

let learner = LearnerBuilder::new(artifact_dir)
    // Metrics
    .metric_train_numeric(AccuracyMetric::new())
    .metric_valid_numeric(AccuracyMetric::new())
    .metric_train_numeric(LossMetric::new())
    // Checkpointing
    .with_file_checkpointer(CompactRecorder::new())
    // Configuration
    .devices(vec![device.clone()])
    .num_epochs(config.num_epochs)
    .summary()
    .build(model, optim, lr_scheduler);

// Train
let trained_model = learner.fit(dataloader_train, dataloader_valid);

Dataset Implementation

Implement the Dataset trait:

pub struct MyDataset {
    items: Vec<MyItem>,
}

impl Dataset<MyItem> for MyDataset {
    fn get(&self, index: usize) -> Option<MyItem> {
        self.items.get(index).cloned()
    }

    fn len(&self) -> usize {
        self.items.len()
    }
}

Batcher

Convert dataset items to tensors:

#[derive(Clone)]
pub struct MyBatcher<B: Backend> {
    device: B::Device,
}

impl<B: Backend> Batcher<MyItem, MyBatch<B>> for MyBatcher<B> {
    fn batch(&self, items: Vec<MyItem>) -> MyBatch<B> {
        // Convert items to tensors
        let inputs = items.iter().map(|i| i.input.clone()).collect();
        let targets = items.iter().map(|i| i.target).collect();

        MyBatch {
            inputs: Tensor::stack(inputs, 0).to_device(&self.device),
            targets: Tensor::from_data(targets, &self.device),
        }
    }
}

Metrics

Built-in metrics:

  • AccuracyMetric — Classification accuracy
  • LossMetric — Training/validation loss
  • LearningRateMetric — Current LR

Custom metrics implement the Metric trait (not MetricEntry).

Custom Training Loops

For advanced scenarios (multiple optimizers, GAN training):

for epoch in 0..num_epochs {
    for batch in dataloader.iter() {
        // Forward
        let output = model.forward(batch.inputs);
        let loss = output.cross_entropy(batch.targets);

        // Backward
        let grads = loss.backward();

        // Update
        model = optim.step(lr, model, grads);
    }
}

Additional Resources

Consult references/topic-map-training.md for:

  • Advanced Learner configuration
  • Learning rate schedulers
  • Multi-GPU training
  • Checkpointing strategies

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です