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

Update SPR chatbot notebook #1481

Merged
merged 5 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
},
Expand Down Expand Up @@ -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",
Expand All @@ -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"
]
},
{
Expand All @@ -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
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accelerate==0.28.0
cchardet
einops
evaluate
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Loading