Text Generation
Transformers
Safetensors
English
qwen2
pharmacovigilance
meddra
healthcare
drug-safety
adverse-drug-reactions
clinical-nlp
e2b-r3
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use thesumith/opensafety-1.5b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thesumith/opensafety-1.5b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="thesumith/opensafety-1.5b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("thesumith/opensafety-1.5b") model = AutoModelForCausalLM.from_pretrained("thesumith/opensafety-1.5b", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use thesumith/opensafety-1.5b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thesumith/opensafety-1.5b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thesumith/opensafety-1.5b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/thesumith/opensafety-1.5b
- SGLang
How to use thesumith/opensafety-1.5b 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 "thesumith/opensafety-1.5b" \ --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": "thesumith/opensafety-1.5b", "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 "thesumith/opensafety-1.5b" \ --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": "thesumith/opensafety-1.5b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use thesumith/opensafety-1.5b with Docker Model Runner:
docker model run hf.co/thesumith/opensafety-1.5b
馃┖ OpenSafety-1.5B: Clinical Pharmacovigilance & MedDRA Coding Foundation Model
OpenSafety-1.5B is a specialized clinical language model trained for end-to-end Pharmacovigilance (PV). It extracts suspect drugs, identifies Adverse Drug Reactions (ADRs) from unstructured clinical text, maps symptoms to MedDRA v28.0 Preferred Terms (PT) and System Organ Classes (SOC), and performs regulatory Listedness (Expectedness) Assessment against Reference Safety Information (RSI).
This model powers the official opensafety Python package.
Model Details
- Developed by: OpenSafety Team (thesumith)
- Model Type: Causal Language Model (Fine-tuned Transformer)
- Parameters: 1.5 Billion
- Language: English
- License: Apache 2.0
- Supported Standards: MedDRA v28.0, ICH E2B(R3)
- Python Library:
opensafetyon PyPI
Key Capabilities
- Suspect Drug Identification: Identifies the primary suspect drug and dosage regimen from complex clinical narratives.
- Adverse Event (AE) Extraction: Extracts raw patient verbatim descriptions.
- MedDRA v28.0 Semantic Coding: Automatically maps patient language to official MedDRA Lowest Level Terms (LLT), Preferred Terms (PT), and Primary System Organ Classes (SOC).
- Regulatory Listedness Assessment: Cross-references reported events against drug package inserts (FDA USPI, SmPC Section 4.8) to categorize events as
LISTEDorUNLISTEDwith regulatory audit justifications.
How to Use
Method 1: Using the Official opensafety Python Library (Recommended)
pip install opensafety
- Downloads last month
- 112
Model tree for thesumith/opensafety-1.5b
Unable to build the model tree, the base model loops to the model itself. Learn more.