XorbitsInference (Xinference) 是一个开源平台,用于简化各种 AI 模型的运行和集成。借助 Xinference,您可以使用任何开源 LLM、嵌入模型和多模态模型在云端或本地环境中运行推理,并创建强大的 AI 应用。 (1)本系列文章 首篇暂无~ 1、安装 参考页面:https://inference.readthedocs.io/en/latest/getting_started/ins...
from xinference.client import Client #url 可以是local的端口 也可以是外接的端口 url = "http://172.19.0.1:6006" print(url) client = Client(url) model_uid = client.launch_model(model_name="bge-reranker-base", model_type="rerank") model = client.get_model(model_uid) query = "A man...
2.1 Xinference 本地源码安装 首先我们需要准备一个 3.9 以上的 Python 环境运行来 Xinference,建议先根据 conda 官网文档安装 conda。 然后使用以下命令来创建 3.11 的 Python 环境: conda create --name xinference python=3.11 conda activate xinference 以下两条命令在安装 Xinference 时,将安装 Transformers 和...
client import Client #url 可以是local的端口 也可以是外接的端口 url = "http://172.19.0.1:6006" print(url) client = Client(url) model_uid = client.launch_model(model_name="bge-reranker-base", model_type="rerank") model = client.get_model(model_uid) query = "A man is eating pasta...
在Xinference 安装过程中,有可能会安装 PyTorch 的其他版本(其依赖的 vllm[3] 组件需要安装),从而导致 GPU 服务器无法正常使用,因此在安装完 Xinference 之后,可以执行以下命令看 PyTorch 是否正常: python -c"import torch; print(torch.cuda.is_available())" ...
fromxorbitsimportXinferenceClientclient=XinferenceClient()model=client.load_model('gpt3')prompt="人类文明始于"output=model.generate_text(prompt,max_length=100)print(output) 通过简单的API调用,即可生成连贯且富有创造性的文本内容,彰显了Xinference在处理复杂任务时的强大能力。
client = OpenAI(base_url="http://127.0.0.1:9997/v1", api_key="not used actually") response = client.chat.completions.create( model="qwen2.5-instruct", messages=[ {"role":"system","content":"You are a helpful assistant."},
client=Client("http://localhost:9997")model_uid=client.launch_model(model_name="chatglm2")model=client.get_model(model_uid)chat_history=[]prompt="What is the largest animal?"model.chat(prompt,chat_history,generate_config={"max_tokens":1024}) ...
from xinference.client import Clientclient = Client("http://127.0.0.1:9997")model_uid = client.launch_model(model_name="llama-2-chat",model_format="ggufv2",model_size_in_billions=7,quantization="Q4_K_M",)model = client.get_model(model_uid)chat_history = []prompt = "What is the ...