Optimize test code and readme (#48)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
chen, suyue
2024-04-08 13:45:11 +08:00
committed by GitHub
parent 315269106c
commit 46b374ab86
6 changed files with 24 additions and 3509 deletions

View File

@@ -1,22 +0,0 @@
## Performance measurements of chain with langsmith
Pre-requisite: Signup in langsmith [https://www.langchain.com/langsmith] and get the api token <br />
### Steps to run perf measurements
1. Build langchain-rag container with most updated Dockerfile
2. Start tgi server on system with Gaudi
3. Statr redis container with docker-compose-redis.yml
4. Add your hugging face access token in docker-compose-langchain.yml and start langchain-rag-server container
5. enter into langchain-rag-server container and start jupyter notebook server (can specify needed IP address and jupyter will run on port 8888)
```
docker exec -it langchain-rag-server bash
cd /test
jupyter notebook --allow-root --ip=X.X.X.X
```
6. Launch jupyter notebook in your browser and open the tgi_gaudi.ipynb notebook
7. Add langsmith api key in first cell of the notebook [os.environ["LANGCHAIN_API_KEY"] = "add-your-langsmith-key" # Your API key]
8. Clear all the cells and run all the cells
9. The output of the last cell which calls client.run_on_dataset() will run the langchain Q&A test and captures measurements in the langsmith server. The URL to access the test result can be obtained from the output of the command

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@ function test_env_setup() {
}
function rename() {
# Rename the container names
# Rename the docker container/image names to avoid conflict with local test
cd ${WORKPATH}
sed -i "s/container_name: redis-vector-db/container_name: ${REDIS_CONTAINER_NAME}/g" langchain/docker/docker-compose.yml
sed -i "s/container_name: qna-rag-redis-server/container_name: ${LANGCHAIN_CONTAINER_NAME}/g" langchain/docker/docker-compose.yml
@@ -33,7 +33,7 @@ function rename() {
sed -i "s/ChatQnA_server/${CHATQNA_CONTAINER_NAME}/g" serving/tgi_gaudi/launch_tgi_service.sh
}
function docker_setup() {
function launch_tgi_gaudi_service() {
local card_num=1
local port=8888
local model_name="Intel/neural-chat-7b-v3-3"
@@ -50,21 +50,20 @@ function docker_setup() {
sleep 3m # Waits 3 minutes
}
function launch_redis_and_langchain_container() {
function launch_redis_and_langchain_service() {
cd $WORKPATH
export HUGGINGFACEHUB_API_TOKEN=${HUGGING_FACE_TOKEN}
local port=8890
sed -i "s/port=8000/port=$port/g" langchain/docker/qna-app/app/server.py
docker compose -f langchain/docker/docker-compose.yml up -d --build
}
function launch_server() {
cd $WORKPATH
# Ingest data into redis
docker exec $LANGCHAIN_CONTAINER_NAME \
bash -c "cd /ws && python ingest.py > /dev/null"
}
# Start the Backend Service
function start_backend_service() {
cd $WORKPATH
docker exec $LANGCHAIN_CONTAINER_NAME \
bash -c "nohup python app/server.py &"
sleep 1m
@@ -106,9 +105,9 @@ function main() {
rename
docker_stop $CHATQNA_CONTAINER_NAME && docker_stop $LANGCHAIN_CONTAINER_NAME && docker_stop $REDIS_CONTAINER_NAME
docker_setup
launch_redis_and_langchain_container
launch_server
launch_tgi_gaudi_service
launch_redis_and_langchain_service
start_backend_service
run_tests

View File

@@ -1,8 +1,15 @@
<div align="center">
# Intel Generative AI Examples
## Introduction
This project provides a collective list of Generative AI (GenAI) examples such as chatbot with question and answering (ChatQnA), code generation (CodeGen), document summary (DocSum), etc.
This project provides a collective list of Generative AI (GenAI) examples such as chatbot with question and answering (ChatQnA), code generation, document summary, etc. The examples are developed by leveraging the ecosystem components such as LangChain with Intel optimizations, therefore delivering the high performance for your deployment on Intel platforms.
[![version](https://img.shields.io/badge/release-0.1-green)](https://github.com/intel/GenAIExamples/releases)
[![license](https://img.shields.io/badge/license-Apache%202-blue)](https://github.com/intel/neural-compressor/blob/master/LICENSE)
---
<div align="left">
## GenAI Examples

View File

@@ -5,3 +5,9 @@ Intel is committed to rapidly addressing security vulnerabilities affecting our
## Reporting a Vulnerability
Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).
## Script Usage Notice
SCRIPT USAGE NOTICE: By downloading and using any script file included with the associated software package (such as files with .bat, .cmd, or .JS extensions, Dockerfiles, or any other type of file that, when executed, automatically downloads and/or installs files onto your system)
(the “Script File”), it is your obligation to review the Script File to understand what files (e.g., other software, AI models, AI Datasets) the Script File will download to your system (“Downloaded Files”).
Furthermore, by downloading and using the Downloaded Files, even if they are installed through a silent install, you agree to any and all terms and conditions associated with such files, including but not limited to, license terms, notices, or disclaimers.