Nishant1600/qwen3-1_7b-scl-extractor
0172
Qwen3-1.7B SCL Extractor
Fine-tuned [Qwen/Qwen3-1.7B](https://huggingface.co/Qwen/Qwen3-1.7B) (QLoRA, 4-bit NF4, merged to bf16) that extracts structured safety facts from industrial incident narratives as strict JSON.
Trained on ~30k OSHA severe-injury reports (2015–2025).
Output format
The model outputs only a single JSON object:
{
"energy": {
"energy_type": "gravity",
"magnitude": 8.0,
"unit": "feet",
"evidence": "fell approximately 8 feet"
},
"injury": {
"injury_degree": "serious",
"evidence": "fracturing his elbow"
}
}energy_type∈ {gravity, motionvehicle, electrical, pressure, thermal, chemical, other, notstated}injury_degree∈ {fatal, serious, minor, none, not_stated}evidencefields are verbatim substrings of the input narrative.- The model never outputs a safety classification —
high_energyis decided in code by comparing magnitude/unit against thresholds.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("Nishant1600/qwen3-1_7b-scl-extractor")
model = AutoModelForCausalLM.from_pretrained(
"Nishant1600/qwen3-1_7b-scl-extractor",
torch_dtype="auto", device_map="auto",
)
prompt = (
"<|im_start|>system\n"
"You are a workplace safety fact extractor... output ONLY a single JSON object.\n"
"<|im_end|>\n"
"<|im_start|>user\nNarrative:\n<your narrative here><|im_end|>\n"
"<|im_start|>assistant\n<think>\n\n</think>\n\n" # no-think switch
)
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=256, do_sample=False,
pad_token_id=tok.eos_token_id)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))Notes:
- Use greedy decoding (
do_sample=False,temperature=0) for deterministic extractions. - The empty
<think>block after<|im_start|>assistant\ndisables Qwen3 reasoning mode.
Limitations
- Injury labels skew toward
seriousbecause the OSHA severe-injury dataset contains severe cases only. - English narratives only; trained on US oil/gas/industrial report style.
Intended use
Backend extractor for the SIH26165 safety-compliance pipeline. Not a substitute for professional safety judgment.
