Instructions to use andreasmartin/apertus-1.5-8b-biomedical-ade with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use andreasmartin/apertus-1.5-8b-biomedical-ade with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="andreasmartin/apertus-1.5-8b-biomedical-ade") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("andreasmartin/apertus-1.5-8b-biomedical-ade") model = AutoModelForCausalLM.from_pretrained("andreasmartin/apertus-1.5-8b-biomedical-ade", 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 andreasmartin/apertus-1.5-8b-biomedical-ade with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "andreasmartin/apertus-1.5-8b-biomedical-ade" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "andreasmartin/apertus-1.5-8b-biomedical-ade", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/andreasmartin/apertus-1.5-8b-biomedical-ade
- SGLang
How to use andreasmartin/apertus-1.5-8b-biomedical-ade 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 "andreasmartin/apertus-1.5-8b-biomedical-ade" \ --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": "andreasmartin/apertus-1.5-8b-biomedical-ade", "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 "andreasmartin/apertus-1.5-8b-biomedical-ade" \ --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": "andreasmartin/apertus-1.5-8b-biomedical-ade", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use andreasmartin/apertus-1.5-8b-biomedical-ade with Docker Model Runner:
docker model run hf.co/andreasmartin/apertus-1.5-8b-biomedical-ade
Apertus 1.5 8B — Standalone Merged Model (BIOMEDICAL_ADE)
⚠️ CRITICAL DISCLAIMER: HIGHLY EXPERIMENTAL RESEARCH MODEL
This model is a proof-of-concept research artifact developed exclusively for academic experimentation, demonstration, and benchmarking purposes.
- NOT FOR CLINICAL USE: This system is NOT a certified medical device and must NEVER be used to provide medical advice, diagnosis, triage, or clinical decision support.
- INCORRECT OR INCOMPLETE OUTPUT: The outputs may omit severe drug reactions or state side effects that do not exist. Always rely on certified clinical pharmacologists and authorized medical references.
- The authors and contributors assume no liability for any direct or indirect damages resulting from the use or misuse of this model.
Fine-tuned from andreasmartin/apertus-v1.5-8b-text on mihirhirave/entity_extraction_ade_v2_with_validation.
This repository contains the complete, standalone unquantized 16-bit merged model (merged_16bit), fully ready for conversion to GGUF (via GGUF My Repo or llama.cpp) and direct serving via vLLM.
Example Prompts & Expected Outputs
Example 1: Multi-Drug Toxicity Detection
Prompt:
You are an expert biomedical information extraction system. Extract all mentioned drugs and adverse drug events (ADEs) from the clinical narrative as JSON.
Clinical Narrative:
"A 64-year-old female patient with chronic atrial fibrillation presented with severe bradycardia, visual yellow halos, and nausea after increasing her digoxin dosage to 0.25 mg daily. Electrocardiogram confirmed digitalis toxicity. Concurrently, she had been prescribed amiodarone two weeks earlier."
Model Output:
{
"drugs": ["digoxin", "amiodarone"],
"adverse_drug_events": ["severe bradycardia", "visual yellow halos", "nausea"]
}
Example 2: Negative Control (No Adverse Effects)
Prompt:
You are an expert biomedical information extraction system. Extract all mentioned drugs and adverse drug events (ADEs) from the clinical narrative as JSON.
Clinical Narrative:
"The patient was initiated on metformin 500 mg twice daily for type 2 diabetes mellitus and reported good glycemic control without any adverse symptoms."
Model Output:
{
"drugs": ["metformin"],
"adverse_drug_events": []
}
Quickstart (vLLM / Transformers / Ollama)
Direct Ingestion with vLLM
vllm serve andreasmartin/apertus-1.5-8b-biomedical-ade --tensor-parallel-size 1 --gpu-memory-utilization 0.9
Direct Python Ingestion
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("andreasmartin/apertus-1.5-8b-biomedical-ade")
model = AutoModelForCausalLM.from_pretrained("andreasmartin/apertus-1.5-8b-biomedical-ade", device_map="auto")
Training Configuration & Metrics
| Parameter | Value |
|---|---|
| Base Model | andreasmartin/apertus-v1.5-8b-text |
| Dataset | mihirhirave/entity_extraction_ade_v2_with_validation |
| Dataset Slice | train[:600] (Train) / validation[:100] (Validation) |
| Optimizer Steps | 60 |
| Effective Batch Size | 4 (Per-device batch size 2 x Gradient Accumulation 2) |
| Learning Rate | 0.0002 (Cosine decay schedule) |
| Merge Method | merged_16bit (Standalone 16-bit Safetensors) |
| Final Training Loss | nan |
- Downloads last month
- 647