Text Generation
Transformers
Safetensors
PyTorch
English
llama
medical
llama-3
casual-lm
conversational
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use shri171981/medical_chat_generative with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shri171981/medical_chat_generative with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shri171981/medical_chat_generative") 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("shri171981/medical_chat_generative") model = AutoModelForCausalLM.from_pretrained("shri171981/medical_chat_generative", 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 shri171981/medical_chat_generative with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shri171981/medical_chat_generative" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shri171981/medical_chat_generative", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/shri171981/medical_chat_generative
- SGLang
How to use shri171981/medical_chat_generative 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 "shri171981/medical_chat_generative" \ --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": "shri171981/medical_chat_generative", "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 "shri171981/medical_chat_generative" \ --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": "shri171981/medical_chat_generative", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use shri171981/medical_chat_generative with Docker Model Runner:
docker model run hf.co/shri171981/medical_chat_generative
HACK_DOC (Medical Assistant)
This is a Llama-3 based medical assistant model.
It was fine-tuned on the ChatDoctor-HealthCareMagic-100k dataset to provide empathetic, doctor-style responses to medical queries.
Model Details
- Base Model:
unsloth/llama-3-8b-instruct-bnb-4bit - Adapter Type: LoRA (Rank 64)
- Training Framework: Unsloth / PyTorch
- Trigger Phrase: The model is trained to start responses with: "THANKS FOR ASKING HACK_DOC. Here is my answer:"
How to use
You must load this adapter on top of the base Llama-3 model.
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer
# 1. Load Base Model
base_model_name = "unsloth/llama-3-8b-instruct-bnb-4bit"
base_model = AutoModelForCausalLM.from_pretrained(
base_model_name,
load_in_4bit=True,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
# 2. Load HACK_DOC Adapter
model = PeftModel.from_pretrained(base_model, "shri171981/genai_hack_doc")
# 3. Run Inference
inputs = tokenizer("I have a severe headache.", return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 3