Text Generation
Transformers
Safetensors
qwen3
lora
qlora
fine-tuned
workplace-safety
information-extraction
conversational
text-generation-inference
Instructions to use Nishant1600/qwen3-1_7b-scl-extractor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nishant1600/qwen3-1_7b-scl-extractor with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nishant1600/qwen3-1_7b-scl-extractor") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Nishant1600/qwen3-1_7b-scl-extractor") model = AutoModelForCausalLM.from_pretrained("Nishant1600/qwen3-1_7b-scl-extractor", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Nishant1600/qwen3-1_7b-scl-extractor with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nishant1600/qwen3-1_7b-scl-extractor" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nishant1600/qwen3-1_7b-scl-extractor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Nishant1600/qwen3-1_7b-scl-extractor
- SGLang
How to use Nishant1600/qwen3-1_7b-scl-extractor 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 "Nishant1600/qwen3-1_7b-scl-extractor" \ --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": "Nishant1600/qwen3-1_7b-scl-extractor", "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 "Nishant1600/qwen3-1_7b-scl-extractor" \ --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": "Nishant1600/qwen3-1_7b-scl-extractor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Nishant1600/qwen3-1_7b-scl-extractor with Docker Model Runner:
docker model run hf.co/Nishant1600/qwen3-1_7b-scl-extractor
Qwen3-1.7B SCL Extractor
Fine-tuned 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, motion_vehicle, electrical, pressure, thermal, chemical, other, not_stated}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.
- Downloads last month
- 360