community[minor]: migrate bigdl-llm to ipex-llm (#19518)

- **Description**: `bigdl-llm` library has been renamed to
[`ipex-llm`](https://github.com/intel-analytics/ipex-llm). This PR
migrates the `bigdl-llm` integration to `ipex-llm` .
- **Issue**: N/A. The original PR of `bigdl-llm` is
https://github.com/langchain-ai/langchain/pull/17953
- **Dependencies**: `ipex-llm` library
- **Contribution maintainer**: @shane-huang

Updated doc:   docs/docs/integrations/llms/ipex_llm.ipynb
Updated test:
libs/community/tests/integration_tests/llms/test_ipex_llm.py
This commit is contained in:
Shengsheng Huang
2024-03-28 11:12:59 +08:00
committed by GitHub
parent a31f692f4e
commit ac1dd8ad94
8 changed files with 232 additions and 30 deletions

View File

@@ -4,11 +4,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# BigDL-LLM\n",
"# IPEX-LLM\n",
"\n",
"> [BigDL-LLM](https://github.com/intel-analytics/BigDL/) is a low-bit LLM optimization library on Intel XPU (Xeon/Core/Flex/Arc/Max). It can make LLMs run extremely fast and consume much less memory on Intel platforms. It is open sourced under Apache 2.0 License.\n",
"> [IPEX-LLM](https://github.com/intel-analytics/ipex-llm/) is a low-bit LLM optimization library on Intel XPU (Xeon/Core/Flex/Arc/Max). It can make LLMs run extremely fast and consume much less memory on Intel platforms. It is open sourced under Apache 2.0 License.\n",
"\n",
"This example goes over how to use LangChain to interact with BigDL-LLM for text generation. \n"
"This example goes over how to use LangChain to interact with IPEX-LLM for text generation. \n"
]
},
{
@@ -33,7 +33,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Install BigDL-LLM for running LLMs locally on Intel CPU."
"Install IEPX-LLM for running LLMs locally on Intel CPU."
]
},
{
@@ -42,8 +42,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Install BigDL\n",
"%pip install --pre --upgrade bigdl-llm[all]"
"%pip install --pre --upgrade ipex-llm[all]"
]
},
{
@@ -60,7 +59,7 @@
"outputs": [],
"source": [
"from langchain.chains import LLMChain\n",
"from langchain_community.llms.bigdl import BigdlLLM\n",
"from langchain_community.llms import IpexLLM\n",
"from langchain_core.prompts import PromptTemplate"
]
},
@@ -89,7 +88,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "69e018750ffb4de1af22ce49cd6957f4",
"model_id": "27c08180714a44c7ab766624d5054163",
"version_major": 2,
"version_minor": 0
},
@@ -104,13 +103,12 @@
"name": "stderr",
"output_type": "stream",
"text": [
"2024-02-23 18:10:22,896 - INFO - Converting the current model to sym_int4 format......\n",
"2024-02-23 18:10:25,415 - INFO - BIGDL_OPT_IPEX: False\n"
"2024-03-27 00:58:43,670 - INFO - Converting the current model to sym_int4 format......\n"
]
}
],
"source": [
"llm = BigdlLLM.from_model_id(\n",
"llm = IpexLLM.from_model_id(\n",
" model_id=\"lmsys/vicuna-7b-v1.5\",\n",
" model_kwargs={\"temperature\": 0, \"max_length\": 64, \"trust_remote_code\": True},\n",
")"
@@ -135,6 +133,10 @@
"/opt/anaconda3/envs/shane-langchain2/lib/python3.9/site-packages/langchain_core/_api/deprecation.py:117: LangChainDeprecationWarning: The function `run` was deprecated in LangChain 0.1.0 and will be removed in 0.2.0. Use invoke instead.\n",
" warn_deprecated(\n",
"/opt/anaconda3/envs/shane-langchain2/lib/python3.9/site-packages/transformers/generation/utils.py:1369: UserWarning: Using `max_length`'s default (4096) to control the generation length. This behaviour is deprecated and will be removed from the config in v5 of Transformers -- we recommend using `max_new_tokens` to control the maximum length of the generation.\n",
" warnings.warn(\n",
"/opt/anaconda3/envs/shane-langchain2/lib/python3.9/site-packages/ipex_llm/transformers/models/llama.py:218: UserWarning: Passing `padding_mask` is deprecated and will be removed in v4.37.Please make sure use `attention_mask` instead.`\n",
" warnings.warn(\n",
"/opt/anaconda3/envs/shane-langchain2/lib/python3.9/site-packages/ipex_llm/transformers/models/llama.py:218: UserWarning: Passing `padding_mask` is deprecated and will be removed in v4.37.Please make sure use `attention_mask` instead.`\n",
" warnings.warn(\n"
]
},
@@ -156,6 +158,13 @@
"question = \"What is AI?\"\n",
"output = llm_chain.run(question)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {

View File

@@ -92,6 +92,10 @@
"source": "/docs/integrations/llms/huggingface_hub",
"destination": "/docs/integrations/llms/huggingface_endpoint"
},
{
"source": "/docs/integrations/llms/bigdl",
"destination": "/docs/integrations/llms/ipex_llm"
},
{
"source": "/docs/integrations/llms/watsonxllm",
"destination": "/docs/integrations/llms/ibm_watsonx"