YAML Metadata Warning:The pipeline tag "time-series-classification" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
MachiningFM 2.0 β Physics-Guided Foundation Model for Machining
A pretrained foundation model for CNC machining sensor data, extended with a classical physics calibration layer for downstream tasks.
Architecture
Raw Machining Signal (force, vibration, AE, NC program, ...)
β
βΌ
MachiningFMV2 (CausalFusionTransformer, d_model=384)
β
βΌ
Latent Embedding
β
βΌ
Downstream Head (Ridge / MLP)
β
βΌ
Raw Prediction
β
βββ Taylor Tool-Life (r_T = t / T_Taylor)
βββ Kienzle Force (F_measured / F_Kienzle)
βββ Cutting Energy (E_c = β« F_c Β· V_c Β· dt)
β
βΌ
Physics Calibration (y_final = y_FM + Ξ± Β· g(physics))
β
βΌ
Final Prediction
Model Config (pretrained/machiningfm_v2_base.pt)
| Parameter | Value |
|---|---|
| d_model | 384 |
| fusion_layers | 6 |
| num_heads | 8 |
| dropout | 0.1 |
| forecast_horizons | [64, 1280, 12800] |
| output_channels | 3 |
| trained steps | 5,432 |
| training loss | -1.94 |
Supported Input Modalities
| Modality | Description |
|---|---|
raw_waveform |
High-rate sensor signals (force, vibration, AE) |
spectral |
FFT / STFT / CWT spectral features |
cnc |
CNC SEFC (Servo Error / Feed / Current) data |
nc_tokens |
NC program token sequences |
image |
Tool wear images |
metadata_vector |
Machining condition scalars |
Files
MachiningFM2.0/
βββ pretrained/
β βββ machiningfm_v2_base.pt # 170MB β primary pretrained checkpoint
βββ configs/
β βββ model/base.yaml # Model architecture config
β βββ physics/default.yaml # Generic steel/carbide parameters
β βββ physics/ti6al4v_carbide.yaml # Ti-6Al-4V parameters
βββ README.md
Note: The large v1 pretraining checkpoint (7.4GB) is not included due to file size constraints. The v2 base checkpoint above was initialized from it and fine-tuned with the v2 architecture.
Usage
git clone https://github.com/junseokShim/MachiningFM.git
cd MachiningFM
pip install -e .
Download this checkpoint:
from huggingface_hub import hf_hub_download
ckpt_path = hf_hub_download(
repo_id="Junseok2/MachiningFM2.0",
filename="pretrained/machiningfm_v2_base.pt",
)
Load and encode:
import torch
from machiningfm.models.backbone import MachiningFMBackbone
backbone = MachiningFMBackbone(
checkpoint_path=ckpt_path,
backbone_mode="frozen", # frozen | linear_probe | partial_finetune | full_finetune
)
batch = {"raw_waveform": torch.randn(1, 4096, 3)}
encoded = backbone.encode(batch)
embedding = encoded["embedding"] # shape: (1, 384)
Tool wear regression with physics calibration:
from machiningfm.tasks.tool_wear import ToolWearRegressor
from machiningfm.physics.calibration import PhysicsCalibrator, PhysicsFeatures
from machiningfm.physics.taylor import TaylorParams, compute_tool_life_ratio
# Extract embeddings from backbone (offline)
# X_train, X_val, X_test: (N, 384) numpy arrays
# y_train, y_val, y_test: (N,) VB wear in mm
# Build physics features
params = TaylorParams(C=200.0, n=0.25)
pf = [
PhysicsFeatures(tool_life_ratio=compute_tool_life_ratio(t, 250.0, 0.25, 0.125, params))
for t in elapsed_times
]
# Fit with physics calibration
cal = PhysicsCalibrator(method="ridge")
reg = ToolWearRegressor(feature_dim=384, calibrator=cal)
reg.fit(X_train, y_train, pf_train, X_val, y_val, pf_val)
preds = reg.predict(X_test, pf_test)
Downstream Tasks
| Task | Input | Output | Evaluation |
|---|---|---|---|
| A. Wear Regression | embedding | VB (mm) | MAE, RMSE, RΒ² |
| B. Stage Classification | embedding | healthy/moderate/severe | Acc, Macro F1 |
| C. RUL Prediction | embedding | remaining time (min) | MAE, RMSE, RΒ² |
| D. Dimensional Compensation | wear + condition | offset (mm) | physics-derived interface |
Wear Stage Thresholds (ISO 8688-1:1989)
- Healthy: VB < 0.1 mm
- Moderate: 0.1 β€ VB < 0.2 mm
- Severe: VB β₯ 0.2 mm
Physics Models
| Model | Status | Required Data |
|---|---|---|
| Taylor Tool-Life | Enabled | speed, feed, depth |
| Kienzle Force | Enabled | chip thickness, width |
| Cutting Energy | Enabled | force series, speed |
| Archard Wear | Disabled | F_N, L (not in standard datasets) |
| Usui Wear Rate | Disabled | cutting temperature (not in standard datasets) |
Physics parameters are stored in YAML configs (see configs/physics/).
All parameter sources are documented (literature / dataset_calibrated / manufacturer / user_defined).
Dataset
PHM Society Data Challenge 2010
- URL: https://www.phmsociety.org/competition/phm/10
- Sensor data: force (x/y/z), vibration (x/y/z), acoustic emission RMS
- Labels: flank wear VB (mm) per cut, per condition (real measurements)
- Citation: PHM Society (2010). PHM Data Challenge. Prognostics and Health Management Society.
Data Integrity Notes:
- PHM2010 does NOT contain dimensional accuracy measurements. Task D (dimensional compensation) outputs are physics-derived estimates, not experimental results.
- Archard/Usui models are disabled by default because PHM2010 lacks the required quantities.
- All splits use leave-one-condition-out to prevent temporal leakage.
Limitations
- Pretrained on proprietary CNC machining data β domain gap to new materials/machines is expected.
- PHM2010 benchmarks with synthetic data demonstrate code correctness, not production performance.
- Physics calibration provides marginal improvement on clean synthetic data; real benefit expected on noisy real-world data.
- Archard and Usui models require data not typically available in standard machining datasets.
- The 7.4GB v1 pretraining checkpoint is not included due to file size constraints.
Citation
If you use this model or framework, please cite:
@software{machiningfm2026,
author = {Shim, Junseok},
title = {MachiningFM: Physics-Guided Foundation Model for Machining},
year = {2026},
url = {https://github.com/junseokShim/MachiningFM}
}
Source Code
- GitHub: https://github.com/junseokShim/MachiningFM
- License: MIT