Skip to content

Commit

Permalink
Enable build_chatbot_on_xpu.ipynb (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyan2021 committed Sep 26, 2023
1 parent 7a85baf commit 8fbcceb
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@
"# Prepare Environment"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Install Intel® Extension for Transformers*"
]
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -27,7 +34,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Install Requirements:"
"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."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Install requirements"
]
},
{
Expand All @@ -36,9 +50,31 @@
"metadata": {},
"outputs": [],
"source": [
"!git clone https://github.com/intel/intel-extension-for-transformers.git\n",
"!cd ./intel-extension-for-transformers/intel_extension_for_transformers/neural_chat/\n",
"!pip install -r requirements.txt"
"%cd ../../\n",
"!pip install -r requirements_xpu.txt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Install requirements that have denpendency on stock pytorch"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install --no-deps peft speechbrain optimum optimum-intel sentence_transformers lm_eval accelerate"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notes: If you face \"GLIBCXX_3.4.30\" not found issue in conda environment, please remove lib/libstdc++* from conda environment. "
]
},
{
Expand Down Expand Up @@ -142,25 +178,6 @@
"source": [
"You can display the generated wav file using IPython."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from intel_extension_for_transformers.neural_chat import PipelineConfig\n",
"from intel_extension_for_transformers.neural_chat import build_chatbot\n",
"from intel_extension_for_transformers.neural_chat import plugins\n",
"plugins.tts.enable = True\n",
"plugins.tts.args[\"output_audio_path\"] = \"./response.wav\"\n",
"plugins.asr.enable = True\n",
"\n",
"config = PipelineConfig(plugins=plugins, model_name_or_path='Intel/neural-chat-7b-v1-1')\n",
"chatbot = build_chatbot(config)\n",
"result = chatbot.predict(query=\"./sample.wav\")\n",
"print(result)"
]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Install intel extension for transformers:"
"Install Intel® Extension for Transformers*"
]
},
{
Expand All @@ -34,7 +34,14 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Install Requirements:"
"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."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Install Requirements"
]
},
{
Expand All @@ -48,6 +55,29 @@
"!pip install -r requirements.txt"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Install requirements that have denpendency on stock pytorch"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install --no-deps peft speechbrain optimum optimum-intel sentence_transformers lm_eval accelerate"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Notes: If you face \"GLIBCXX_3.4.30\" not found issue in conda environment, please remove lib/libstdc++* from conda environment. "
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,4 @@ numpy==1.23.5
tiktoken==0.4.0
lm_eval
accelerate
optimum.intel
cchardet
33 changes: 26 additions & 7 deletions intel_extension_for_transformers/neural_chat/requirements_xpu.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
transformers>=4.32.0
fschat
num2words
paddlepaddle
paddlespeech==1.4.1
shortuuid
gptcache
evaluate
accelerate
yacs
pydub
python-multipart
sentencepiece
protobuf
--extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/
torch==2.0.1a0
intel_extension_for_pytorch==2.0.110+xpu
PyPDF2
langchain
python-docx
scikit-learn
farm-haystack
librosa
beautifulsoup4
InstructorEmbedding
chromadb
fastapi
pydantic
starlette
yacs
uvicorn
unstructured
markdown
rouge_score
openpyxl
numpy==1.23.5
tiktoken==0.4.0
cchardet

This file was deleted.

0 comments on commit 8fbcceb

Please sign in to comment.