Instructions to use Melody923/DeepSeek-R1-Medicalai-923 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Melody923/DeepSeek-R1-Medicalai-923 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Melody923/DeepSeek-R1-Medicalai-923") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Melody923/DeepSeek-R1-Medicalai-923") model = AutoModelForCausalLM.from_pretrained("Melody923/DeepSeek-R1-Medicalai-923") 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 Melody923/DeepSeek-R1-Medicalai-923 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Melody923/DeepSeek-R1-Medicalai-923" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Melody923/DeepSeek-R1-Medicalai-923", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Melody923/DeepSeek-R1-Medicalai-923
- SGLang
How to use Melody923/DeepSeek-R1-Medicalai-923 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 "Melody923/DeepSeek-R1-Medicalai-923" \ --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": "Melody923/DeepSeek-R1-Medicalai-923", "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 "Melody923/DeepSeek-R1-Medicalai-923" \ --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": "Melody923/DeepSeek-R1-Medicalai-923", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use Melody923/DeepSeek-R1-Medicalai-923 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 Melody923/DeepSeek-R1-Medicalai-923 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 Melody923/DeepSeek-R1-Medicalai-923 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Melody923/DeepSeek-R1-Medicalai-923 to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Melody923/DeepSeek-R1-Medicalai-923", max_seq_length=2048, ) - Docker Model Runner
How to use Melody923/DeepSeek-R1-Medicalai-923 with Docker Model Runner:
docker model run hf.co/Melody923/DeepSeek-R1-Medicalai-923
Model Card for Model ID
Medical reasoning llm
Model Details
Model Description
- Developed by: Melody Zhao
- Model type: LLM
- Language(s) (NLP): English
- License: Mit
- Finetuned from model [optional]: unsloth/DeepSeek-R1-Distill-Llama-8B
How to Get Started with the Model
question = """A patient with acute appendicitis has been
ill for 5 days, with slightly relieved abdominal pain
but still feverish.
A tender mass was found in the lower right abdomen
during a physical examination. How should this be handled at this point?
"""
FastLanguageModel.for_inference(model) # Unsloth has 2x faster inference!
inputs = tokenizer([prompt_style.format(question, "")],
return_tensors="pt").to("cuda")
from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer)
_ = model.generate(**inputs, streamer=text_streamer, max_new_tokens=2048)
```python
[More Information Needed]
## Training Details
### Training Data
[FreedomIntelligence/medical-o1-reasoning-SFT](https://huggingface.co/datasets/FreedomIntelligence/medical-o1-reasoning-SFT)
#### Preprocessing [optional]
train_prompt_style = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request. Before answering, think carefully about the question and create a step-by-step chain of thoughts to ensure a logical and accurate response.
Instruction:
You are a medical expert with advanced knowledge in clinical reasoning, diagnostics, and treatment planning. Please answer the following medical question.
Question:
{}
Response:
{} {}"""
#### Training Hyperparameters
- **Training regime:**
- fp16
- optim="adamw_8bit",
- weight_decay=0.01,
- lr_scheduler_type="linear",
- per_device_train_batch_size=2,
- gradient_accumulation_steps=4,
- warmup_steps=5,
- max_steps=60,
- learning_rate=1e-4,
[More Information Needed]
#### Summary
This is fine tuned model on Medical dataset with Deepseek llama 3-8b distill
#### Hardware
nvidia L4
## Model Card Authors [optional]
Melody Zhao
## Model Card Contact
[Github](https://github.com/Melody-coder923)
- Downloads last month
- 5