Text Generation
Transformers
Safetensors
PEFT
English
medical
llm
qwen3
thinking-model
entity-extraction
relation-extraction
lora
conversational
Instructions to use xingqiang/Medical-NER-Qwen-4B-Thinking-plus with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xingqiang/Medical-NER-Qwen-4B-Thinking-plus with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="xingqiang/Medical-NER-Qwen-4B-Thinking-plus") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("xingqiang/Medical-NER-Qwen-4B-Thinking-plus", dtype="auto") - PEFT
How to use xingqiang/Medical-NER-Qwen-4B-Thinking-plus with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use xingqiang/Medical-NER-Qwen-4B-Thinking-plus with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xingqiang/Medical-NER-Qwen-4B-Thinking-plus" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xingqiang/Medical-NER-Qwen-4B-Thinking-plus", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/xingqiang/Medical-NER-Qwen-4B-Thinking-plus
- SGLang
How to use xingqiang/Medical-NER-Qwen-4B-Thinking-plus 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 "xingqiang/Medical-NER-Qwen-4B-Thinking-plus" \ --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": "xingqiang/Medical-NER-Qwen-4B-Thinking-plus", "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 "xingqiang/Medical-NER-Qwen-4B-Thinking-plus" \ --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": "xingqiang/Medical-NER-Qwen-4B-Thinking-plus", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use xingqiang/Medical-NER-Qwen-4B-Thinking-plus with Docker Model Runner:
docker model run hf.co/xingqiang/Medical-NER-Qwen-4B-Thinking-plus
Medical-NER-Qwen-4B-Thinking
Model Description
This is a fine-tuned medical LLM based on Qwen3-4B-Thinking, specialized for medical entity and relationship extraction.
Model Details
- Base Model: unsloth/Qwen3-4B-Thinking-2507
- Fine-tuning Method: LoRA (Low-Rank Adaptation)
- Domain: Medical Literature Analysis
- Tasks: Entity Recognition, Relationship Extraction
- Language: English
Performance Metrics
| Metric | Entity Extraction | Relationship Extraction |
|---|---|---|
| Precision | 0.000 | 0.000 |
| Recall | 0.000 | 0.000 |
| F1-Score | 0.000 | 0.000 |
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-3B-Thinking",
torch_dtype="auto",
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "xingqiang/Medical-NER-Qwen-4B-Thinking-plus")
tokenizer = AutoTokenizer.from_pretrained("xingqiang/Medical-NER-Qwen-4B-Thinking-plus")
# Generate medical analysis
text = "Hepatitis C virus causes chronic liver infection."
messages = [
{"role": "user", "content": f"Extract medical entities and relationships from: {text}"}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(result)
Model tree for xingqiang/Medical-NER-Qwen-4B-Thinking-plus
Base model
Qwen/Qwen3-4B-Thinking-2507 Finetuned
unsloth/Qwen3-4B-Thinking-2507