Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 8fbcceb

Browse files
authored
Enable build_chatbot_on_xpu.ipynb (#398)
1 parent 7a85baf commit 8fbcceb

File tree

5 files changed

+99
-35
lines changed

5 files changed

+99
-35
lines changed

intel_extension_for_transformers/neural_chat/docs/notebooks/build_chatbot_on_xpu.ipynb

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@
1414
"# Prepare Environment"
1515
]
1616
},
17+
{
18+
"cell_type": "markdown",
19+
"metadata": {},
20+
"source": [
21+
"Install Intel® Extension for Transformers*"
22+
]
23+
},
1724
{
1825
"cell_type": "code",
19-
"execution_count": 5,
26+
"execution_count": null,
2027
"metadata": {},
2128
"outputs": [],
2229
"source": [
@@ -27,7 +34,14 @@
2734
"cell_type": "markdown",
2835
"metadata": {},
2936
"source": [
30-
"Install Requirements:"
37+
"Refer to [Install Intel® Extension for PyTorch* from source](https://intel.github.io/intel-extension-for-pytorch/xpu/latest/tutorials/installations/linux.html#install-via-compiling-from-source) to build xpu version of torch, torchaudio and Intel® Extension for PyTorch*, and install generated wheels using pip."
38+
]
39+
},
40+
{
41+
"cell_type": "markdown",
42+
"metadata": {},
43+
"source": [
44+
"Install requirements"
3145
]
3246
},
3347
{
@@ -36,9 +50,31 @@
3650
"metadata": {},
3751
"outputs": [],
3852
"source": [
39-
"!git clone https://github.com/intel/intel-extension-for-transformers.git\n",
40-
"!cd ./intel-extension-for-transformers/intel_extension_for_transformers/neural_chat/\n",
41-
"!pip install -r requirements.txt"
53+
"%cd ../../\n",
54+
"!pip install -r requirements_xpu.txt"
55+
]
56+
},
57+
{
58+
"cell_type": "markdown",
59+
"metadata": {},
60+
"source": [
61+
"Install requirements that have denpendency on stock pytorch"
62+
]
63+
},
64+
{
65+
"cell_type": "code",
66+
"execution_count": null,
67+
"metadata": {},
68+
"outputs": [],
69+
"source": [
70+
"!pip install --no-deps peft speechbrain optimum optimum-intel sentence_transformers lm_eval accelerate"
71+
]
72+
},
73+
{
74+
"cell_type": "markdown",
75+
"metadata": {},
76+
"source": [
77+
"Notes: If you face \"GLIBCXX_3.4.30\" not found issue in conda environment, please remove lib/libstdc++* from conda environment. "
4278
]
4379
},
4480
{
@@ -142,25 +178,6 @@
142178
"source": [
143179
"You can display the generated wav file using IPython."
144180
]
145-
},
146-
{
147-
"cell_type": "code",
148-
"execution_count": null,
149-
"metadata": {},
150-
"outputs": [],
151-
"source": [
152-
"from intel_extension_for_transformers.neural_chat import PipelineConfig\n",
153-
"from intel_extension_for_transformers.neural_chat import build_chatbot\n",
154-
"from intel_extension_for_transformers.neural_chat import plugins\n",
155-
"plugins.tts.enable = True\n",
156-
"plugins.tts.args[\"output_audio_path\"] = \"./response.wav\"\n",
157-
"plugins.asr.enable = True\n",
158-
"\n",
159-
"config = PipelineConfig(plugins=plugins, model_name_or_path='Intel/neural-chat-7b-v1-1')\n",
160-
"chatbot = build_chatbot(config)\n",
161-
"result = chatbot.predict(query=\"./sample.wav\")\n",
162-
"print(result)"
163-
]
164181
}
165182
],
166183
"metadata": {

intel_extension_for_transformers/neural_chat/docs/notebooks/deploy_chatbot_on_xpu.ipynb

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"cell_type": "markdown",
1919
"metadata": {},
2020
"source": [
21-
"Install intel extension for transformers:"
21+
"Install Intel® Extension for Transformers*"
2222
]
2323
},
2424
{
@@ -34,7 +34,14 @@
3434
"cell_type": "markdown",
3535
"metadata": {},
3636
"source": [
37-
"Install Requirements:"
37+
"Refer to [Install Intel® Extension for PyTorch* from source](https://intel.github.io/intel-extension-for-pytorch/xpu/latest/tutorials/installations/linux.html#install-via-compiling-from-source) to build xpu version of torch, torchaudio and Intel® Extension for PyTorch*, and install generated wheels using pip."
38+
]
39+
},
40+
{
41+
"cell_type": "markdown",
42+
"metadata": {},
43+
"source": [
44+
"Install Requirements"
3845
]
3946
},
4047
{
@@ -48,6 +55,29 @@
4855
"!pip install -r requirements.txt"
4956
]
5057
},
58+
{
59+
"cell_type": "markdown",
60+
"metadata": {},
61+
"source": [
62+
"Install requirements that have denpendency on stock pytorch"
63+
]
64+
},
65+
{
66+
"cell_type": "code",
67+
"execution_count": null,
68+
"metadata": {},
69+
"outputs": [],
70+
"source": [
71+
"!pip install --no-deps peft speechbrain optimum optimum-intel sentence_transformers lm_eval accelerate"
72+
]
73+
},
74+
{
75+
"cell_type": "markdown",
76+
"metadata": {},
77+
"source": [
78+
"Notes: If you face \"GLIBCXX_3.4.30\" not found issue in conda environment, please remove lib/libstdc++* from conda environment. "
79+
]
80+
},
5181
{
5282
"cell_type": "markdown",
5383
"metadata": {},

intel_extension_for_transformers/neural_chat/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,4 @@ numpy==1.23.5
3838
tiktoken==0.4.0
3939
lm_eval
4040
accelerate
41-
optimum.intel
4241
cchardet
Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,31 @@
11
transformers>=4.32.0
22
fschat
3+
num2words
4+
paddlepaddle
5+
paddlespeech==1.4.1
6+
shortuuid
7+
gptcache
38
evaluate
4-
accelerate
5-
yacs
69
pydub
710
python-multipart
8-
sentencepiece
9-
protobuf
10-
--extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/
11-
torch==2.0.1a0
12-
intel_extension_for_pytorch==2.0.110+xpu
11+
PyPDF2
12+
langchain
13+
python-docx
14+
scikit-learn
15+
farm-haystack
16+
librosa
17+
beautifulsoup4
18+
InstructorEmbedding
19+
chromadb
20+
fastapi
21+
pydantic
22+
starlette
23+
yacs
24+
uvicorn
25+
unstructured
26+
markdown
27+
rouge_score
28+
openpyxl
29+
numpy==1.23.5
30+
tiktoken==0.4.0
31+
cchardet

intel_extension_for_transformers/neural_chat/requirements_xpu_no_deps.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)