Instructions to use eugenemaver/gemma-2b-mini-doctor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use eugenemaver/gemma-2b-mini-doctor with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="eugenemaver/gemma-2b-mini-doctor") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("eugenemaver/gemma-2b-mini-doctor") model = AutoModelForCausalLM.from_pretrained("eugenemaver/gemma-2b-mini-doctor", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use eugenemaver/gemma-2b-mini-doctor with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "eugenemaver/gemma-2b-mini-doctor" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eugenemaver/gemma-2b-mini-doctor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/eugenemaver/gemma-2b-mini-doctor
- SGLang
How to use eugenemaver/gemma-2b-mini-doctor 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 "eugenemaver/gemma-2b-mini-doctor" \ --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": "eugenemaver/gemma-2b-mini-doctor", "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 "eugenemaver/gemma-2b-mini-doctor" \ --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": "eugenemaver/gemma-2b-mini-doctor", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use eugenemaver/gemma-2b-mini-doctor with Docker Model Runner:
docker model run hf.co/eugenemaver/gemma-2b-mini-doctor
Gemma-2B-Mini-Doctor
This is a fine-tuned version of the Gemma-2B model specifically adapted for medical-related tasks.
Model Details
- Model Name: Gemma-2B-Mini-Doctor
- Base Model: Gemma-2B
- Fine-tuned by: Yevhen Solovei | Maverkick
- Fine-tuning Dataset: mamachang/medical-reasoning
- Number of Parameters: 2 billion
Training Details
- Training Epochs: 3
- Learning Rate: 2e-5
- Batch Size: 16
- Optimizer: AdamW
Intended Use
- Use Cases: Medical question answering, medical text generation
- Limitations: Not suitable for real-time medical advice, should not be used as a substitute for professional medical advice.
How to Use
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("gemma-2b-mini-doctor")
tokenizer = AutoTokenizer.from_pretrained("gemma-2b-mini-doctor")
inputs = tokenizer("What are the symptoms of flu?", return_tensors="pt")
outputs = model.generate(**inputs)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
- Downloads last month
- 7