Instructions to use CloveAI/clov-medchat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use CloveAI/clov-medchat with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/mistral-7b-instruct-v0.2-bnb-4bit") model = PeftModel.from_pretrained(base_model, "CloveAI/clov-medchat") - Transformers
How to use CloveAI/clov-medchat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="CloveAI/clov-medchat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("CloveAI/clov-medchat", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use CloveAI/clov-medchat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CloveAI/clov-medchat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CloveAI/clov-medchat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/CloveAI/clov-medchat
- SGLang
How to use CloveAI/clov-medchat 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 "CloveAI/clov-medchat" \ --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": "CloveAI/clov-medchat", "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 "CloveAI/clov-medchat" \ --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": "CloveAI/clov-medchat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use CloveAI/clov-medchat 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 CloveAI/clov-medchat 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 CloveAI/clov-medchat to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for CloveAI/clov-medchat to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="CloveAI/clov-medchat", max_seq_length=2048, ) - Docker Model Runner
How to use CloveAI/clov-medchat with Docker Model Runner:
docker model run hf.co/CloveAI/clov-medchat
| base_model: unsloth/mistral-7b-instruct-v0.2-bnb-4bit | |
| library_name: peft | |
| pipeline_tag: text-generation | |
| tags: | |
| - base_model:adapter:unsloth/mistral-7b-instruct-v0.2-bnb-4bit | |
| - lora | |
| - transformers | |
| - unsloth | |
| ## Use this model | |
| ```python | |
| !pip install -q --upgrade bitsandbytes transformers accelerate | |
| from transformers import pipeline | |
| pipe = pipeline("text-generation", model="alanjoshua2005/alan-mistral-finetuned") | |
| user_input = input("Enter your medical question or prompt: ") | |
| prompt = ( | |
| f"""Imagine you are a helpful medical chatbot. Respond based on the user input below: | |
| <s>[INST] {user_input} [/INST] | |
| Please provide your answer in **structured Markdown format**. Follow these rules: | |
| - Complete the answer fully; do not stop mid-sentence | |
| - Use emojis to highlight key points | |
| - Use horizontal lines (---) to separate sections | |
| - Use bullet points and numbered lists where appropriate | |
| - Use tables if necessary to organize information clearly | |
| - Explain medical terms in simple words | |
| - Do NOT include any links, URLs, or image references | |
| - Make the response easy-to-read and informative | |
| """ | |
| ) | |
| result = pipe( | |
| prompt, | |
| max_new_tokens=512, | |
| do_sample=True, | |
| temperature=0.7, | |
| top_p=0.9, | |
| repetition_penalty=1.1 | |
| ) | |
| generated_text = result[0]["generated_text"] | |
| response = generated_text.replace(prompt, "").strip() | |
| print(response) | |
| ``` | |
| --- | |
| ## Model Details | |
| * **Developed by:** Alan Joshua | |
| * **Model type:** Text-Generation | |
| * **Language(s):** English | |
| * **License:** MIT | |
| * **Finetuned from model:** unsloth/mistral-7b-instruct-v0.2-bnb-4bit | |
| * **Dataset:** ruslanmv/ai-medical-chatbot | |
| --- | |
| ## Model Description | |
| This model is a **medical chatbot** fine-tuned on the `ruslanmv/ai-medical-chatbot` dataset using LoRA adapters on the Mistral 7B instruct model (4-bit). It is designed to provide **accurate, easy-to-understand medical information** in English. | |
| Key features of this model include: | |
| * **Structured Markdown responses:** Answers are formatted using bullets, numbered lists, tables, and horizontal lines for readability. | |
| * **Clear explanations:** Medical terms are explained in simple words for users of all backgrounds. | |
| * **Emojis:** Used to highlight key points and make responses more engaging. | |
| * **No links or images:** Ensures responses remain text-only for safe, direct answers. | |
| * **Complete answers:** Designed to generate full, coherent responses without cutting off mid-sentence. | |
| This model is suitable for educational purposes, healthcare awareness, and interactive Q&A applications. **It is not a substitute for professional medical advice.** Always verify information with a qualified healthcare provider. |