Instructions to use ssam17/phi3-industrial-anomaly with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use ssam17/phi3-industrial-anomaly with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf ssam17/phi3-industrial-anomaly:F16 # Run inference directly in the terminal: llama cli -hf ssam17/phi3-industrial-anomaly:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ssam17/phi3-industrial-anomaly:F16 # Run inference directly in the terminal: llama cli -hf ssam17/phi3-industrial-anomaly:F16
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf ssam17/phi3-industrial-anomaly:F16 # Run inference directly in the terminal: ./build/bin/llama cli -hf ssam17/phi3-industrial-anomaly:F16
Use Docker
docker model run hf.co/ssam17/phi3-industrial-anomaly:F16
- Llama new
- LM Studio
- Jan
- Ollama
How to use ssam17/phi3-industrial-anomaly with Ollama:
ollama run hf.co/ssam17/phi3-industrial-anomaly:F16
- Unsloth Desktop
- Docker Model Runner
How to use ssam17/phi3-industrial-anomaly with Docker Model Runner:
docker model run hf.co/ssam17/phi3-industrial-anomaly:F16
- Lemonade
How to use ssam17/phi3-industrial-anomaly with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ssam17/phi3-industrial-anomaly:F16
Run and chat with the model
lemonade run user.phi3-industrial-anomaly-F16
List all available models
lemonade list
- Atomic Chat
Download README.md from ssam17/phi3-industrial-anomaly: direct link, hf CLI and curl.
- Browser
- Download file 6.89 kB
-
https://huggingface.co/ssam17/phi3-industrial-anomaly/resolve/main/README.md
- Command line
-
hf download hf://ssam17/phi3-industrial-anomaly/README.md
-
curl -L -o README.md https://huggingface.co/ssam17/phi3-industrial-anomaly/resolve/main/README.md
language:
- en
license: mit
base_model: microsoft/Phi-3-mini-4k-instruct
tags:
- phi3
- qlora
- industrial
- anomaly-detection
- iot
- edge-ai
- fine-tuned
datasets:
- ssam17/Edge-Industrial-Anomaly-Phi3
model-index:
- name: Phi-3-Industrial-Anomaly
results:
- task:
type: text-generation
metrics:
- name: Eval Loss
type: loss
value: 2.3992
- name: Token Accuracy
type: accuracy
value: 0.5451
π Phi-3 Mini Fine-tuned for Industrial Anomaly Detection
Fine-tuned version of Microsoft's Phi-3-mini-4k-instruct using QLoRA (Quantized Low-Rank Adaptation) for industrial IoT anomaly detection and interpretable diagnostics.
π Model Description
This model specializes in analyzing industrial sensor data and network telemetry to detect anomalies, identify potential security threats, and provide actionable insights for industrial automation systems.
Key Features:
- π― Industrial anomaly classification
- π Security threat detection
- π Sensor data interpretation
- π¨ Real-time diagnostic recommendations
- π‘ Explainable AI responses
π§ Training Details
Base Model
- Architecture: Phi-3-mini-4k-instruct (3.8B parameters)
- Context Length: 4096 tokens
- Quantization: 4-bit NF4 with double quantization
Fine-tuning Configuration
- Method: QLoRA (Quantized Low-Rank Adaptation)
- LoRA Rank: 32
- LoRA Alpha: 64
- Target Modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Dropout: 0.05
Training Parameters
- Epochs: 5
- Batch Size: 4 per device
- Gradient Accumulation: 4 steps (effective batch size: 16)
- Learning Rate: 2e-5
- Optimizer: paged_adamw_8bit
- Scheduler: Cosine with warmup (100 steps)
- Mixed Precision: BF16
Dataset
- Name: Edge-Industrial-Anomaly-Phi3
- Training Samples: 10,749
- Evaluation Samples: 1,195
- Format: Conversational (user/assistant format)
π Evaluation Results
| Metric | Value |
|---|---|
| Eval Loss | 2.3992 |
| Token Accuracy | 54.51% |
| Eval Runtime | 81.12s |
| Samples/Second | 14.73 |
π Usage
Using Transformers (Recommended)
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(
"YOUR_USERNAME/phi3-industrial-anomaly",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
"YOUR_USERNAME/phi3-industrial-anomaly",
trust_remote_code=True
)
# Prepare input
prompt = """<|user|>
Sensor Readings: Temperature: 95Β°C, Vibration: 5.8 m/s, Pressure: 120 kPa, Flow Rate: 6.2 L/min
<|end|>
<|assistant|>"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Generate response
outputs = model.generate(
**inputs,
max_new_tokens=150,
temperature=0.7,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
Using PEFT (Load Adapters Only)
from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer
import torch
# Load model with LoRA adapters
model = AutoPeftModelForCausalLM.from_pretrained(
"YOUR_USERNAME/phi3-industrial-anomaly",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
"YOUR_USERNAME/phi3-industrial-anomaly",
trust_remote_code=True
)
Example Prompts
Network Security Analysis:
<|user|>
Network Telemetry: Arp.Opcode: 0.0, Icmp.Checksum: 0.0, Suspicious packet patterns detected
<|end|>
<|assistant|>
Sensor Diagnostics:
<|user|>
Sensor Readings: Temperature: 110Β°C, Vibration: 7.2 m/s, Pressure: 85 kPa, Flow Rate: 3.1 L/min
<|end|>
<|assistant|>
π― Use Cases
- Industrial IoT Monitoring: Real-time anomaly detection in manufacturing plants
- Predictive Maintenance: Early warning systems for equipment failure
- Security Operations: Network intrusion detection in OT/IT environments
- Edge Deployment: Lightweight inference on industrial gateways and edge devices
- Smart Manufacturing: Quality control and process optimization
π οΈ Edge Deployment
Model Formats Available
- PyTorch (this repo): Full model for transformers
- GGUF: For llama.cpp and edge devices (see releases)
- ONNX: For optimized inference (convert with Optimum)
Hardware Requirements
- GPU Inference: 8GB+ VRAM (with quantization)
- CPU Inference: 16GB+ RAM
- Edge Devices: Compatible with Jetson Nano, Raspberry Pi 5, Industrial PCs
π Performance Considerations
- Quantization: Model uses 4-bit quantization for efficient memory usage
- Inference Speed: ~14.7 samples/second on NVIDIA RTX GPUs
- Context Window: 4096 tokens (sufficient for detailed sensor logs)
- Generation: Typical response time 2-5 seconds on GPU
β οΈ Limitations
- Model may require domain-specific fine-tuning for your specific industrial environment
- Best performance with sensor data in the format seen during training
- Evaluation accuracy (54.51%) suggests room for improvement with more training epochs
- Not suitable for safety-critical decisions without human oversight
π Version History
- v1.0 (2026-01-06): Initial release
- 5 epochs of QLoRA fine-tuning
- LoRA rank 32, alpha 64
- Trained on Edge-Industrial-Anomaly-Phi3 dataset
π Citation
If you use this model, please cite:
@misc{phi3-industrial-anomaly-2026,
author = {Your Name},
title = {Phi-3 Mini Fine-tuned for Industrial Anomaly Detection},
year = {2026},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/YOUR_USERNAME/phi3-industrial-anomaly}}
}
π License
This model is released under the MIT License. The base Phi-3 model is subject to Microsoft's Phi-3 license.
π Acknowledgments
- Microsoft Research: For the Phi-3-mini-4k-instruct base model
- Hugging Face: For the transformers and PEFT libraries
- Dataset: ssam17/Edge-Industrial-Anomaly-Phi3
π Contact
For questions, issues, or collaboration opportunities, please open an issue in the repository or contact the model author.