Skip to main content
在 GitHub 上打开

DeepSparse

本页介绍了如何在 LangChain 中使用 DeepSparse 推理运行时。 它分为两部分:安装和设置,然后是 DeepSparse 用法示例。

安装和设置

LLM

存在一个 DeepSparse LLM 包装器,您可以使用以下方法访问它:

from langchain_community.llms import DeepSparse
API 参考:DeepSparse

它为所有模型提供了一个统一的界面:

llm = DeepSparse(model='zoo:nlg/text_generation/codegen_mono-350m/pytorch/huggingface/bigpython_bigquery_thepile/base-none')

print(llm.invoke('def fib():'))

可以使用config参数:

config = {'max_generated_tokens': 256}

llm = DeepSparse(model='zoo:nlg/text_generation/codegen_mono-350m/pytorch/huggingface/bigpython_bigquery_thepile/base-none', config=config)