openlifescienceai/medmcqa
Viewer • Updated • 193k • 42.5k • 232
How to use JosefAlbers/phi-3-medmcqa-openbiollm with MLX:
# Make sure mlx-lm is installed
# pip install --upgrade mlx-lm
# if on a CUDA device, also pip install mlx[cuda]
# Generate text with mlx-lm
from mlx_lm import load, generate
model, tokenizer = load("JosefAlbers/phi-3-medmcqa-openbiollm")
prompt = "Once upon a time in"
text = generate(model, tokenizer, prompt=prompt, verbose=True)How to use JosefAlbers/phi-3-medmcqa-openbiollm with MLX LM:
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "JosefAlbers/phi-3-medmcqa-openbiollm" --prompt "Once upon a time"
LoRA finetune of Phi-3 on aaditya/Llama3-OpenBioLLM-8B generated answers to a subset of openlifescienceai/medmcqa questions using LoRA4context library.
Usage:
prompt = """A 55- year old diabetic patient presents with transient obscuration in vision for 2-3 days followed by sudden loss of vision. Which of the following would be the best test to evaluate the symptoms?
A. Serum ACE levels
B. Quantiferon-Gold TB test
C. Elevated homocysteine levels
D. Serum creatinine levels"""
from huggingface_hub import HfApi, login, hf_hub_download, snapshot_download
snapshot_download(repo_id='JosefAlbers/phi-3-usmle', repo_type="model", local_dir=".")
from mlx_lm import load, generate
model, tokenizer = load("mlx-community/Phi-3-mini-4k-instruct-4bit-no-q-embed", tokenizer_config={'eos_token':'<|end|>'}, adapter_path='adapters')
generate(model, tokenizer, f"<|user|>\n{prompt}\n<|end|>\n<|assistant|>", max_tokens=500)
Quantized