Instructions to use towardsinnovationlab/qwen3-medical with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use towardsinnovationlab/qwen3-medical with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3-0.6B") model = PeftModel.from_pretrained(base_model, "towardsinnovationlab/qwen3-medical") - Transformers
How to use towardsinnovationlab/qwen3-medical with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="towardsinnovationlab/qwen3-medical") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("towardsinnovationlab/qwen3-medical", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use towardsinnovationlab/qwen3-medical with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "towardsinnovationlab/qwen3-medical" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "towardsinnovationlab/qwen3-medical", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/towardsinnovationlab/qwen3-medical
- SGLang
How to use towardsinnovationlab/qwen3-medical 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 "towardsinnovationlab/qwen3-medical" \ --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": "towardsinnovationlab/qwen3-medical", "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 "towardsinnovationlab/qwen3-medical" \ --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": "towardsinnovationlab/qwen3-medical", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use towardsinnovationlab/qwen3-medical with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for towardsinnovationlab/qwen3-medical to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for towardsinnovationlab/qwen3-medical to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for towardsinnovationlab/qwen3-medical to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="towardsinnovationlab/qwen3-medical", max_seq_length=2048, ) - Docker Model Runner
How to use towardsinnovationlab/qwen3-medical with Docker Model Runner:
docker model run hf.co/towardsinnovationlab/qwen3-medical
Model Adapter Description
This is a LoRA adapter for Qwen/Qwen3-0.6B, trained using the Unsloth library for parameter-efficient fine-tuning (PEFT). When loaded via the transformers pipeline or PeftModel, the base model Qwen/Qwen3-0.6B is automatically fetched, and the adapter is applied on top.
The adapter was trained on the following dataset:
-OpenMed/Medical-Reasoning-SFT-GPT-OSS-120B - for enhancing medical reasoning skills
Model Adapter Details
- Developed by: Claudio Giorgio Giancaterino
- Language(s) (NLP): English
- License: Apache 2.0
Uses
Direct Use
This adapter can be used as support in healthcare applications, medical research, and clinical text generation.
Downstream Use
It can be integrated into educational chatbots for medical reasoning conversations.
Out-of-Scope Use
It is not suitable for high-level decision-making.
Bias, Risks, and Limitations
Conversational quality may degrade with complex or multi-turn inputs. The adapter may give inaccurate answers and should be referred to a professional.
How to Get Started with the Model Adapter
Use the code below to get started with the adapter.
-Using the pipeline:
# Use a pipeline as a high-level helper
from transformers import pipeline
import re
pipe = pipeline("text-generation", model="towardsinnovationlab/qwen3-medical")
messages = [
{"role": "user", "content": "What are the main symptoms of heart disease? Please provide your answer in bullet points."},
]
result = pipe(messages)
# Extract only the assistant's response
assistant_response = result[0]['generated_text'][-1]['content']
# Remove the <think> tags and their content
clean_response = re.sub(r'<think>.*?</think>', '', assistant_response, flags=re.DOTALL).strip()
print(clean_response)
-Loading the model:
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
import re
tokenizer = AutoTokenizer.from_pretrained("towardsinnovationlab/qwen3-medical")
model = AutoModelForCausalLM.from_pretrained("towardsinnovationlab/qwen3-medical")
messages = [
{"role": "user", "content": "What are the main symptoms of heart disease? Please provide your answer in bullet points."},
]
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=512,
temperature=0.7,
top_p=0.8,
top_k=20,
do_sample=True
)
# Extract assistant's response
assistant_response = tokenizer.decode(
outputs[0][inputs["input_ids"].shape[-1]:],
skip_special_tokens=True
)
# Remove <think> tags and their content
clean_response = re.sub(r'<think>.*?</think>', '', assistant_response, flags=re.DOTALL).strip()
print(clean_response)
Training Details
Training Data
-OpenMed/Medical-Reasoning-SFT-GPT-OSS-120B with 200,193 synthetic medical conversations.
Training Procedure
-Colab with NVIDIA A100 GPU
-per_device_train_batch_size = 4,
-gradient_accumulation_steps = 8,
-warmup_steps = 5,
-max_steps = 30,
-learning_rate = 2e-5,
-logging_steps = 100,
-save_steps=500,
-optim = "adamw_8bit",
-weight_decay = 0.001,
-lr_scheduler_type = "linear"
Results
Loss Value >> 1.4693
Framework versions
- PEFT 0.18.0
- Downloads last month
- 4