Skip to main content
Version: Next

LangChain

*在线运行 vLLM 入门教程:零基础分步指南

vLLM 也可通过 LangChain 获取。

运行下面命令安装 LangChain:

pip install langchain langchain_community -q

langchain 使用 VLLM 类,在一个或多个 GPU 上运行推理

from langchain_community.llms import VLLM


llm = VLLM(model="mosaicml/mpt-7b",
trust_remote_code=True, # mandatory for hf models
max_new_tokens=128,
top_k=10,
top_p=0.95,
temperature=0.8,
# tensor_parallel_size=... # for distributed inference
)


print(llm("What is the capital of France ?"))

请参阅该教程获得更多细节。