Deployment
This section covers exporting trained models and using them in production.
Overview
Once you’ve trained a successful pipeline, NIRS4ALL makes it easy to deploy to production or share with collaborators.
📦 Export Bundles
Package trained pipelines as standalone .n4a bundles.
🔄 Model Reuse
Load and use exported models for new predictions.
🔧 Transfer Learning
Adapt models to new instruments or sample types.
Deployment Workflow
graph LR
A[Train Pipeline] --> B[Evaluate]
B --> C{Good?}
C -->|Yes| D[Export .n4a]
C -->|No| A
D --> E[Production Use]
D --> F[Share/Collaborate]
Quick Example
Export a Model
import nirs4all
# Train and get results
result = nirs4all.run(pipeline, dataset="data/")
# Export the best model
result.export("exports/best_model.n4a")
Use an Exported Model
import nirs4all
# Load and predict
predictions = nirs4all.predict(
bundle="exports/best_model.n4a",
data="new_samples/"
)
Bundle Contents
A .n4a bundle contains:
Trained model weights
Preprocessing transformers (fitted)
Pipeline configuration
Metadata (training date, metrics, etc.)
See Also
Workspace CLI Commands - CLI commands for bundle management
Workspace Architecture - Workspace and artifact structure