Instructions to use cobra9786/engineering-log-triage-qwen-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use cobra9786/engineering-log-triage-qwen-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct") model = PeftModel.from_pretrained(base_model, "cobra9786/engineering-log-triage-qwen-lora") - Transformers
How to use cobra9786/engineering-log-triage-qwen-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cobra9786/engineering-log-triage-qwen-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("cobra9786/engineering-log-triage-qwen-lora", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cobra9786/engineering-log-triage-qwen-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cobra9786/engineering-log-triage-qwen-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cobra9786/engineering-log-triage-qwen-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cobra9786/engineering-log-triage-qwen-lora
- SGLang
How to use cobra9786/engineering-log-triage-qwen-lora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "cobra9786/engineering-log-triage-qwen-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cobra9786/engineering-log-triage-qwen-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "cobra9786/engineering-log-triage-qwen-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cobra9786/engineering-log-triage-qwen-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cobra9786/engineering-log-triage-qwen-lora with Docker Model Runner:
docker model run hf.co/cobra9786/engineering-log-triage-qwen-lora
LoRA-Adapted Engineering Log Triage Service — Model Card v1
Summary
This project adapts an open-weight instruction model for structured classification of engineering and sensor fault reports.
The model takes an unstructured engineering report and returns a strict JSON object matching the project schema:
categoryseveritysubsystemsymptomssuspected_causerecommended_actionrequires_human_review
The goal is not to claim production-grade triage accuracy from a small dataset. The goal is to demonstrate a reproducible foundation-model adaptation workflow:
- curated dataset creation;
- train/validation/test split discipline;
- prompt-only baseline evaluation;
- QLoRA adapter training;
- strict JSON/schema validation;
- held-out evaluation;
- preparation for API deployment.
Base Model
- Base model:
Qwen/Qwen2.5-1.5B-Instruct - Loading mode: 4-bit NF4 quantization with double quantization
- Runtime stack:
- PyTorch
- Transformers
- Datasets
- PEFT/LoRA
- TRL
SFTTrainer - bitsandbytes
The base model is loaded locally and adapted with LoRA adapters rather than full-parameter fine-tuning.
Dataset
Dataset type: synthetic/sanitized engineering-log examples.
Current dataset version: 0.3.0
Split policy: lora_v1
| Split | Records |
|---|---|
| Train | 48 |
| Validation | 7 |
| Test | 3 |
| Total | 58 |
The dataset includes fault reports across these categories:
sensor_or_signal_pathcommunicationspower_or_batteryfirmware_or_softwarecalibration_or_configurationmechanical_or_environmentaldata_pipeline_or_apiunknown
The validation set was used to select the adapter candidate. The test split was held out until after adapter selection.
Output Schema
The model is evaluated against strict JSON output requirements. A response is considered strictly valid only when:
- the response is raw JSON;
- the first character is
{; - the final character is
}; - there are no Markdown fences;
- the JSON validates against the
TriageResultschema; - enum values match the allowed schema values.
The evaluator also records a recovered JSON validity metric for Markdown-fenced JSON, but strict JSON validity is the preferred API-readiness metric.
Prompt-Only Baseline
The prompt-only baseline used the base Qwen model with the same task prompt and greedy decoding.
On the active 7-record validation split:
| Metric | Qwen Prompt Baseline |
|---|---|
| Strict JSON/schema validity | 0.0000 |
| Recovered JSON/schema validity | 0.8571 |
| Markdown fence recovery used | 0.8571 |
| Category accuracy | 0.4286 |
| Severity accuracy | 0.2857 |
| Requires-human-review accuracy | 0.8571 |
| All measured fields correct | 0.1429 |
| Mean latency seconds | 2.0247 |
The baseline frequently produced Markdown-fenced JSON. That was recoverable for evaluation, but not ideal for an API boundary.
Selected LoRA Adapter
Selected adapter run:
qwen_lora_r8_train48_steps72_v1
Training setup:
| Setting | Value |
|---|---|
| LoRA rank | 8 |
| LoRA alpha | 16 |
| LoRA dropout | 0.05 |
| Training records | 48 |
| Max steps | 72 |
| Batch size per device | 1 |
| Gradient accumulation | 2 |
| Max sequence length | 1024 |
| Precision flags | fp16=False, bf16=False |
| Output overwrite policy | training output directories are protected from accidental overwrite |
LoRA target modules:
q_projk_projv_projo_projgate_projup_projdown_proj
Adapter weights are local training artifacts and are not committed to Git. Evaluation reports are committed separately under artifacts/evaluation/.
Validation Results
Validation split: 7 examples.
| Metric | Qwen Baseline | LoRA Adapter |
|---|---|---|
| Strict JSON/schema validity | 0.0000 | 1.0000 |
| Recovered JSON/schema validity | 0.8571 | 1.0000 |
| Markdown fence recovery used | 0.8571 | 0.0000 |
| Category accuracy | 0.4286 | 1.0000 |
| Severity accuracy | 0.2857 | 0.7143 |
| Requires-human-review accuracy | 0.8571 | 1.0000 |
| All measured fields correct | 0.1429 | 0.7143 |
| Mean latency seconds | 2.0247 | 3.1859 |
The selected adapter significantly improved strict JSON compliance and validation classification quality over the prompt-only baseline.
Held-Out Test Results
Test split: 3 examples.
| Metric | LoRA Adapter |
|---|---|
| Strict JSON/schema validity | 1.0000 |
| Recovered JSON/schema validity | 1.0000 |
| Markdown fence recovery used | 0.0000 |
| Category accuracy | 0.6667 |
| Severity accuracy | 0.3333 |
| Requires-human-review accuracy | 0.6667 |
| All measured fields correct | 0.3333 |
| Mean latency seconds | 3.0377 |
The held-out test result shows that the adapter learned the structured output contract reliably. Semantic classification, especially severity and human-review policy, still needs a larger and more diverse dataset.
Because the test split contains only 3 examples, each incorrect field changes the metric by 33.3 percentage points. These test metrics should be treated as directional evidence, not production accuracy estimates.
Interpretation
The strongest result is strict JSON/schema compliance.
The LoRA adapter moved from a prompt-only baseline that usually required Markdown-fence recovery to a selected adapter that produced raw schema-valid JSON on both validation and test splits.
The adapter also improved validation category accuracy and complete measured-field correctness. However, held-out semantic generalization remains limited by dataset size.
A fair project claim is:
Built a reproducible Hugging Face QLoRA training and evaluation pipeline that improved strict JSON compliance and validation triage accuracy over a prompt-only Qwen baseline on a compact engineering-log dataset.
A fair limitation is:
The current dataset is too small for production accuracy claims. Additional examples are needed, especially for severity calibration, human-review policy, water-ingress cases, ambiguous low-evidence reports, and configuration-versus-software distinctions.
Known Limitations
- The dataset is compact and synthetic/sanitized.
- The held-out test split has only 3 examples.
- Severity accuracy remains weak on held-out test.
- The model is not production-ready.
- Adapter weights are not currently published to Hugging Face Hub.
- No FastAPI inference service is included yet.
- No Docker deployment image is included yet.
- No constrained decoding or JSON repair layer is implemented yet.
Recommended Next Improvements
Expand the dataset to at least:
- 80 to 120 training examples;
- 12 to 20 validation examples;
- 12 to 20 held-out test examples.
Add more hard examples for:
- critical water ingress;
- battery compartment moisture;
- ambiguous low-evidence warnings;
- configuration/profile/table mismatch;
- signal-path faults caused by cable movement;
- communications versus sensor-link distinction.
Add a FastAPI inference service:
POST /triage;- typed request/response schemas;
- load base model and LoRA adapter once at startup;
- validate every response before returning it.
Add Docker-based local deployment.
Publish the dataset and adapter to Hugging Face Hub once the project boundary is stable.
Project Status
Current status: adapter training and evaluation pipeline complete.
Next engineering milestone: FastAPI inference service with typed request/response validation.
- Downloads last month
- 23