CAB-Fusion Predictive Maintenance Engine β€” Phase 1 & 2 Artifacts

Repository Structure

β”œβ”€β”€ qlora_adapter/ ← LLM Fine-Tuned Weights β”‚ β”œβ”€β”€ adapter_model.safetensors ─ Load with PeftModel.from_pretrained(base_model, "qlora_adapter") β”‚ β”œβ”€β”€ adapter_config.json β”‚ β”œβ”€β”€ tokenizer.json β”‚ └── tokenizer_config.json β”‚ β”œβ”€β”€ maintenance_faiss.index ─ FAISS vector index (256-d embeddings) β”‚ Load: faiss.read_index("maintenance_faiss.index") β”‚ β”œβ”€β”€ maintenance_metadata.parquet ─ Metadata lookup table β”‚ Columns: incident_id, maintenance_log, degradation_score, rul_label, cls_label β”‚ Load: pd.read_parquet("maintenance_metadata.parquet") β”‚ └── phase1_model/ ─ Phase 1 embedding generator β”œβ”€β”€ cab_fusion_model.pt ─ PyTorch state_dict (CAB-Fusion network) β”‚ Load: model.load_state_dict(torch.load("cab_fusion_model.pt", map_location=device)) └── sensor_scaler.pkl ─ MinMaxScaler fitted on CMAPSS sensor channels Load: joblib.load("sensor_scaler.pkl")

Frontend Integration

Step 1: Generate Embedding from Live Data

import torch, joblib, numpy as np
from your_model_module import CABFusionMultimodalNetwork

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

# Load model
model = CABFusionMultimodalNetwork(...)
model.load_state_dict(torch.load('phase1_model/cab_fusion_model.pt', map_location=device))
model.to(device).eval()

# Load scaler
scaler = joblib.load('phase1_model/sensor_scaler.pkl')

# Normalize sensor data and run inference
# sensor_window shape: [1, 50, 21]  (raw values)
sensor_scaled = scaler.transform(sensor_window.reshape(-1, 21)).reshape(1, 50, 21)
image_tensor = ...  # preprocessed image [1, 3, 224, 224]

with torch.no_grad():
    _, _, fused_embedding, _ = model(image_tensor.to(device), torch.tensor(sensor_scaled).to(device))
# fused_embedding shape: [1, 256]  ← this is your query vector
Step 2: Retrieve Similar Incidents
import faiss, pandas as pd

index = faiss.read_index('maintenance_faiss.index')
metadata = pd.read_parquet('maintenance_metadata.parquet')

query = fused_embedding.cpu().numpy()
query = query / np.linalg.norm(query)
distances, indices = index.search(query.astype(np.float32), k=3)

for idx in indices[0]:
    print(metadata.iloc[idx]['maintenance_log'])
Step 3: Generate Audit Report
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base_model = AutoModelForCausalLM.from_pretrained(
    'meta-llama/Meta-Llama-3-8B-Instruct',
    device_map='auto',
    token=HF_TOKEN,
)
model = PeftModel.from_pretrained(base_model, 'qlora_adapter')
tokenizer = AutoTokenizer.from_pretrained('qlora_adapter')

# Format prompt with retrieved logs + severity
prompt = tokenizer.apply_chat_template(messages, tokenize=False)
inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.2)
report = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
File Sizes
File
phase1_model/cab_fusion_model.pt
qlora_adapter/ (all files)
maintenance_faiss.index
maintenance_metadata.parquet
phase1_model/sensor_scaler.pkl
Notes
- All vectors are L2-normalized. Use Inner Product (cosine similarity) for FAISS search.
- The FAISS index contains real embeddings from paired CMAPSS+MVTec data.
- Maintenance logs are derived from actual sensor threshold breaches.
- Training was done with approximate visual pairing (Phase 1 proof-of-concept).
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support