From 96dc825214803e129bdbf76dbeb7fc9bc9da597d Mon Sep 17 00:00:00 2001 From: Liangyx2 Date: Wed, 22 Nov 2023 16:46:23 +0800 Subject: [PATCH] Delete intel_extension_for_transformers/neural_chat/docs/notebooks/build_chatbot_on_xpu.ipynb Signed-off-by: Liangyx2 --- .../docs/notebooks/build_chatbot_on_xpu.ipynb | 204 ------------------ 1 file changed, 204 deletions(-) delete mode 100644 intel_extension_for_transformers/neural_chat/docs/notebooks/build_chatbot_on_xpu.ipynb diff --git a/intel_extension_for_transformers/neural_chat/docs/notebooks/build_chatbot_on_xpu.ipynb b/intel_extension_for_transformers/neural_chat/docs/notebooks/build_chatbot_on_xpu.ipynb deleted file mode 100644 index 60bdd9a8b31..00000000000 --- a/intel_extension_for_transformers/neural_chat/docs/notebooks/build_chatbot_on_xpu.ipynb +++ /dev/null @@ -1,204 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "NeuralChat is a customizable chat framework designed to create user own chatbot within few minutes on multiple architectures. This notebook is used to demostrate how to build a talking chatbot on Intel® Data Center GPU Flex Series 170, Intel® Data Center GPU Max Series and Intel® Arc™ A-Series GPUs." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Prepare Environment" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Install Intel® Extension for Transformers*" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "!pip install intel-extension-for-transformers" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "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" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%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. " - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Inference 💻" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Text Chat" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Giving NeuralChat the textual instruction, it will respond with the textual response." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from intel_extension_for_transformers.neural_chat import build_chatbot\n", - "chatbot = build_chatbot()\n", - "response = chatbot.predict(\"Tell me about Intel Xeon Scalable Processors.\")\n", - "print(response)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Text Chat With RAG Plugin" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "User could also leverage NeuralChat RAG plugin to do domain specific chat by feding with some documents like below" - ] - }, - { - "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.retrieval.enable=True\n", - "plugins.retrieval.args[\"input_path\"]=\"../../assets/docs/\"\n", - "config = PipelineConfig(plugins=plugins, model_name_or_path='Intel/neural-chat-7b-v1-1')\n", - "chatbot = build_chatbot(config)\n", - "response = chatbot.predict(\"How many cores does the Intel® Xeon® Platinum 8480+ Processor have in total?\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Voice Chat with ATS & TTS Plugin" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "In the context of voice chat, users have the option to engage in various modes: utilizing input audio and receiving output audio, employing input audio and receiving textual output, or providing input in textual form and receiving audio output.\n", - "\n", - "For the Python API code, users have the option to enable different voice chat modes by setting ASR and TTS plugins enable or disable." - ] - }, - { - "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, plugins\n", - "plugins.asr.enable = True\n", - "plugins.tts.enable = True\n", - "plugins.tts.args[\"output_audio_path\"]=\"./output_audio.wav\"\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=\"../../assets/audio/sample.wav\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "You can display the generated wav file using IPython." - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.10.0" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -}