Views
No views yet
1{
2 "energy": {
3 "energy_type": "gravity",
4 "magnitude": 8.0,
5 "unit": "feet",
6 "evidence": "fell approximately 8 feet"
7 },
8 "injury": {
9 "injury_degree": "serious",
10 "evidence": "fracturing his elbow"
11 }
12}energy_type ∈ {gravity, motion_vehicle, electrical, pressure, thermal, chemical, other, not_stated}injury_degree ∈ {fatal, serious, minor, none, not_stated}evidence fields are verbatim substrings of the input narrative.high_energy is decided in code by comparing magnitude/unit against thresholds.1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3tok = AutoTokenizer.from_pretrained("Nishant1600/qwen3-1_7b-scl-extractor")
4model = AutoModelForCausalLM.from_pretrained(
5 "Nishant1600/qwen3-1_7b-scl-extractor",
6 torch_dtype="auto", device_map="auto",
7)
8
9prompt = (
10 "<|im_start|>system\n"
11 "You are a workplace safety fact extractor... output ONLY a single JSON object.\n"
12 "<|im_end|>\n"
13 "<|im_start|>user\nNarrative:\n<your narrative here><|im_end|>\n"
14 "<|im_start|>assistant\n<think>\n\n</think>\n\n" # no-think switch
15)
16inputs = tok(prompt, return_tensors="pt").to(model.device)
17out = model.generate(**inputs, max_new_tokens=256, do_sample=False,
18 pad_token_id=tok.eos_token_id)
19print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))do_sample=False, temperature=0) for deterministic extractions.<think> block after <|im_start|>assistant\n disables Qwen3 reasoning mode.serious because the OSHA severe-injury dataset contains severe cases only.