Lewati ke konten

Architecture

Konten ini belum tersedia dalam bahasa Anda.

Model training is split between a thin command line front end and a shared library. milu handles commands, configuration files, and reports. Models, data loading, and weight storage live in the nahpu_dl crate of the NAHPU API, so the NAHPU app can run the same models that milu trains.

milu (command line) nahpu_dl (NAHPU API) Model package
├── cli/ arguments ──▶ ├── models/ networks ──▶ ├── manifest.toml
└── core/ workflow steps ├── data/ loaders └── model.bpk
├── train ├── finetune training (or model.safetensors)
├── test ├── evaluate metrics
├── infer ├── predict inference
├── embed ├── embed embeddings
├── models ├── store weights
└── convert ├── manifest package metadata
└── hub pretrained downloads

Each milu workflow step in core/<step>/ has a runner (mod.rs), a config writer (init.rs), config types and defaults (configs.rs), summaries (reports.rs), and one file per backend. Any change to how a model is built, trained, or stored belongs in nahpu_dl, not in milu.

Every trained model is a directory with a manifest and one weight file:

skull_genus/
├── manifest.toml
└── model.bpk # or model.safetensors

The manifest records everything needed to load the model without extra configuration:

FieldDescription
nameHuman-readable model name
nahpu_dl_versionVersion of nahpu_dl that wrote the package
modalityKind of input the model takes (table or image)
taskWhat the model predicts
architectureNetwork architecture and its hyperparameters
labelsClass labels in output order; empty for regression
preprocessingHow raw inputs are turned into tensors
weightsThe package's weight file
embedding_dimSize of the embedding vector produced by the backbone
metricsSummary metrics from the last evaluation
provenanceWhere the model came from
  • Tabular: multilayer perceptron.
  • Images: ResNet-18, 34, 50, 101, and 152, and MobileNetV2. ImageNet-pretrained weights can be imported from torchvision or timm checkpoints, or downloaded from the Hugging Face Hub.
  • CSV or TSV tables with a header row, such as specimen measurements.
  • Image folders with one sub-directory of images per class.
  • Extracted NAHPU data packages, where specimen photos are labeled by the specimen's taxon at a chosen rank.

nahpu_dl is built on Burn. Cargo features select the backend and optional parts:

FeaturePurpose
flex (default)Pure-Rust CPU backend, multithreaded
wgpuGPU backend through Vulkan, Metal, or DX12
cudaCUDA backend
trainFine-tuning; off by default so inference-only builds stay small
hubDownload pretrained models from the Hugging Face Hub
CommandWhat it does
milu train initWrites a training config (milu_train.toml)
milu train runTrains or fine-tunes and writes a model package
milu testEvaluates a model and writes JSON and CSV reports
milu inferWrites predictions as CSV or JSON, with top-k labels
milu embedWrites embeddings as CSV or JSON lines
milu models list / pull / importFinds, downloads, or converts pretrained models
milu models infoShows what a model package contains
milu convertRewrites weights as burnpack or SafeTensors

Model packages are written to out_models/, and test, inference, and embedding results to milu_results/. See Fine-tuning for training options.