歡迎來到 Xinference!#
Xorbits Inference (Xinference) 是一個開源平台,用於簡化各種 AI 模型的運行和整合。藉助 Xinference,您可以使用任何開源 LLM、嵌入模型和多模態模型在雲端或本地環境中運行推理,並建立強大的 AI 應用。
使用 Xinference 開發真實場景的 AI 應用#
from xinference.client import Client
client = Client("http://localhost:9997")
model = client.get_model("MODEL_UID")
# Chat to LLM
model.chat(
messages=[{"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": "What is the largest animal?"}],
generate_config={"max_tokens": 1024}
)
# Chat to VL model
model.chat(
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "What’s in this image?"},
{
"type": "image_url",
"image_url": {
"url": "http://i.epochtimes.com/assets/uploads/2020/07/shutterstock_675595789-600x400.jpg",
},
},
],
}
],
generate_config={"max_tokens": 1024}
)
from xinference.client import Client
client = Client("http://localhost:9997")
model = client.get_model("MODEL_UID")
model.create_embedding("What is the capital of China?")
from xinference.client import Client
client = Client("http://localhost:9997")
model = client.get_model("MODEL_UID")
model.text_to_image("An astronaut walking on the mars")
from xinference.client import Client
client = Client("http://localhost:9997")
model = client.get_model("MODEL_UID")
with open("speech.mp3", "rb") as audio_file:
model.transcriptions(audio_file.read())
from xinference.client import Client
client = Client("http://localhost:9997")
model = client.get_model("MODEL_UID")
query = "A man is eating pasta."
corpus = [
"A man is eating food.",
"A man is eating a piece of bread.",
"The girl is carrying a baby.",
"A man is riding a horse.",
"A woman is playing violin."
]
print(model.rerank(corpus, query))
from xinference.client import Client
client = Client("http://localhost:9997")
model = client.get_model("MODEL_UID")
model.text_to_video("")
入門指南#
安裝 Xinference
在 Linux、Windows 和 macOS 上安裝 Xinference。
立即體驗!
首先在本地電腦上執行 Xinference。
探索模型
探索 Xinference 支援的各種模型。
註冊你自己的模型
註冊模型權重,並轉換為 API
探索 API#
聊天 & 生成
學習如何在 Xinference 中與 LLM 聊天。
工具
學習如何將 LLM 與外部工具連接起來。
嵌入
學習如何在 Xinference 中建立文字嵌入。
重排序
學習如何在 Xinference 中使用重排序模型。
圖像
學習如何使用Xinference生成圖像。
多模態
學習如何使用 LLM 處理圖像和音訊。
音訊
學習如何使用 Xinference 將音訊轉換為文字或將文字轉換為音訊。
影片
學習如何使用Xinference生成影片。
靈活模型
瞭解如何使用 Xinference 推理傳統機器學習模型。
參與我們#
最新資訊
在 Twitter 上關注我們
尋求幫助
Discord 社群
加入 Telegram 群組
在 Github 上提 issue
貢獻
在 Github 上提 PR