diff --git a/intel_extension_for_transformers/neural_chat/docs/notebooks/setup_text_chatbot_service_on_spr.ipynb b/intel_extension_for_transformers/neural_chat/docs/notebooks/setup_text_chatbot_service_on_spr.ipynb index c4860874825..f5cee467ab0 100644 --- a/intel_extension_for_transformers/neural_chat/docs/notebooks/setup_text_chatbot_service_on_spr.ipynb +++ b/intel_extension_for_transformers/neural_chat/docs/notebooks/setup_text_chatbot_service_on_spr.ipynb @@ -30,10 +30,7 @@ "!pip install intel-extension-for-transformers\n", "!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\n", - "!sudo apt install numactl\n", - "!conda install astunparse ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses -y\n", - "!conda install jemalloc gperftools -c conda-forge -y\n", + "!pip install -r requirements_cpu.txt\n", "!pip install nest_asyncio" ] }, @@ -100,9 +97,9 @@ "For detailed information about the configuration settings, please refer to the [Hugging Face Spaces Config Reference](https://huggingface.co/docs/hub/spaces-config-reference).\n", "\n", "### Setup application\n", - "We strongly recommend utilizing the provided textbot frontend code as it represents the reference implementation already deployed on Hugging Face Space. To establish your application, simply copy the code files from this directory(intel_extension_for_transformers/neural_chat/examples/textbot/frontend) and adjust their configurations as necessary (e.g., backend service URL in the `app.py` file like below).\n", + "We strongly recommend utilizing the provided textbot frontend code as it represents the reference implementation already deployed on Hugging Face Space. To establish your application, simply copy the code files from this directory(intel_extension_for_transformers/neural_chat/ui/gradio/basic) and adjust their configurations as necessary (e.g., backend service URL in the `app.py` file like below).\n", "\n", - "![Update backend URL](https://i.imgur.com/rQxPOV7.png)\n", + "![Update backend URL](https://i.imgur.com/rhObrcv.png)\n", "\n", "Alternatively, you have the option to clone the existing space from [https://huggingface.co/spaces/Intel/NeuralChat-GNR-1](https://huggingface.co/spaces/Intel/NeuralChat-GNR-1).\n", "\n", @@ -126,7 +123,10 @@ "metadata": {}, "outputs": [], "source": [ - "!pip install -r ./examples/deployment/textbot/frontend/requirements.txt" + "%cd ./ui/gradio/basic\n", + "!pip install -r requirements.txt\n", + "!pip install gradio==3.36.0\n", + "!pip install pydantic==1.10.13" ] }, { @@ -144,38 +144,50 @@ "metadata": {}, "outputs": [], "source": [ - "!cd ./examples/deployment/textbot/frontend/\n", - "!nohup python app.py &" + "!python app.py" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "This will run the chatbot application in the background on your server. The port is defined in `server_port=` at the end of the `app.py` file.\n", + "This will run the chatbot frontend application on your server. The port is defined in `server_port=` at the end of the `app.py` file. You can change it according to your environment.\n", "\n", "Once the application is running, you can find the access URL in the trace log:\n", "\n", "```log\n", - "INFO | gradio_web_server | Models: meta-llama/Llama-2-7b-chat-hf\n", - "INFO | stdout | Running on local URL: http://0.0.0.0:7860\n", + "2024-04-14 23:18:52 | INFO | gradio_web_server | Models: ['/mnt/localdisk/models/neural-chat-7b-v3-1']\n", + "2024-04-14 23:18:54 | INFO | stdout | Running on local URL: http://0.0.0.0:80\n", + "2024-04-14 23:18:54 | INFO | stdout | \n", + "2024-04-14 23:18:54 | INFO | stdout | To create a public link, set `share=True` in `launch()`.\n", + "2024-04-14 23:19:01 | INFO | gradio_web_server | load_demo. ip: 127.0.0.1. params: {}\n", + "2024-04-14 23:19:01 | INFO | httpx | HTTP Request: POST http://localhost/api/predict \"HTTP/1.1 200 OK\"\n", "```\n", - "The URL to access the chatbot frontend is http://SERVER_IP_ADDRESS:7860. Please remember to replace SERVER_IP_ADDRESS with your server's actual IP address.\n", - "\n", - "![URL](https://i.imgur.com/La3tJ8d.png)\n", - "\n", - "Please update the backend service URL in the `app.py` file.\n", + "The URL to access the chatbot frontend is http://SERVER_IP_ADDRESS:80. Please remember to replace SERVER_IP_ADDRESS with your server's actual IP address.\n", "\n", - "![Update backend URL](https://i.imgur.com/gRtZHrJ.png)" + "![URL](https://i.imgur.com/Mcs6Ysh.png)\n" ] } ], "metadata": { - "language_info": { - "name": "python" + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" }, - "orig_nbformat": 4 + "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.9.0" + } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/intel_extension_for_transformers/neural_chat/requirements_cpu.txt b/intel_extension_for_transformers/neural_chat/requirements_cpu.txt index 63689ae771d..59e03f3a268 100644 --- a/intel_extension_for_transformers/neural_chat/requirements_cpu.txt +++ b/intel_extension_for_transformers/neural_chat/requirements_cpu.txt @@ -1,3 +1,4 @@ +accelerate==0.28.0 cchardet einops evaluate diff --git a/intel_extension_for_transformers/neural_chat/ui/gradio/basic/requirements.txt b/intel_extension_for_transformers/neural_chat/ui/gradio/basic/requirements.txt index 48462d7b6cd..c75dc9b0d82 100644 --- a/intel_extension_for_transformers/neural_chat/ui/gradio/basic/requirements.txt +++ b/intel_extension_for_transformers/neural_chat/ui/gradio/basic/requirements.txt @@ -1,11 +1,12 @@ diffusers==0.8.1 fschat -gradio +gradio==3.36.0 huggingface_hub markdown2 nh3 openai pip +pydantic==1.10.13 requests torch==2.2.0 transformers