重要提示:虽然这些模型可以提供初步的医疗信息了解及养生保健知识,但如果您有个人医疗需求,请务必咨询合格的医疗保健提供者。本文内容仅供技术研究与参考,不作为临床诊断依据。
1. 医疗大模型介绍
OpenBioLLM-Llama3 是生物医学领域的开源大语言模型(LLM),在多项基准测试中表现优异,优于 GPT-4、Gemini、Meditron-70B、Med-PaLM-1 和 Med-PaLM-2。
该模型提供两个版本:
- OpenBioLLM-70B:提供 SOTA(State-of-the-Art)性能,为同等规模模型设立了新的最先进水平。
- OpenBioLLM-8B:模型体积更小,推理速度更快,甚至超越了 GPT-3.5、Gemini 和 Meditron-70B。
相关排行榜与下载地址:
- 医疗 LLM 排行榜:https://huggingface.co/spaces/openlifescienceai/open_medical_llm_leaderboard
- 70B 模型:https://huggingface.co/aaditya/Llama3-OpenBioLLM-70B
- 8B 模型:https://huggingface.co/aaditya/Llama3-OpenBioLLM-8B
2. 安装指南
2.1 环境准备与依赖安装
推荐使用 Python 3.10+ 环境。首先需要安装 llama-cpp-python 库以支持本地推理。
pip install llama-cpp-python
安装过程会自动处理构建依赖,如 typing-extensions、numpy、diskcache 等。如果遇到编译错误,请确保系统已安装 C++ 编译器及必要的开发工具包。
2.2 下载模型文件
模型采用 GGUF 格式,便于量化部署。以下代码演示如何从 HuggingFace Hub 下载并加载 8B 量化版本。
from huggingface_hub import hf_hub_download
from llama_cpp import Llama
model_name = "aaditya/OpenBioLLM-Llama3-8B-GGUF"
model_file = "openbiollm-llama3-8b.Q5_K_M.gguf"
# 下载到指定目录
model_path = hf_hub_download(
model_name,
filename=model_file,
local_dir='/content'
)
print("Model path: ", model_path)
# 初始化模型,n_gpu_layers=-1 表示尽可能利用 GPU
llm = Llama(
model_path=model_path,
n_gpu_layers=-1,
n_ctx=
)


