dh-mc commited on
Commit
0d0811c
·
1 Parent(s): f9a4ebe

initial working code

Browse files
Files changed (45) hide show
  1. .env.example +87 -0
  2. .gitattributes +39 -0
  3. .gitignore +15 -32
  4. .gitmodules +3 -0
  5. Makefile +21 -0
  6. README.md +115 -1
  7. app.py +203 -0
  8. app_modules/init.py +83 -0
  9. app_modules/llm_inference.py +137 -0
  10. app_modules/llm_loader.py +648 -0
  11. app_modules/llm_qa_chain.py +20 -0
  12. app_modules/utils.py +166 -0
  13. assets/Workflow-Overview.png +0 -0
  14. assets/custom.css +488 -0
  15. assets/favicon.ico +0 -0
  16. data/faiss_1024_512/index.faiss +3 -0
  17. data/faiss_1024_512/index.pkl +3 -0
  18. data/questions.txt +4 -0
  19. eval_models.py +230 -0
  20. ingest.py +129 -0
  21. notebook/nvidia-4080-dolphin-2_6-phi-2-2.7b.ipynb +0 -0
  22. notebook/nvidia-4080-llama-2-7b.ipynb +2459 -0
  23. notebook/nvidia-4080-orca-2-13b_tgi.ipynb +359 -0
  24. notebook/nvidia-4080-orca-2-7b.ipynb +435 -0
  25. notebook/nvidia-4080-orca-2-7b_tgi.ipynb +369 -0
  26. notebook/nvidia-4080-phi-2-2.7b.ipynb +0 -0
  27. notebook/nvidia-4090-dolphin-2_6-phi-2-2.7b.ipynb +0 -0
  28. notebook/nvidia-4090-llama-2-13b.ipynb +478 -0
  29. notebook/nvidia-4090-llama-2-7b.ipynb +451 -0
  30. notebook/nvidia-4090-openai.ipynb +369 -0
  31. notebook/nvidia-4090-orca-2-13b.ipynb +415 -0
  32. notebook/nvidia-4090-orca-2-7b.ipynb +439 -0
  33. notebook/nvidia-4090-phi-2-2.7b.ipynb +0 -0
  34. qa_chain_test.py +88 -0
  35. requirements-mac.txt +129 -0
  36. requirements.txt +129 -0
  37. results/1_process-raw-data.ipynb +1573 -0
  38. results/2_process-raw-data_nvidia-4080.ipynb +1355 -0
  39. results/3_analyze-data.ipynb +0 -0
  40. results/4_translate_spanish_content.ipynb +465 -0
  41. results/all_data.xlsx +0 -0
  42. results/perf_data.xlsx +0 -0
  43. results/perf_data_nvidia_4080.xlsx +0 -0
  44. results/raw_data.xlsx +0 -0
  45. results/raw_data_nvidia_4080.xlsx +0 -0
.env.example ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LLM_MODEL_TYPE=openai
2
+ # LLM_MODEL_TYPE=gpt4all-j
3
+ # LLM_MODEL_TYPE=gpt4all
4
+ # LLM_MODEL_TYPE=llamacpp
5
+ # LLM_MODEL_TYPE=huggingface
6
+ # LLM_MODEL_TYPE=mosaicml
7
+ # LLM_MODEL_TYPE=stablelm
8
+ # LLM_MODEL_TYPE=openllm
9
+ LLM_MODEL_TYPE=hftgi
10
+
11
+ OPENLLM_SERVER_URL=
12
+
13
+ HFTGI_SERVER_URL=https://enabled-factually-cougar.ngrok-free.app
14
+
15
+ OPENAI_API_KEY=
16
+
17
+ # if unset, default to "gpt-3.5-turbo"
18
+ OPENAI_MODEL_NAME=
19
+
20
+ # cpu, mps or cuda:0 - if unset, use whatever detected
21
+ HF_EMBEDDINGS_DEVICE_TYPE=
22
+ HF_PIPELINE_DEVICE_TYPE=
23
+
24
+ # uncomment one of the below to load corresponding quantized model
25
+ # LOAD_QUANTIZED_MODEL=4bit
26
+ # LOAD_QUANTIZED_MODEL=8bit
27
+
28
+ DISABLE_MODEL_PRELOADING=true
29
+ CHAT_HISTORY_ENABLED=true
30
+ SHOW_PARAM_SETTINGS=false
31
+ SHARE_GRADIO_APP=false
32
+ PDF_FILE_BASE_URL=https://chat-with-llama-2.netlify.app/pdfs/pci_dss_v4/
33
+
34
+ # if unset, default to "hkunlp/instructor-xl"
35
+ HF_EMBEDDINGS_MODEL_NAME="hkunlp/instructor-large"
36
+
37
+ # number of cpu cores - used to set n_threads for GPT4ALL & LlamaCpp models
38
+ NUMBER_OF_CPU_CORES=
39
+
40
+ HUGGINGFACE_AUTH_TOKEN=
41
+
42
+ USING_TORCH_BFLOAT16=true
43
+
44
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="databricks/dolly-v2-3b"
45
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="databricks/dolly-v2-7b"
46
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="databricks/dolly-v2-12b"
47
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="TheBloke/wizardLM-7B-HF"
48
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="TheBloke/vicuna-7B-1.1-HF"
49
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="nomic-ai/gpt4all-j"
50
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="nomic-ai/gpt4all-falcon"
51
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="lmsys/fastchat-t5-3b-v1.0"
52
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="meta-llama/Llama-2-7b-chat-hf"
53
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="meta-llama/Llama-2-13b-chat-hf"
54
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="meta-llama/Llama-2-70b-chat-hf"
55
+ HUGGINGFACE_MODEL_NAME_OR_PATH="microsoft/Orca-2-7b"
56
+
57
+ STABLELM_MODEL_NAME_OR_PATH="OpenAssistant/stablelm-7b-sft-v7-epoch-3"
58
+
59
+ MOSAICML_MODEL_NAME_OR_PATH="mosaicml/mpt-7b-instruct"
60
+
61
+ FALCON_MODEL_NAME_OR_PATH="tiiuae/falcon-7b-instruct"
62
+
63
+ GPT4ALL_J_MODEL_PATH="./models/ggml-gpt4all-j-v1.3-groovy.bin"
64
+ GPT4ALL_J_DOWNLOAD_LINK=https://gpt4all.io/models/ggml-gpt4all-j-v1.3-groovy.bin
65
+
66
+ GPT4ALL_MODEL_PATH="./models/ggml-nous-gpt4-vicuna-13b.bin"
67
+ GPT4ALL_DOWNLOAD_LINK=https://gpt4all.io/models/ggml-nous-gpt4-vicuna-13b.bin
68
+
69
+ LLAMACPP_MODEL_PATH="./models/wizardLM-7B.ggmlv3.q4_1.bin"
70
+ LLAMACPP_DOWNLOAD_LINK=https://huggingface.co/TheBloke/wizardLM-7B-GGML/resolve/main/wizardLM-7B.ggmlv3.q4_1.bin
71
+
72
+ # Index for PCI DSS v4 PDF files - chunk_size=1024 chunk_overlap=512
73
+ # CHROMADB_INDEX_PATH="./data/chromadb_1024_512/"
74
+ FAISS_INDEX_PATH="./data/faiss_1024_512/"
75
+
76
+ CHAT_QUESTION="What's the capital city of Malaysia?"
77
+ QA_QUESTION="What's PCI DSS?"
78
+
79
+ QUESTIONS_FILE_PATH="./data/questions.txt"
80
+
81
+ TOKENIZERS_PARALLELISM=true
82
+
83
+ # env variables for ingesting source PDF files
84
+ SOURCE_PDFS_PATH="./data/pdfs/"
85
+ SOURCE_URLS="./data/pci_dss_urls.txt"
86
+ CHUNCK_SIZE=1024
87
+ CHUNK_OVERLAP=512
.gitattributes ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ data/faiss_1024_512/index.faiss filter=lfs diff=lfs merge=lfs -text
37
+ data/faiss_1024_512/index.pkl filter=lfs diff=lfs merge=lfs -text
38
+ data/chromadb_1024_512/9ccc1a9f-e406-4855-be51-a5d2aa027345 filter=lfs diff=lfs merge=lfs -text
39
+ data/chromadb_1024_512/chroma.sqlite3 filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  # Byte-compiled / optimized / DLL files
2
  __pycache__/
3
  *.py[cod]
@@ -20,6 +24,7 @@ parts/
20
  sdist/
21
  var/
22
  wheels/
 
23
  share/python-wheels/
24
  *.egg-info/
25
  .installed.cfg
@@ -49,14 +54,13 @@ coverage.xml
49
  *.py,cover
50
  .hypothesis/
51
  .pytest_cache/
52
- cover/
53
 
54
  # Translations
55
  *.mo
56
  *.pot
57
 
58
  # Django stuff:
59
- *.log
60
  local_settings.py
61
  db.sqlite3
62
  db.sqlite3-journal
@@ -72,7 +76,6 @@ instance/
72
  docs/_build/
73
 
74
  # PyBuilder
75
- .pybuilder/
76
  target/
77
 
78
  # Jupyter Notebook
@@ -83,9 +86,7 @@ profile_default/
83
  ipython_config.py
84
 
85
  # pyenv
86
- # For a library or package, you might want to ignore these files since the code is
87
- # intended to run in multiple environments; otherwise, check them in:
88
- # .python-version
89
 
90
  # pipenv
91
  # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
@@ -94,22 +95,7 @@ ipython_config.py
94
  # install all needed dependencies.
95
  #Pipfile.lock
96
 
97
- # poetry
98
- # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
- # This is especially recommended for binary packages to ensure reproducibility, and is more
100
- # commonly ignored for libraries.
101
- # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
- #poetry.lock
103
-
104
- # pdm
105
- # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
- #pdm.lock
107
- # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
- # in version control.
109
- # https://pdm.fming.dev/#use-with-ide
110
- .pdm.toml
111
-
112
- # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
  __pypackages__/
114
 
115
  # Celery stuff
@@ -146,15 +132,12 @@ dmypy.json
146
  # Pyre type checker
147
  .pyre/
148
 
149
- # pytype static type analyzer
150
- .pytype/
 
 
151
 
152
- # Cython debug symbols
153
- cython_debug/
154
 
155
- # PyCharm
156
- # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
- # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
- # and can be added to the global gitignore or merged into this file. For a more nuclear
159
- # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
- #.idea/
 
1
+ *.out
2
+ pdfs/
3
+ .vscode/
4
+
5
  # Byte-compiled / optimized / DLL files
6
  __pycache__/
7
  *.py[cod]
 
24
  sdist/
25
  var/
26
  wheels/
27
+ pip-wheel-metadata/
28
  share/python-wheels/
29
  *.egg-info/
30
  .installed.cfg
 
54
  *.py,cover
55
  .hypothesis/
56
  .pytest_cache/
 
57
 
58
  # Translations
59
  *.mo
60
  *.pot
61
 
62
  # Django stuff:
63
+ # *.log
64
  local_settings.py
65
  db.sqlite3
66
  db.sqlite3-journal
 
76
  docs/_build/
77
 
78
  # PyBuilder
 
79
  target/
80
 
81
  # Jupyter Notebook
 
86
  ipython_config.py
87
 
88
  # pyenv
89
+ .python-version
 
 
90
 
91
  # pipenv
92
  # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
 
95
  # install all needed dependencies.
96
  #Pipfile.lock
97
 
98
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  __pypackages__/
100
 
101
  # Celery stuff
 
132
  # Pyre type checker
133
  .pyre/
134
 
135
+ # JetBrains
136
+ .idea
137
+
138
+ *.db
139
 
140
+ .DS_Store
 
141
 
142
+ vectorstore.pkl
143
+ langchain.readthedocs.io/
 
 
 
 
.gitmodules ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [submodule "ragas_extended"]
2
+ path = ragas_extended
3
+ url = https://github.com/inflaton/ragas_extended.git
Makefile ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .PHONY: start
2
+ start:
3
+ python app.py
4
+
5
+ test:
6
+ python qa_chain_test.py
7
+
8
+ ingest:
9
+ python ingest.py
10
+
11
+ .PHONY: format
12
+ format:
13
+ black .
14
+
15
+ install:
16
+ pip install -r requirements.txt
17
+ cd ragas_extended && pip install -e .
18
+
19
+ install-mac:
20
+ pip install -r requirements-mac.txt
21
+ cd ragas_extended && pip install -e .
README.md CHANGED
@@ -1 +1,115 @@
1
- # chat-with-research-paper
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ChatPDF - Talk to Your PDF Files
2
+
3
+ This project uses Open AI and open-source large language models (LLMs) to enable you to talk to your own PDF files.
4
+
5
+ ## How it works
6
+
7
+ We're using an AI design pattern, namely "in-context learning" which uses LLMs off the shelf (i.e., without any fine-tuning), then controls their behavior through clever prompting and conditioning on private “contextual” data, e.g., texts extracted from your PDF files.
8
+
9
+ At a very high level, the workflow can be divided into three stages:
10
+
11
+ 1. Data preprocessing / embedding: This stage involves storing private data (your PDF files) to be retrieved later. Typically, the documents are broken into chunks, passed through an embedding model, then stored the created embeddings in a vectorstore.
12
+
13
+ 2. Prompt construction / retrieval: When a user submits a query, the application constructs a series of prompts to submit to the language model. A compiled prompt typically combines a prompt template and a set of relevant documents retrieved from the vectorstore.
14
+
15
+ 3. Prompt execution / inference: Once the prompts have been compiled, they are submitted to a pre-trained LLM for inference—including both proprietary model APIs and open-source or self-trained models.
16
+
17
+ ![In-context Learning - Workflow Overview](./assets/Workflow-Overview.png)
18
+
19
+ Tech stack used includes LangChain, Gradio, Chroma and FAISS.
20
+ - LangChain is an open-source framework that makes it easier to build scalable AI/LLM apps and chatbots.
21
+ - Gradio is an open-source Python library that is used to build machine learning and data science demos and web applications.
22
+ - Chroma and FAISS are open-source vectorstores for storing embeddings for your files.
23
+
24
+ ## Running Locally
25
+
26
+ 1. Check pre-conditions:
27
+
28
+ - Run `python --version` to make sure you're running Python version 3.10 or above.
29
+ - The latest PyTorch with GPU support must have been installed. Here is a sample `conda` command:
30
+ ```
31
+ conda install -y pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
32
+ ```
33
+ - [CMake](https://cmake.org/) must have been installed. Here is a sample command to install `CMake` on `ubuntu`:
34
+ ```
35
+ sudo apt install cmake
36
+ ```
37
+
38
+ 2. Clone the repo
39
+
40
+ ```
41
+ git clone https://github.com/smu-ai/Evaluation-of-Orca-2-Models-for-Conversational-RAG.git
42
+ ```
43
+
44
+
45
+ 3. Install packages
46
+
47
+ On Linux/WSL2:
48
+ ```
49
+ pip install -r requirements.txt
50
+ ```
51
+
52
+ On Mac:
53
+ ```
54
+ pip install -r requirements-mac.txt
55
+ ```
56
+
57
+ 4. Set up your environment variables
58
+
59
+ - By default, environment variables are loaded from `.env.example` file
60
+ - If you don't want to use the default settings, copy `.env.example` into `.env`. Your can then update it for your local runs.
61
+
62
+
63
+ 5. Start the local server at `http://localhost:7860`:
64
+
65
+ ```
66
+ python app.py
67
+ ```
68
+
69
+ ## Talk to Your Own PDF Files
70
+
71
+ - The sample PDF files are downloaded from [PCI DSS official website](https://www.pcisecuritystandards.org/document_library/?category=pcidss) and the corresponding embeddings are stored in folder `data/faiss_1024_512` with FAISS format, which allows you to run locally without any additional effort.
72
+
73
+ - You can also put your own PDF files into any folder specified in `SOURCE_PDFS_PATH` and run the command below to generate embeddings which will be stored in folder `FAISS_INDEX_PATH` or `CHROMADB_INDEX_PATH`. If both `*_INDEX_PATH` env vars are set, `FAISS_INDEX_PATH` takes precedence. Make sure the folder specified by `*_INDEX_PATH` doesn't exist; other wise the command will simply try to load index from the folder and do a simple similarity search, as a way to verify if embeddings are generated and stored properly. Please note the HuggingFace Embedding model specified by `HF_EMBEDDINGS_MODEL_NAME` will be used to generate the embeddings.
74
+
75
+ ```
76
+ python ingest.py
77
+ ```
78
+
79
+ - Once embeddings are generated, you can test them out locally, or check them into your duplicated space. Please note HF Spaces git server does not allow PDF files to be checked in.
80
+
81
+ ## Play with Different Large Language Models
82
+
83
+ The source code supports different LLM types - as shown at the top of `.env.example`
84
+
85
+ ```
86
+ # LLM_MODEL_TYPE=openai
87
+ # LLM_MODEL_TYPE=gpt4all-j
88
+ # LLM_MODEL_TYPE=gpt4all
89
+ # LLM_MODEL_TYPE=llamacpp
90
+ LLM_MODEL_TYPE=huggingface
91
+ # LLM_MODEL_TYPE=mosaicml
92
+ # LLM_MODEL_TYPE=stablelm
93
+ # LLM_MODEL_TYPE=openllm
94
+ # LLM_MODEL_TYPE=hftgi
95
+ ```
96
+
97
+ - By default, the app runs `lmsys/fastchat-t5-3b-v1.0` model with HF Transformers, which works well with most PCs/laptops with 32GB or more RAM, without any GPU. It also works on HF Spaces with their free-tier: 2 vCPU, 16GB RAM and 500GB hard disk, though the inference speed is very slow.
98
+
99
+ - Uncomment/comment the above to play with different LLM types. You may also want to update other related env vars. E.g., here's the list of HF models which have been tested with the code:
100
+
101
+ ```
102
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="databricks/dolly-v2-3b"
103
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="databricks/dolly-v2-7b"
104
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="databricks/dolly-v2-12b"
105
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="TheBloke/wizardLM-7B-HF"
106
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="TheBloke/vicuna-7B-1.1-HF"
107
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="nomic-ai/gpt4all-j"
108
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="nomic-ai/gpt4all-falcon"
109
+ HUGGINGFACE_MODEL_NAME_OR_PATH="lmsys/fastchat-t5-3b-v1.0"
110
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="meta-llama/Llama-2-7b-chat-hf"
111
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="meta-llama/Llama-2-13b-chat-hf"
112
+ # HUGGINGFACE_MODEL_NAME_OR_PATH="meta-llama/Llama-2-70b-chat-hf"
113
+ ```
114
+
115
+ The script `test.sh` automates running different LLMs and records the outputs in `data/logs` folder which currently contains a few log files created by previous test runs on Nvidia GeForce RTX 4090, A40 and L40 GPUs.
app.py ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Main entrypoint for the app."""
2
+ import os
3
+ import time
4
+ from queue import Queue
5
+ from timeit import default_timer as timer
6
+
7
+ import gradio as gr
8
+ from anyio.from_thread import start_blocking_portal
9
+
10
+ from app_modules.init import app_init
11
+ from app_modules.utils import print_llm_response, remove_extra_spaces
12
+
13
+ llm_loader, qa_chain = app_init()
14
+
15
+ show_param_settings = os.environ.get("SHOW_PARAM_SETTINGS") == "true"
16
+ share_gradio_app = os.environ.get("SHARE_GRADIO_APP") == "true"
17
+ using_openai = os.environ.get("LLM_MODEL_TYPE") == "openai"
18
+ chat_history_enabled = os.environ.get("CHAT_HISTORY_ENABLED") == "true"
19
+
20
+ model = (
21
+ "OpenAI GPT-3.5"
22
+ if using_openai
23
+ else os.environ.get("HUGGINGFACE_MODEL_NAME_OR_PATH")
24
+ )
25
+ href = (
26
+ "https://platform.openai.com/docs/models/gpt-3-5"
27
+ if using_openai
28
+ else f"https://huggingface.co/{model}"
29
+ )
30
+
31
+ name = "PCI DSS v4"
32
+
33
+ title = f"""<h1 align="left" style="min-width:200px; margin-top:0;"> Chat with {name} </h1>"""
34
+
35
+ description_top = f"""\
36
+ <div align="left">
37
+ <p> Currently Running: <a href="{href}">{model}</a></p>
38
+ </div>
39
+ """
40
+
41
+ description = """\
42
+ <div align="center" style="margin:16px 0">
43
+ The demo is built on <a href="https://github.com/hwchase17/langchain">LangChain</a>.
44
+ </div>
45
+ """
46
+
47
+ CONCURRENT_COUNT = 1
48
+
49
+
50
+ def qa(chatbot):
51
+ user_msg = chatbot[-1][0]
52
+ q = Queue()
53
+ result = Queue()
54
+ job_done = object()
55
+
56
+ def task(question, chat_history):
57
+ start = timer()
58
+ inputs = {"question": question}
59
+ inputs["chat_history"] = chat_history
60
+ ret = qa_chain.call_chain(inputs, None, q)
61
+ end = timer()
62
+
63
+ print(f"Completed in {end - start:.3f}s")
64
+ print_llm_response(ret)
65
+
66
+ q.put(job_done)
67
+ result.put(ret)
68
+
69
+ with start_blocking_portal() as portal:
70
+ chat_history = []
71
+ if chat_history_enabled:
72
+ for i in range(len(chatbot) - 1):
73
+ element = chatbot[i]
74
+ item = (element[0] or "", element[1] or "")
75
+ chat_history.append(item)
76
+
77
+ portal.start_task_soon(task, user_msg, chat_history)
78
+
79
+ content = ""
80
+ count = 2 if len(chat_history) > 0 else 1
81
+
82
+ while count > 0:
83
+ while q.empty():
84
+ print("nothing generated yet - retry in 0.5s")
85
+ time.sleep(0.5)
86
+
87
+ for next_token in llm_loader.streamer:
88
+ if next_token is job_done:
89
+ break
90
+ content += next_token or ""
91
+ chatbot[-1][1] = remove_extra_spaces(content)
92
+
93
+ if count == 1:
94
+ yield chatbot
95
+
96
+ count -= 1
97
+
98
+ chatbot[-1][1] += "\n\nSources:\n"
99
+ ret = result.get()
100
+ titles = []
101
+ for doc in ret["source_documents"]:
102
+ page = doc.metadata["page"] + 1
103
+ url = f"{doc.metadata['url']}#page={page}"
104
+ file_name = doc.metadata["source"].split("/")[-1]
105
+ title = f"{file_name} Page: {page}"
106
+ if title not in titles:
107
+ titles.append(title)
108
+ chatbot[-1][1] += f"1. [{title}]({url})\n"
109
+
110
+ yield chatbot
111
+
112
+
113
+ with open("assets/custom.css", "r", encoding="utf-8") as f:
114
+ customCSS = f.read()
115
+
116
+ with gr.Blocks(css=customCSS) as demo:
117
+ user_question = gr.State("")
118
+ with gr.Row():
119
+ gr.HTML(title)
120
+ gr.Markdown(description_top)
121
+ with gr.Row(equal_height=True):
122
+ with gr.Column(scale=5):
123
+ with gr.Row():
124
+ chatbot = gr.Chatbot(elem_id="inflaton_chatbot", height="100%")
125
+ with gr.Row():
126
+ with gr.Column(scale=2):
127
+ user_input = gr.Textbox(
128
+ show_label=False,
129
+ placeholder="Enter your question here",
130
+ container=False,
131
+ )
132
+ with gr.Column(
133
+ min_width=70,
134
+ ):
135
+ submitBtn = gr.Button("Send")
136
+ with gr.Column(
137
+ min_width=70,
138
+ ):
139
+ clearBtn = gr.Button("Clear")
140
+ if show_param_settings:
141
+ with gr.Column():
142
+ with gr.Column(
143
+ min_width=50,
144
+ ):
145
+ with gr.Tab(label="Parameter Setting"):
146
+ gr.Markdown("# Parameters")
147
+ top_p = gr.Slider(
148
+ minimum=-0,
149
+ maximum=1.0,
150
+ value=0.95,
151
+ step=0.05,
152
+ # interactive=True,
153
+ label="Top-p",
154
+ )
155
+ temperature = gr.Slider(
156
+ minimum=0.1,
157
+ maximum=2.0,
158
+ value=0,
159
+ step=0.1,
160
+ # interactive=True,
161
+ label="Temperature",
162
+ )
163
+ max_new_tokens = gr.Slider(
164
+ minimum=0,
165
+ maximum=2048,
166
+ value=2048,
167
+ step=8,
168
+ # interactive=True,
169
+ label="Max Generation Tokens",
170
+ )
171
+ max_context_length_tokens = gr.Slider(
172
+ minimum=0,
173
+ maximum=4096,
174
+ value=4096,
175
+ step=128,
176
+ # interactive=True,
177
+ label="Max Context Tokens",
178
+ )
179
+ gr.Markdown(description)
180
+
181
+ def chat(user_message, history):
182
+ return "", history + [[user_message, None]]
183
+
184
+ user_input.submit(
185
+ chat, [user_input, chatbot], [user_input, chatbot], queue=True
186
+ ).then(qa, chatbot, chatbot)
187
+
188
+ submitBtn.click(
189
+ chat, [user_input, chatbot], [user_input, chatbot], queue=True, api_name="chat"
190
+ ).then(qa, chatbot, chatbot)
191
+
192
+ def reset():
193
+ return "", []
194
+
195
+ clearBtn.click(
196
+ reset,
197
+ outputs=[user_input, chatbot],
198
+ show_progress=True,
199
+ api_name="reset",
200
+ )
201
+
202
+ demo.title = "Chat with PCI DSS v4"
203
+ demo.queue().launch(share=share_gradio_app)
app_modules/init.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Main entrypoint for the app."""
2
+ import os
3
+ from timeit import default_timer as timer
4
+ from typing import List, Optional
5
+
6
+ from dotenv import find_dotenv, load_dotenv
7
+ from langchain_community.embeddings import HuggingFaceInstructEmbeddings
8
+ from langchain.vectorstores.chroma import Chroma
9
+ from langchain.vectorstores.faiss import FAISS
10
+
11
+ from app_modules.llm_loader import LLMLoader
12
+ from app_modules.llm_qa_chain import QAChain
13
+ from app_modules.utils import get_device_types, init_settings
14
+
15
+ found_dotenv = find_dotenv(".env")
16
+
17
+ if len(found_dotenv) == 0:
18
+ found_dotenv = find_dotenv(".env.example")
19
+ print(f"loading env vars from: {found_dotenv}")
20
+ load_dotenv(found_dotenv, override=False)
21
+
22
+ # Constants
23
+ init_settings()
24
+
25
+ if os.environ.get("LANGCHAIN_DEBUG") == "true":
26
+ import langchain
27
+
28
+ langchain.debug = True
29
+
30
+
31
+ def app_init():
32
+ # https://github.com/huggingface/transformers/issues/17611
33
+ os.environ["CURL_CA_BUNDLE"] = ""
34
+
35
+ hf_embeddings_device_type, hf_pipeline_device_type = get_device_types()
36
+ print(f"hf_embeddings_device_type: {hf_embeddings_device_type}")
37
+ print(f"hf_pipeline_device_type: {hf_pipeline_device_type}")
38
+
39
+ hf_embeddings_model_name = (
40
+ os.environ.get("HF_EMBEDDINGS_MODEL_NAME") or "hkunlp/instructor-xl"
41
+ )
42
+
43
+ n_threds = int(os.environ.get("NUMBER_OF_CPU_CORES") or "4")
44
+ index_path = os.environ.get("FAISS_INDEX_PATH") or os.environ.get(
45
+ "CHROMADB_INDEX_PATH"
46
+ )
47
+ using_faiss = os.environ.get("FAISS_INDEX_PATH") is not None
48
+ llm_model_type = os.environ.get("LLM_MODEL_TYPE")
49
+
50
+ start = timer()
51
+ embeddings = HuggingFaceInstructEmbeddings(
52
+ model_name=hf_embeddings_model_name,
53
+ model_kwargs={"device": hf_embeddings_device_type},
54
+ )
55
+ end = timer()
56
+
57
+ print(f"Completed in {end - start:.3f}s")
58
+
59
+ start = timer()
60
+
61
+ print(f"Load index from {index_path} with {'FAISS' if using_faiss else 'Chroma'}")
62
+
63
+ if not os.path.isdir(index_path):
64
+ raise ValueError(f"{index_path} does not exist!")
65
+ elif using_faiss:
66
+ vectorstore = FAISS.load_local(index_path, embeddings)
67
+ else:
68
+ vectorstore = Chroma(
69
+ embedding_function=embeddings, persist_directory=index_path
70
+ )
71
+
72
+ end = timer()
73
+
74
+ print(f"Completed in {end - start:.3f}s")
75
+
76
+ start = timer()
77
+ llm_loader = LLMLoader(llm_model_type)
78
+ llm_loader.init(n_threds=n_threds, hf_pipeline_device_type=hf_pipeline_device_type)
79
+ qa_chain = QAChain(vectorstore, llm_loader)
80
+ end = timer()
81
+ print(f"Completed in {end - start:.3f}s")
82
+
83
+ return llm_loader, qa_chain
app_modules/llm_inference.py ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import abc
2
+ import os
3
+ import time
4
+ import urllib
5
+ from queue import Queue
6
+ from threading import Thread
7
+ from typing import List, Optional
8
+ from urllib.parse import quote, urlparse, urlunparse
9
+
10
+ from langchain.chains.base import Chain
11
+
12
+ from app_modules.llm_loader import LLMLoader, TextIteratorStreamer
13
+ from app_modules.utils import remove_extra_spaces
14
+
15
+
16
+ class LLMInference(metaclass=abc.ABCMeta):
17
+ def __init__(self, llm_loader):
18
+ self.llm_loader = llm_loader
19
+ self.chain = None
20
+
21
+ @abc.abstractmethod
22
+ def create_chain(self) -> Chain:
23
+ pass
24
+
25
+ def get_chain(self) -> Chain:
26
+ if self.chain is None:
27
+ self.chain = self.create_chain()
28
+
29
+ return self.chain
30
+
31
+ def run_chain(self, chain, inputs, callbacks: Optional[List] = []):
32
+ result = chain.invoke(inputs, {"callbacks": callbacks})
33
+ if "text" in result:
34
+ result["response"] = result["text"]
35
+ del result["text"]
36
+ return result
37
+
38
+ def call_chain(
39
+ self,
40
+ inputs,
41
+ streaming_handler,
42
+ q: Queue = None,
43
+ testing: bool = False,
44
+ ):
45
+ print(inputs)
46
+ if self.llm_loader.streamer.for_huggingface:
47
+ self.llm_loader.lock.acquire()
48
+
49
+ try:
50
+ self.llm_loader.streamer.reset(q)
51
+
52
+ chain = self.get_chain()
53
+ result = (
54
+ self._run_chain_with_streaming_handler(
55
+ chain, inputs, streaming_handler, testing
56
+ )
57
+ if streaming_handler is not None
58
+ else self.run_chain(chain, inputs)
59
+ )
60
+
61
+ if "answer" in result:
62
+ result["answer"] = remove_extra_spaces(result["answer"])
63
+
64
+ source_path = os.environ.get("SOURCE_PATH")
65
+ base_url = os.environ.get("PDF_FILE_BASE_URL")
66
+ if base_url is not None and len(base_url) > 0:
67
+ documents = result["source_documents"]
68
+ for doc in documents:
69
+ source = doc.metadata["source"]
70
+ title = source.split("/")[-1]
71
+ doc.metadata["url"] = f"{base_url}{urllib.parse.quote(title)}"
72
+ elif source_path is not None and len(source_path) > 0:
73
+ documents = result["source_documents"]
74
+ for doc in documents:
75
+ source = doc.metadata["source"]
76
+ url = source.replace(source_path, "https://")
77
+ url = url.replace(".html", "")
78
+ parsed_url = urlparse(url)
79
+
80
+ # Encode path, query, and fragment
81
+ encoded_path = quote(parsed_url.path)
82
+ encoded_query = quote(parsed_url.query)
83
+ encoded_fragment = quote(parsed_url.fragment)
84
+
85
+ # Construct the encoded URL
86
+ doc.metadata["url"] = urlunparse(
87
+ (
88
+ parsed_url.scheme,
89
+ parsed_url.netloc,
90
+ encoded_path,
91
+ parsed_url.params,
92
+ encoded_query,
93
+ encoded_fragment,
94
+ )
95
+ )
96
+
97
+ return result
98
+ finally:
99
+ if self.llm_loader.streamer.for_huggingface:
100
+ self.llm_loader.lock.release()
101
+
102
+ def _execute_chain(self, chain, inputs, q, sh):
103
+ q.put(self.run_chain(chain, inputs, callbacks=[sh]))
104
+
105
+ def _run_chain_with_streaming_handler(
106
+ self, chain, inputs, streaming_handler, testing
107
+ ):
108
+ que = Queue()
109
+
110
+ t = Thread(
111
+ target=self._execute_chain,
112
+ args=(chain, inputs, que, streaming_handler),
113
+ )
114
+ t.start()
115
+
116
+ if self.llm_loader.streamer.for_huggingface:
117
+ count = (
118
+ 2
119
+ if "chat_history" in inputs and len(inputs.get("chat_history")) > 0
120
+ else 1
121
+ )
122
+
123
+ while count > 0:
124
+ try:
125
+ for token in self.llm_loader.streamer:
126
+ if not testing:
127
+ streaming_handler.on_llm_new_token(token)
128
+
129
+ self.llm_loader.streamer.reset()
130
+ count -= 1
131
+ except Exception:
132
+ if not testing:
133
+ print("nothing generated yet - retry in 0.5s")
134
+ time.sleep(0.5)
135
+
136
+ t.join()
137
+ return que.get()
app_modules/llm_loader.py ADDED
@@ -0,0 +1,648 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ import threading
4
+ from queue import Queue
5
+ from typing import Any, Optional
6
+
7
+ import torch
8
+ from langchain.callbacks.base import BaseCallbackHandler
9
+ from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
10
+ from langchain_openai.chat_models import ChatOpenAI
11
+ from langchain_openai.llms import OpenAI
12
+ from langchain_community.llms import (
13
+ HuggingFaceTextGenInference,
14
+ CTransformers,
15
+ GPT4All,
16
+ HuggingFacePipeline,
17
+ LlamaCpp,
18
+ )
19
+ from langchain.schema import LLMResult
20
+ from transformers import (
21
+ AutoConfig,
22
+ AutoModelForCausalLM,
23
+ AutoModelForSeq2SeqLM,
24
+ AutoTokenizer,
25
+ BitsAndBytesConfig,
26
+ StoppingCriteria,
27
+ StoppingCriteriaList,
28
+ T5Tokenizer,
29
+ TextStreamer,
30
+ pipeline,
31
+ )
32
+
33
+ from app_modules.utils import ensure_model_is_downloaded
34
+
35
+
36
+ class TextIteratorStreamer(TextStreamer, StreamingStdOutCallbackHandler):
37
+ def __init__(
38
+ self,
39
+ tokenizer: "AutoTokenizer",
40
+ skip_prompt: bool = False,
41
+ timeout: Optional[float] = None,
42
+ for_huggingface: bool = False,
43
+ **decode_kwargs,
44
+ ):
45
+ super().__init__(tokenizer, skip_prompt, **decode_kwargs)
46
+ self.text_queue = Queue()
47
+ self.stop_signal = None
48
+ self.timeout = timeout
49
+ self.total_tokens = 0
50
+ self.for_huggingface = for_huggingface
51
+
52
+ def on_finalized_text(self, text: str, stream_end: bool = False):
53
+ super().on_finalized_text(text, stream_end=stream_end)
54
+
55
+ """Put the new text in the queue. If the stream is ending, also put a stop signal in the queue."""
56
+ self.text_queue.put(text, timeout=self.timeout)
57
+ self.total_tokens = self.total_tokens + 1
58
+ if stream_end:
59
+ print("\n")
60
+ self.text_queue.put("\n", timeout=self.timeout)
61
+ self.text_queue.put(self.stop_signal, timeout=self.timeout)
62
+
63
+ def on_llm_new_token(self, token: str, **kwargs: Any) -> None:
64
+ sys.stdout.write(token)
65
+ sys.stdout.flush()
66
+ self.text_queue.put(token, timeout=self.timeout)
67
+ self.total_tokens = self.total_tokens + 1
68
+
69
+ def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None:
70
+ print("\n")
71
+ self.text_queue.put("\n", timeout=self.timeout)
72
+ self.text_queue.put(self.stop_signal, timeout=self.timeout)
73
+
74
+ def __iter__(self):
75
+ return self
76
+
77
+ def __next__(self):
78
+ value = self.text_queue.get(timeout=self.timeout)
79
+ if value == self.stop_signal:
80
+ raise StopIteration()
81
+ else:
82
+ return value
83
+
84
+ def reset(self, q: Queue = None):
85
+ # print("resetting TextIteratorStreamer")
86
+ self.text_queue = q if q is not None else Queue()
87
+
88
+ def empty(self):
89
+ return self.text_queue.empty()
90
+
91
+
92
+ class LLMLoader:
93
+ def __init__(self, llm_model_type):
94
+ self.llm_model_type = llm_model_type
95
+ self.llm = None
96
+ self.streamer = TextIteratorStreamer(
97
+ "",
98
+ for_huggingface=True,
99
+ )
100
+ self.max_tokens_limit = 2048
101
+ self.search_kwargs = {"k": 4}
102
+ self.lock = threading.Lock()
103
+
104
+ def _init_hf_streamer(self, tokenizer):
105
+ self.streamer = TextIteratorStreamer(
106
+ tokenizer,
107
+ timeout=10.0,
108
+ skip_prompt=True,
109
+ skip_special_tokens=True,
110
+ for_huggingface=True,
111
+ )
112
+
113
+ def init(
114
+ self,
115
+ custom_handler: Optional[BaseCallbackHandler] = None,
116
+ n_threds: int = 4,
117
+ hf_pipeline_device_type: str = None,
118
+ ):
119
+ print("initializing LLM: " + self.llm_model_type)
120
+
121
+ if hf_pipeline_device_type is None:
122
+ hf_pipeline_device_type = "cpu"
123
+
124
+ using_cuda = hf_pipeline_device_type.startswith("cuda")
125
+ torch_dtype = torch.float16 if using_cuda else torch.float32
126
+ if os.environ.get("USING_TORCH_BFLOAT16") == "true":
127
+ torch_dtype = torch.bfloat16
128
+ load_quantized_model = os.environ.get("LOAD_QUANTIZED_MODEL")
129
+
130
+ print(f" hf_pipeline_device_type: {hf_pipeline_device_type}")
131
+ print(f" load_quantized_model: {load_quantized_model}")
132
+ print(f" torch_dtype: {torch_dtype}")
133
+ print(f" n_threds: {n_threds}")
134
+
135
+ torch.set_default_dtype(torch_dtype)
136
+
137
+ double_quant_config = BitsAndBytesConfig(
138
+ load_in_4bit=load_quantized_model == "4bit",
139
+ bnb_4bit_use_double_quant=load_quantized_model == "4bit",
140
+ load_in_8bit=load_quantized_model == "8bit",
141
+ bnb_8bit_use_double_quant=load_quantized_model == "8bit",
142
+ )
143
+
144
+ callbacks = []
145
+ if self.streamer is not None:
146
+ callbacks.append(self.streamer)
147
+ if custom_handler is not None:
148
+ callbacks.append(custom_handler)
149
+
150
+ if self.llm is None:
151
+ if self.llm_model_type == "openai":
152
+ MODEL_NAME = os.environ.get("OPENAI_MODEL_NAME") or "gpt-3.5-turbo"
153
+ print(f" using model: {MODEL_NAME}")
154
+ self.llm = (
155
+ OpenAI(
156
+ model_name=MODEL_NAME,
157
+ streaming=True,
158
+ callbacks=callbacks,
159
+ verbose=True,
160
+ temperature=0,
161
+ )
162
+ if "instruct" in MODEL_NAME
163
+ else ChatOpenAI(
164
+ model_name=MODEL_NAME,
165
+ streaming=True,
166
+ callbacks=callbacks,
167
+ verbose=True,
168
+ temperature=0,
169
+ )
170
+ )
171
+ elif self.llm_model_type.startswith("gpt4all"):
172
+ MODEL_PATH = ensure_model_is_downloaded(self.llm_model_type)
173
+ self.llm = GPT4All(
174
+ model=MODEL_PATH,
175
+ max_tokens=2048,
176
+ n_threads=n_threds,
177
+ backend="gptj" if self.llm_model_type == "gpt4all-j" else "llama",
178
+ callbacks=callbacks,
179
+ verbose=True,
180
+ use_mlock=True,
181
+ )
182
+ elif self.llm_model_type == "llamacpp":
183
+ MODEL_PATH = ensure_model_is_downloaded(self.llm_model_type)
184
+ self.llm = LlamaCpp(
185
+ model_path=MODEL_PATH,
186
+ n_ctx=8192,
187
+ n_threads=n_threds,
188
+ seed=0,
189
+ temperature=0,
190
+ max_tokens=2048,
191
+ callbacks=callbacks,
192
+ verbose=True,
193
+ use_mlock=True,
194
+ )
195
+ elif self.llm_model_type == "ctransformers":
196
+ MODEL_PATH = ensure_model_is_downloaded(self.llm_model_type)
197
+ config = {
198
+ "max_new_tokens": self.max_tokens_limit,
199
+ "repetition_penalty": 1.1,
200
+ }
201
+ self.llm = CTransformers(
202
+ model=MODEL_PATH,
203
+ model_type="llama",
204
+ config=config,
205
+ callbacks=callbacks,
206
+ )
207
+ elif self.llm_model_type == "hftgi":
208
+ HFTGI_SERVER_URL = os.environ.get("HFTGI_SERVER_URL")
209
+ HFTGI_RP = os.environ.get("HFTGI_RP")
210
+ repetition_penalty = 1.120 if HFTGI_RP is None else float(HFTGI_RP)
211
+ print(f" repetition_penalty: {repetition_penalty}")
212
+ self.max_tokens_limit = 4096
213
+ self.llm = HuggingFaceTextGenInference(
214
+ inference_server_url=HFTGI_SERVER_URL,
215
+ max_new_tokens=self.max_tokens_limit / 2,
216
+ # top_k=0,
217
+ top_p=0.95,
218
+ # typical_p=0.95,
219
+ temperature=0.01,
220
+ repetition_penalty=repetition_penalty,
221
+ callbacks=callbacks,
222
+ timeout=600,
223
+ streaming=True,
224
+ )
225
+ elif self.llm_model_type.startswith("huggingface"):
226
+ MODEL_NAME_OR_PATH = os.environ.get("HUGGINGFACE_MODEL_NAME_OR_PATH")
227
+ print(f" loading model: {MODEL_NAME_OR_PATH}")
228
+
229
+ hf_auth_token = (
230
+ os.environ.get("HUGGINGFACE_AUTH_TOKEN")
231
+ if "Llama-2" in MODEL_NAME_OR_PATH
232
+ else None
233
+ )
234
+ transformers_offline = os.environ.get("TRANSFORMERS_OFFLINE") == "1"
235
+ token = (
236
+ hf_auth_token
237
+ if hf_auth_token is not None
238
+ and len(hf_auth_token) > 0
239
+ and not transformers_offline
240
+ else None
241
+ )
242
+ print(f" HF auth token: {str(token)[-5:]}")
243
+
244
+ if "Llama-2" in MODEL_NAME_OR_PATH:
245
+ self.max_tokens_limit = 4096
246
+
247
+ is_t5 = "t5" in MODEL_NAME_OR_PATH
248
+ temperature = (
249
+ 0.01
250
+ if "gpt4all-j" in MODEL_NAME_OR_PATH
251
+ or "dolly" in MODEL_NAME_OR_PATH
252
+ or "Qwen" in MODEL_NAME_OR_PATH
253
+ or "Llama-2" in MODEL_NAME_OR_PATH
254
+ or "Orca-2" in MODEL_NAME_OR_PATH
255
+ or "phi-2" in MODEL_NAME_OR_PATH
256
+ else 0
257
+ )
258
+ use_fast = (
259
+ "stable" in MODEL_NAME_OR_PATH
260
+ or "RedPajama" in MODEL_NAME_OR_PATH
261
+ or "dolly" in MODEL_NAME_OR_PATH
262
+ )
263
+ padding_side = "left" # if "dolly" in MODEL_NAME_OR_PATH else None
264
+
265
+ config = (
266
+ AutoConfig.from_pretrained(
267
+ MODEL_NAME_OR_PATH,
268
+ trust_remote_code=True,
269
+ token=token,
270
+ fp32=hf_pipeline_device_type == "cpu",
271
+ bf16=(
272
+ hf_pipeline_device_type != "cpu"
273
+ and torch_dtype == torch.bfloat16
274
+ ),
275
+ fp16=(
276
+ hf_pipeline_device_type != "cpu"
277
+ and torch_dtype != torch.bfloat16
278
+ ),
279
+ )
280
+ if "Qwen" in MODEL_NAME_OR_PATH
281
+ else AutoConfig.from_pretrained(
282
+ MODEL_NAME_OR_PATH,
283
+ trust_remote_code=True,
284
+ token=token,
285
+ )
286
+ )
287
+
288
+ # config.attn_config["attn_impl"] = "triton"
289
+ # config.max_seq_len = 4096
290
+ config.init_device = hf_pipeline_device_type
291
+
292
+ tokenizer = (
293
+ T5Tokenizer.from_pretrained(
294
+ MODEL_NAME_OR_PATH,
295
+ token=token,
296
+ )
297
+ if is_t5
298
+ else AutoTokenizer.from_pretrained(
299
+ MODEL_NAME_OR_PATH,
300
+ use_fast=use_fast,
301
+ trust_remote_code=True,
302
+ padding_side=padding_side,
303
+ token=token,
304
+ )
305
+ )
306
+
307
+ self._init_hf_streamer(tokenizer)
308
+
309
+ task = "text2text-generation" if is_t5 else "text-generation"
310
+
311
+ return_full_text = True if "dolly" in MODEL_NAME_OR_PATH else None
312
+
313
+ repetition_penalty = (
314
+ 1.15
315
+ if "falcon" in MODEL_NAME_OR_PATH
316
+ else (1.25 if "dolly" in MODEL_NAME_OR_PATH else 1.1)
317
+ )
318
+
319
+ HF_RP = os.environ.get("HF_RP")
320
+ if HF_RP is not None and len(HF_RP) > 0:
321
+ repetition_penalty = float(HF_RP)
322
+ print(f" repetition_penalty: {repetition_penalty}")
323
+
324
+ if load_quantized_model is not None:
325
+ model = (
326
+ AutoModelForSeq2SeqLM.from_pretrained(
327
+ MODEL_NAME_OR_PATH,
328
+ config=config,
329
+ quantization_config=double_quant_config,
330
+ trust_remote_code=True,
331
+ use_auth_token=token,
332
+ )
333
+ if is_t5
334
+ else AutoModelForCausalLM.from_pretrained(
335
+ MODEL_NAME_OR_PATH,
336
+ config=config,
337
+ quantization_config=double_quant_config,
338
+ trust_remote_code=True,
339
+ use_auth_token=token,
340
+ )
341
+ )
342
+
343
+ print(f"Model memory footprint: {model.get_memory_footprint()}")
344
+
345
+ eos_token_id = -1
346
+ # starchat-beta uses a special <|end|> token with ID 49155 to denote ends of a turn
347
+ if "starchat" in MODEL_NAME_OR_PATH:
348
+ eos_token_id = 49155
349
+ pad_token_id = eos_token_id
350
+
351
+ pipe = (
352
+ pipeline(
353
+ task,
354
+ model=model,
355
+ tokenizer=tokenizer,
356
+ eos_token_id=eos_token_id,
357
+ pad_token_id=pad_token_id,
358
+ streamer=self.streamer,
359
+ return_full_text=return_full_text, # langchain expects the full text
360
+ device_map="auto",
361
+ trust_remote_code=True,
362
+ max_new_tokens=2048,
363
+ do_sample=True,
364
+ temperature=0.01,
365
+ top_p=0.95,
366
+ top_k=50,
367
+ repetition_penalty=repetition_penalty,
368
+ )
369
+ if eos_token_id != -1
370
+ else pipeline(
371
+ task,
372
+ model=model,
373
+ tokenizer=tokenizer,
374
+ streamer=self.streamer,
375
+ return_full_text=return_full_text, # langchain expects the full text
376
+ device_map="auto",
377
+ trust_remote_code=True,
378
+ max_new_tokens=2048,
379
+ do_sample=True,
380
+ temperature=temperature,
381
+ top_p=0.95,
382
+ top_k=0, # select from top 0 tokens (because zero, relies on top_p)
383
+ repetition_penalty=repetition_penalty,
384
+ )
385
+ )
386
+ else:
387
+ if os.environ.get("DISABLE_MODEL_PRELOADING") != "true":
388
+ model = (
389
+ AutoModelForSeq2SeqLM.from_pretrained(
390
+ MODEL_NAME_OR_PATH,
391
+ config=config,
392
+ trust_remote_code=True,
393
+ )
394
+ if is_t5
395
+ else (
396
+ AutoModelForCausalLM.from_pretrained(
397
+ MODEL_NAME_OR_PATH,
398
+ config=config,
399
+ trust_remote_code=True,
400
+ )
401
+ if "Qwen" in MODEL_NAME_OR_PATH
402
+ else (
403
+ AutoModelForCausalLM.from_pretrained(
404
+ MODEL_NAME_OR_PATH,
405
+ config=config,
406
+ trust_remote_code=True,
407
+ )
408
+ if token is None
409
+ else AutoModelForCausalLM.from_pretrained(
410
+ MODEL_NAME_OR_PATH,
411
+ config=config,
412
+ trust_remote_code=True,
413
+ token=token,
414
+ )
415
+ )
416
+ )
417
+ )
418
+ print(f"Model memory footprint: {model.get_memory_footprint()}")
419
+ model = model.eval()
420
+ # print(f"Model memory footprint: {model.get_memory_footprint()}")
421
+ else:
422
+ model = MODEL_NAME_OR_PATH
423
+
424
+ pipe = (
425
+ pipeline(
426
+ task,
427
+ model=model,
428
+ tokenizer=tokenizer,
429
+ streamer=self.streamer,
430
+ return_full_text=return_full_text, # langchain expects the full text
431
+ device=hf_pipeline_device_type,
432
+ torch_dtype=torch_dtype,
433
+ max_new_tokens=2048,
434
+ trust_remote_code=True,
435
+ do_sample=True,
436
+ temperature=temperature,
437
+ top_p=0.95,
438
+ top_k=0, # select from top 0 tokens (because zero, relies on top_p)
439
+ repetition_penalty=repetition_penalty,
440
+ )
441
+ if token is None
442
+ else pipeline(
443
+ task,
444
+ model=model,
445
+ tokenizer=tokenizer,
446
+ streamer=self.streamer,
447
+ return_full_text=return_full_text, # langchain expects the full text
448
+ device=hf_pipeline_device_type,
449
+ torch_dtype=torch_dtype,
450
+ max_new_tokens=2048,
451
+ trust_remote_code=True,
452
+ temperature=temperature,
453
+ top_p=0.95,
454
+ top_k=0, # select from top 0 tokens (because zero, relies on top_p)
455
+ repetition_penalty=repetition_penalty,
456
+ token=token,
457
+ )
458
+ )
459
+
460
+ pipe.model.config.pad_token_id = pipe.model.config.eos_token_id
461
+ self.llm = HuggingFacePipeline(pipeline=pipe, callbacks=callbacks)
462
+ elif self.llm_model_type == "mosaicml":
463
+ MODEL_NAME_OR_PATH = os.environ.get("MOSAICML_MODEL_NAME_OR_PATH")
464
+ print(f" loading model: {MODEL_NAME_OR_PATH}")
465
+
466
+ config = AutoConfig.from_pretrained(
467
+ MODEL_NAME_OR_PATH, trust_remote_code=True
468
+ )
469
+ # config.attn_config["attn_impl"] = "triton"
470
+ config.max_seq_len = 16384 if "30b" in MODEL_NAME_OR_PATH else 4096
471
+ config.init_device = hf_pipeline_device_type
472
+
473
+ model = (
474
+ AutoModelForCausalLM.from_pretrained(
475
+ MODEL_NAME_OR_PATH,
476
+ config=config,
477
+ quantization_config=double_quant_config,
478
+ trust_remote_code=True,
479
+ )
480
+ if load_quantized_model is not None
481
+ else AutoModelForCausalLM.from_pretrained(
482
+ MODEL_NAME_OR_PATH,
483
+ config=config,
484
+ torch_dtype=torch_dtype,
485
+ trust_remote_code=True,
486
+ )
487
+ )
488
+
489
+ print(f"Model loaded on {config.init_device}")
490
+ print(f"Model memory footprint: {model.get_memory_footprint()}")
491
+
492
+ tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
493
+ self._init_hf_streamer(tokenizer)
494
+
495
+ # mtp-7b is trained to add "<|endoftext|>" at the end of generations
496
+ stop_token_ids = tokenizer.convert_tokens_to_ids(["<|endoftext|>"])
497
+
498
+ # define custom stopping criteria object
499
+ class StopOnTokens(StoppingCriteria):
500
+ def __call__(
501
+ self,
502
+ input_ids: torch.LongTensor,
503
+ scores: torch.FloatTensor,
504
+ **kwargs,
505
+ ) -> bool:
506
+ for stop_id in stop_token_ids:
507
+ if input_ids[0][-1] == stop_id:
508
+ return True
509
+ return False
510
+
511
+ stopping_criteria = StoppingCriteriaList([StopOnTokens()])
512
+
513
+ max_new_tokens = 8192 if "30b" in MODEL_NAME_OR_PATH else 2048
514
+ self.max_tokens_limit = max_new_tokens
515
+ repetition_penalty = 1.05 if "30b" in MODEL_NAME_OR_PATH else 1.02
516
+
517
+ ML_RP = os.environ.get("ML_RP")
518
+ if ML_RP is not None and len(ML_RP) > 0:
519
+ repetition_penalty = float(ML_RP)
520
+ print(f" repetition_penalty: {repetition_penalty}")
521
+
522
+ pipe = (
523
+ pipeline(
524
+ model=model,
525
+ tokenizer=tokenizer,
526
+ streamer=self.streamer,
527
+ return_full_text=True, # langchain expects the full text
528
+ task="text-generation",
529
+ device_map="auto",
530
+ # we pass model parameters here too
531
+ stopping_criteria=stopping_criteria, # without this model will ramble
532
+ do_sample=True,
533
+ temperature=0.01, # 'randomness' of outputs, 0.0 is the min and 1.0 the max
534
+ top_p=0.95, # select from top tokens whose probability add up to 15%
535
+ top_k=0, # select from top 0 tokens (because zero, relies on top_p)
536
+ max_new_tokens=max_new_tokens, # mex number of tokens to generate in the output
537
+ repetition_penalty=repetition_penalty, # without this output begins repeating
538
+ )
539
+ if load_quantized_model is not None
540
+ else pipeline(
541
+ model=model,
542
+ tokenizer=tokenizer,
543
+ streamer=self.streamer,
544
+ return_full_text=True, # langchain expects the full text
545
+ task="text-generation",
546
+ device=config.init_device,
547
+ # we pass model parameters here too
548
+ stopping_criteria=stopping_criteria, # without this model will ramble
549
+ do_sample=True,
550
+ temperature=0.01, # 'randomness' of outputs, 0.0 is the min and 1.0 the max
551
+ top_p=0.95, # select from top tokens whose probability add up to 15%
552
+ top_k=0, # select from top 0 tokens (because zero, relies on top_p)
553
+ max_new_tokens=max_new_tokens, # mex number of tokens to generate in the output
554
+ repetition_penalty=repetition_penalty, # without this output begins repeating
555
+ )
556
+ )
557
+ self.llm = HuggingFacePipeline(pipeline=pipe, callbacks=callbacks)
558
+ elif self.llm_model_type == "stablelm":
559
+ MODEL_NAME_OR_PATH = os.environ.get("STABLELM_MODEL_NAME_OR_PATH")
560
+ print(f" loading model: {MODEL_NAME_OR_PATH}")
561
+
562
+ config = AutoConfig.from_pretrained(
563
+ MODEL_NAME_OR_PATH, trust_remote_code=True
564
+ )
565
+ # config.attn_config["attn_impl"] = "triton"
566
+ # config.max_seq_len = 4096
567
+ config.init_device = hf_pipeline_device_type
568
+
569
+ SL_RP = os.environ.get("SL_RP")
570
+ if SL_RP is not None and len(SL_RP) > 0:
571
+ repetition_penalty = float(SL_RP)
572
+ else:
573
+ repetition_penalty = 1.05
574
+ print(f" repetition_penalty: {repetition_penalty}")
575
+
576
+ model = (
577
+ AutoModelForCausalLM.from_pretrained(
578
+ MODEL_NAME_OR_PATH,
579
+ config=config,
580
+ quantization_config=double_quant_config,
581
+ trust_remote_code=True,
582
+ )
583
+ if load_quantized_model is not None
584
+ else AutoModelForCausalLM.from_pretrained(
585
+ MODEL_NAME_OR_PATH,
586
+ config=config,
587
+ torch_dtype=torch_dtype,
588
+ trust_remote_code=True,
589
+ )
590
+ )
591
+
592
+ print(f"Model loaded on {config.init_device}")
593
+ print(f"Model memory footprint: {model.get_memory_footprint()}")
594
+
595
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME_OR_PATH)
596
+ self._init_hf_streamer(tokenizer)
597
+
598
+ class StopOnTokens(StoppingCriteria):
599
+ def __call__(
600
+ self,
601
+ input_ids: torch.LongTensor,
602
+ scores: torch.FloatTensor,
603
+ **kwargs,
604
+ ) -> bool:
605
+ stop_ids = [50278, 50279, 50277, 1, 0]
606
+ for stop_id in stop_ids:
607
+ if input_ids[0][-1] == stop_id:
608
+ return True
609
+ return False
610
+
611
+ stopping_criteria = StoppingCriteriaList([StopOnTokens()])
612
+
613
+ pipe = (
614
+ pipeline(
615
+ model=model,
616
+ tokenizer=tokenizer,
617
+ streamer=self.streamer,
618
+ return_full_text=True, # langchain expects the full text
619
+ task="text-generation",
620
+ device_map="auto",
621
+ # we pass model parameters here too
622
+ stopping_criteria=stopping_criteria, # without this model will ramble
623
+ temperature=0, # 'randomness' of outputs, 0.0 is the min and 1.0 the max
624
+ top_p=0.95, # select from top tokens whose probability add up to 15%
625
+ top_k=0, # select from top 0 tokens (because zero, relies on top_p)
626
+ max_new_tokens=2048, # mex number of tokens to generate in the output
627
+ repetition_penalty=repetition_penalty, # without this output begins repeating
628
+ )
629
+ if load_quantized_model is not None
630
+ else pipeline(
631
+ model=model,
632
+ tokenizer=tokenizer,
633
+ streamer=self.streamer,
634
+ return_full_text=True, # langchain expects the full text
635
+ task="text-generation",
636
+ device=config.init_device,
637
+ # we pass model parameters here too
638
+ stopping_criteria=stopping_criteria, # without this model will ramble
639
+ temperature=0, # 'randomness' of outputs, 0.0 is the min and 1.0 the max
640
+ top_p=0.95, # select from top tokens whose probability add up to 15%
641
+ top_k=0, # select from top 0 tokens (because zero, relies on top_p)
642
+ max_new_tokens=2048, # mex number of tokens to generate in the output
643
+ repetition_penalty=repetition_penalty, # without this output begins repeating
644
+ )
645
+ )
646
+ self.llm = HuggingFacePipeline(pipeline=pipe, callbacks=callbacks)
647
+
648
+ print("initialization complete")
app_modules/llm_qa_chain.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.chains import ConversationalRetrievalChain
2
+ from langchain.chains.base import Chain
3
+
4
+ from app_modules.llm_inference import LLMInference
5
+
6
+
7
+ class QAChain(LLMInference):
8
+ def __init__(self, vectorstore, llm_loader):
9
+ super().__init__(llm_loader)
10
+ self.vectorstore = vectorstore
11
+
12
+ def create_chain(self) -> Chain:
13
+ qa = ConversationalRetrievalChain.from_llm(
14
+ self.llm_loader.llm,
15
+ self.vectorstore.as_retriever(search_kwargs=self.llm_loader.search_kwargs),
16
+ max_tokens_limit=self.llm_loader.max_tokens_limit,
17
+ return_source_documents=True,
18
+ )
19
+
20
+ return qa
app_modules/utils.py ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding:utf-8 -*-
2
+ from __future__ import annotations
3
+
4
+ import logging
5
+ import os
6
+ import platform
7
+ import re
8
+ from pathlib import Path
9
+
10
+ import requests
11
+ import torch
12
+ from tqdm import tqdm
13
+
14
+
15
+ class LogRecord(logging.LogRecord):
16
+ def getMessage(self):
17
+ msg = self.msg
18
+ if self.args:
19
+ if isinstance(self.args, dict):
20
+ msg = msg.format(**self.args)
21
+ else:
22
+ msg = msg.format(*self.args)
23
+ return msg
24
+
25
+
26
+ class Logger(logging.Logger):
27
+ def makeRecord(
28
+ self,
29
+ name,
30
+ level,
31
+ fn,
32
+ lno,
33
+ msg,
34
+ args,
35
+ exc_info,
36
+ func=None,
37
+ extra=None,
38
+ sinfo=None,
39
+ ):
40
+ rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func, sinfo)
41
+ if extra is not None:
42
+ for key in extra:
43
+ rv.__dict__[key] = extra[key]
44
+ return rv
45
+
46
+
47
+ def init_settings():
48
+ logging.setLoggerClass(Logger)
49
+ logging.basicConfig(
50
+ level=logging.WARNING,
51
+ format="%(asctime)s [%(levelname)s] [%(filename)s:%(lineno)d] %(message)s",
52
+ )
53
+
54
+
55
+ def remove_extra_spaces(text):
56
+ return re.sub(" +", " ", text.strip())
57
+
58
+
59
+ def print_llm_response(llm_response):
60
+ answer = llm_response["answer"] if "answer" in llm_response else None
61
+ if answer is None:
62
+ answer = llm_response["token"] if "token" in llm_response else None
63
+
64
+ if answer is not None:
65
+ print("\n\n***Answer:")
66
+ print(answer)
67
+
68
+ source_documents = (
69
+ llm_response["source_documents"] if "source_documents" in llm_response else None
70
+ )
71
+ if source_documents is None:
72
+ source_documents = llm_response["sourceDocs"]
73
+
74
+ print("\nSources:")
75
+ for source in source_documents:
76
+ metadata = source["metadata"] if "metadata" in source else source.metadata
77
+ if "page" in metadata:
78
+ print(f" Page: {metadata['page']}", end="")
79
+
80
+ print(
81
+ " Source: "
82
+ + str(metadata["url"] if "url" in metadata else metadata["source"])
83
+ )
84
+ print(
85
+ source["page_content"] if "page_content" in source else source.page_content
86
+ )
87
+
88
+
89
+ def get_device_types():
90
+ print("Running on: ", platform.platform())
91
+ print("MPS is", "NOT" if not torch.backends.mps.is_available() else "", "available")
92
+ print("CUDA is", "NOT" if not torch.cuda.is_available() else "", "available")
93
+ device_type_available = "cpu"
94
+
95
+ if not torch.backends.mps.is_available():
96
+ if not torch.backends.mps.is_built():
97
+ print(
98
+ "MPS not available because the current PyTorch install was not "
99
+ "built with MPS enabled."
100
+ )
101
+ else:
102
+ print(
103
+ "MPS not available because the current MacOS version is not 12.3+ "
104
+ "and/or you do not have an MPS-enabled device on this machine."
105
+ )
106
+ else:
107
+ device_type_available = "mps"
108
+
109
+ if torch.cuda.is_available():
110
+ print("CUDA is available, we have found ", torch.cuda.device_count(), " GPU(s)")
111
+ print(torch.cuda.get_device_name(0))
112
+ print("CUDA version: " + torch.version.cuda)
113
+ device_type_available = f"cuda:{torch.cuda.current_device()}"
114
+
115
+ return (
116
+ os.environ.get("HF_EMBEDDINGS_DEVICE_TYPE") or device_type_available,
117
+ os.environ.get("HF_PIPELINE_DEVICE_TYPE") or device_type_available,
118
+ )
119
+
120
+
121
+ def ensure_model_is_downloaded(llm_model_type):
122
+ if llm_model_type.startswith("gpt4all"):
123
+ local_path = (
124
+ os.environ.get("GPT4ALL_J_MODEL_PATH")
125
+ if llm_model_type == "gpt4all-j"
126
+ else os.environ.get("GPT4ALL_MODEL_PATH")
127
+ )
128
+ url = (
129
+ os.environ.get("GPT4ALL_J_DOWNLOAD_LINK")
130
+ if llm_model_type == "gpt4all-j"
131
+ else os.environ.get("GPT4ALL_DOWNLOAD_LINK")
132
+ )
133
+ elif llm_model_type == "llamacpp":
134
+ local_path = os.environ.get("LLAMACPP_MODEL_PATH")
135
+ url = os.environ.get("LLAMACPP_DOWNLOAD_LINK")
136
+ elif llm_model_type == "ctransformers":
137
+ local_path = os.environ.get("CTRANSFORMERS_MODEL_PATH")
138
+ url = os.environ.get("CTRANSFORMERS_DOWNLOAD_LINK")
139
+ else:
140
+ raise ValueError(f"wrong model typle: {llm_model_type}")
141
+
142
+ path = Path(local_path)
143
+
144
+ if path.is_file():
145
+ print(f"model: {local_path} exists")
146
+ else:
147
+ print(f"downloading model: {local_path} from {url} ...")
148
+ path.parent.mkdir(parents=True, exist_ok=True)
149
+
150
+ # send a GET request to the URL to download the file. Stream since it's large
151
+ response = requests.get(url, stream=True)
152
+
153
+ # open the file in binary mode and write the contents of the response to it in chunks
154
+ # This is a large file, so be prepared to wait.
155
+ with open(local_path, "wb") as f:
156
+ for chunk in tqdm(response.iter_content(chunk_size=8192)):
157
+ if chunk:
158
+ f.write(chunk)
159
+
160
+ return local_path
161
+
162
+
163
+ if __name__ == "__main__":
164
+ hf_embeddings_device_type, hf_pipeline_device_type = get_device_types()
165
+ print(f"hf_embeddings_device_type: {hf_embeddings_device_type}")
166
+ print(f"hf_pipeline_device_type: {hf_pipeline_device_type}")
assets/Workflow-Overview.png ADDED
assets/custom.css ADDED
@@ -0,0 +1,488 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --chatbot-color-light: #F3F3F3;
3
+ --chatbot-color-dark: #121111;
4
+ }
5
+
6
+ /* status_display */
7
+ #status_display {
8
+ display: flex;
9
+ min-height: 2.5em;
10
+ align-items: flex-end;
11
+ justify-content: flex-end;
12
+ }
13
+
14
+ #status_display p {
15
+ font-size: .85em;
16
+ font-family: monospace;
17
+ color: var(--body-text-color-subdued);
18
+ }
19
+
20
+
21
+
22
+ /* usage_display */
23
+ #usage_display {
24
+ height: 1em;
25
+ }
26
+
27
+ #usage_display p {
28
+ padding: 0 1em;
29
+ font-size: .85em;
30
+ font-family: monospace;
31
+ color: var(--body-text-color-subdued);
32
+ }
33
+
34
+ /* list */
35
+ ol:not(.options),
36
+ ul:not(.options) {
37
+ padding-inline-start: 2em !important;
38
+ }
39
+
40
+ /* Thank @Keldos-Li for fixing it */
41
+ /* Light mode (default) */
42
+ #inflaton_chatbot {
43
+ background-color: var(--chatbot-color-light) !important;
44
+ color: #000000 !important;
45
+ }
46
+
47
+ [data-testid="bot"] {
48
+ background-color: #FFFFFF !important;
49
+ }
50
+
51
+ [data-testid="user"] {
52
+ background-color: #95EC69 !important;
53
+ }
54
+
55
+ /* Dark mode */
56
+ .dark #inflaton_chatbot {
57
+ background-color: var(--chatbot-color-dark) !important;
58
+ color: #FFFFFF !important;
59
+ }
60
+
61
+ .dark [data-testid="bot"] {
62
+ background-color: #2C2C2C !important;
63
+ }
64
+
65
+ .dark [data-testid="user"] {
66
+ background-color: #26B561 !important;
67
+ }
68
+
69
+ #inflaton_chatbot {
70
+ height: 100%;
71
+ min-height: 400px;
72
+ }
73
+
74
+ [class *="message"] {
75
+ border-radius: var(--radius-xl) !important;
76
+ border: none;
77
+ padding: var(--spacing-xl) !important;
78
+ font-size: var(--text-md) !important;
79
+ line-height: var(--line-md) !important;
80
+ min-height: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl));
81
+ min-width: calc(var(--text-md)*var(--line-md) + 2*var(--spacing-xl));
82
+ }
83
+
84
+ [data-testid="bot"] {
85
+ max-width: 85%;
86
+ border-bottom-left-radius: 0 !important;
87
+ }
88
+
89
+ [data-testid="user"] {
90
+ max-width: 85%;
91
+ width: auto !important;
92
+ border-bottom-right-radius: 0 !important;
93
+ }
94
+
95
+ /* Table */
96
+ table {
97
+ margin: 1em 0;
98
+ border-collapse: collapse;
99
+ empty-cells: show;
100
+ }
101
+
102
+ td,
103
+ th {
104
+ border: 1.2px solid var(--border-color-primary) !important;
105
+ padding: 0.2em;
106
+ }
107
+
108
+ thead {
109
+ background-color: rgba(175, 184, 193, 0.2);
110
+ }
111
+
112
+ thead th {
113
+ padding: .5em .2em;
114
+ }
115
+
116
+ /* Inline code */
117
+ #inflaton_chatbot code {
118
+ display: inline;
119
+ white-space: break-spaces;
120
+ border-radius: 6px;
121
+ margin: 0 2px 0 2px;
122
+ padding: .2em .4em .1em .4em;
123
+ background-color: rgba(175, 184, 193, 0.2);
124
+ }
125
+
126
+ /* Code block */
127
+ #inflaton_chatbot pre code {
128
+ display: block;
129
+ overflow: auto;
130
+ white-space: pre;
131
+ background-color: hsla(0, 0%, 0%, 80%) !important;
132
+ border-radius: 10px;
133
+ padding: 1.4em 1.2em 0em 1.4em;
134
+ margin: 1.2em 2em 1.2em 0.5em;
135
+ color: #FFF;
136
+ box-shadow: 6px 6px 16px hsla(0, 0%, 0%, 0.2);
137
+ }
138
+
139
+ /* Hightlight */
140
+ #inflaton_chatbot .highlight {
141
+ background-color: transparent
142
+ }
143
+
144
+ #inflaton_chatbot .highlight .hll {
145
+ background-color: #49483e
146
+ }
147
+
148
+ #inflaton_chatbot .highlight .c {
149
+ color: #75715e
150
+ }
151
+
152
+ /* Comment */
153
+ #inflaton_chatbot .highlight .err {
154
+ color: #960050;
155
+ background-color: #1e0010
156
+ }
157
+
158
+ /* Error */
159
+ #inflaton_chatbot .highlight .k {
160
+ color: #66d9ef
161
+ }
162
+
163
+ /* Keyword */
164
+ #inflaton_chatbot .highlight .l {
165
+ color: #ae81ff
166
+ }
167
+
168
+ /* Literal */
169
+ #inflaton_chatbot .highlight .n {
170
+ color: #f8f8f2
171
+ }
172
+
173
+ /* Name */
174
+ #inflaton_chatbot .highlight .o {
175
+ color: #f92672
176
+ }
177
+
178
+ /* Operator */
179
+ #inflaton_chatbot .highlight .p {
180
+ color: #f8f8f2
181
+ }
182
+
183
+ /* Punctuation */
184
+ #inflaton_chatbot .highlight .ch {
185
+ color: #75715e
186
+ }
187
+
188
+ /* Comment.Hashbang */
189
+ #inflaton_chatbot .highlight .cm {
190
+ color: #75715e
191
+ }
192
+
193
+ /* Comment.Multiline */
194
+ #inflaton_chatbot .highlight .cp {
195
+ color: #75715e
196
+ }
197
+
198
+ /* Comment.Preproc */
199
+ #inflaton_chatbot .highlight .cpf {
200
+ color: #75715e
201
+ }
202
+
203
+ /* Comment.PreprocFile */
204
+ #inflaton_chatbot .highlight .c1 {
205
+ color: #75715e
206
+ }
207
+
208
+ /* Comment.Single */
209
+ #inflaton_chatbot .highlight .cs {
210
+ color: #75715e
211
+ }
212
+
213
+ /* Comment.Special */
214
+ #inflaton_chatbot .highlight .gd {
215
+ color: #f92672
216
+ }
217
+
218
+ /* Generic.Deleted */
219
+ #inflaton_chatbot .highlight .ge {
220
+ font-style: italic
221
+ }
222
+
223
+ /* Generic.Emph */
224
+ #inflaton_chatbot .highlight .gi {
225
+ color: #a6e22e
226
+ }
227
+
228
+ /* Generic.Inserted */
229
+ #inflaton_chatbot .highlight .gs {
230
+ font-weight: bold
231
+ }
232
+
233
+ /* Generic.Strong */
234
+ #inflaton_chatbot .highlight .gu {
235
+ color: #75715e
236
+ }
237
+
238
+ /* Generic.Subheading */
239
+ #inflaton_chatbot .highlight .kc {
240
+ color: #66d9ef
241
+ }
242
+
243
+ /* Keyword.Constant */
244
+ #inflaton_chatbot .highlight .kd {
245
+ color: #66d9ef
246
+ }
247
+
248
+ /* Keyword.Declaration */
249
+ #inflaton_chatbot .highlight .kn {
250
+ color: #f92672
251
+ }
252
+
253
+ /* Keyword.Namespace */
254
+ #inflaton_chatbot .highlight .kp {
255
+ color: #66d9ef
256
+ }
257
+
258
+ /* Keyword.Pseudo */
259
+ #inflaton_chatbot .highlight .kr {
260
+ color: #66d9ef
261
+ }
262
+
263
+ /* Keyword.Reserved */
264
+ #inflaton_chatbot .highlight .kt {
265
+ color: #66d9ef
266
+ }
267
+
268
+ /* Keyword.Type */
269
+ #inflaton_chatbot .highlight .ld {
270
+ color: #e6db74
271
+ }
272
+
273
+ /* Literal.Date */
274
+ #inflaton_chatbot .highlight .m {
275
+ color: #ae81ff
276
+ }
277
+
278
+ /* Literal.Number */
279
+ #inflaton_chatbot .highlight .s {
280
+ color: #e6db74
281
+ }
282
+
283
+ /* Literal.String */
284
+ #inflaton_chatbot .highlight .na {
285
+ color: #a6e22e
286
+ }
287
+
288
+ /* Name.Attribute */
289
+ #inflaton_chatbot .highlight .nb {
290
+ color: #f8f8f2
291
+ }
292
+
293
+ /* Name.Builtin */
294
+ #inflaton_chatbot .highlight .nc {
295
+ color: #a6e22e
296
+ }
297
+
298
+ /* Name.Class */
299
+ #inflaton_chatbot .highlight .no {
300
+ color: #66d9ef
301
+ }
302
+
303
+ /* Name.Constant */
304
+ #inflaton_chatbot .highlight .nd {
305
+ color: #a6e22e
306
+ }
307
+
308
+ /* Name.Decorator */
309
+ #inflaton_chatbot .highlight .ni {
310
+ color: #f8f8f2
311
+ }
312
+
313
+ /* Name.Entity */
314
+ #inflaton_chatbot .highlight .ne {
315
+ color: #a6e22e
316
+ }
317
+
318
+ /* Name.Exception */
319
+ #inflaton_chatbot .highlight .nf {
320
+ color: #a6e22e
321
+ }
322
+
323
+ /* Name.Function */
324
+ #inflaton_chatbot .highlight .nl {
325
+ color: #f8f8f2
326
+ }
327
+
328
+ /* Name.Label */
329
+ #inflaton_chatbot .highlight .nn {
330
+ color: #f8f8f2
331
+ }
332
+
333
+ /* Name.Namespace */
334
+ #inflaton_chatbot .highlight .nx {
335
+ color: #a6e22e
336
+ }
337
+
338
+ /* Name.Other */
339
+ #inflaton_chatbot .highlight .py {
340
+ color: #f8f8f2
341
+ }
342
+
343
+ /* Name.Property */
344
+ #inflaton_chatbot .highlight .nt {
345
+ color: #f92672
346
+ }
347
+
348
+ /* Name.Tag */
349
+ #inflaton_chatbot .highlight .nv {
350
+ color: #f8f8f2
351
+ }
352
+
353
+ /* Name.Variable */
354
+ #inflaton_chatbot .highlight .ow {
355
+ color: #f92672
356
+ }
357
+
358
+ /* Operator.Word */
359
+ #inflaton_chatbot .highlight .w {
360
+ color: #f8f8f2
361
+ }
362
+
363
+ /* Text.Whitespace */
364
+ #inflaton_chatbot .highlight .mb {
365
+ color: #ae81ff
366
+ }
367
+
368
+ /* Literal.Number.Bin */
369
+ #inflaton_chatbot .highlight .mf {
370
+ color: #ae81ff
371
+ }
372
+
373
+ /* Literal.Number.Float */
374
+ #inflaton_chatbot .highlight .mh {
375
+ color: #ae81ff
376
+ }
377
+
378
+ /* Literal.Number.Hex */
379
+ #inflaton_chatbot .highlight .mi {
380
+ color: #ae81ff
381
+ }
382
+
383
+ /* Literal.Number.Integer */
384
+ #inflaton_chatbot .highlight .mo {
385
+ color: #ae81ff
386
+ }
387
+
388
+ /* Literal.Number.Oct */
389
+ #inflaton_chatbot .highlight .sa {
390
+ color: #e6db74
391
+ }
392
+
393
+ /* Literal.String.Affix */
394
+ #inflaton_chatbot .highlight .sb {
395
+ color: #e6db74
396
+ }
397
+
398
+ /* Literal.String.Backtick */
399
+ #inflaton_chatbot .highlight .sc {
400
+ color: #e6db74
401
+ }
402
+
403
+ /* Literal.String.Char */
404
+ #inflaton_chatbot .highlight .dl {
405
+ color: #e6db74
406
+ }
407
+
408
+ /* Literal.String.Delimiter */
409
+ #inflaton_chatbot .highlight .sd {
410
+ color: #e6db74
411
+ }
412
+
413
+ /* Literal.String.Doc */
414
+ #inflaton_chatbot .highlight .s2 {
415
+ color: #e6db74
416
+ }
417
+
418
+ /* Literal.String.Double */
419
+ #inflaton_chatbot .highlight .se {
420
+ color: #ae81ff
421
+ }
422
+
423
+ /* Literal.String.Escape */
424
+ #inflaton_chatbot .highlight .sh {
425
+ color: #e6db74
426
+ }
427
+
428
+ /* Literal.String.Heredoc */
429
+ #inflaton_chatbot .highlight .si {
430
+ color: #e6db74
431
+ }
432
+
433
+ /* Literal.String.Interpol */
434
+ #inflaton_chatbot .highlight .sx {
435
+ color: #e6db74
436
+ }
437
+
438
+ /* Literal.String.Other */
439
+ #inflaton_chatbot .highlight .sr {
440
+ color: #e6db74
441
+ }
442
+
443
+ /* Literal.String.Regex */
444
+ #inflaton_chatbot .highlight .s1 {
445
+ color: #e6db74
446
+ }
447
+
448
+ /* Literal.String.Single */
449
+ #inflaton_chatbot .highlight .ss {
450
+ color: #e6db74
451
+ }
452
+
453
+ /* Literal.String.Symbol */
454
+ #inflaton_chatbot .highlight .bp {
455
+ color: #f8f8f2
456
+ }
457
+
458
+ /* Name.Builtin.Pseudo */
459
+ #inflaton_chatbot .highlight .fm {
460
+ color: #a6e22e
461
+ }
462
+
463
+ /* Name.Function.Magic */
464
+ #inflaton_chatbot .highlight .vc {
465
+ color: #f8f8f2
466
+ }
467
+
468
+ /* Name.Variable.Class */
469
+ #inflaton_chatbot .highlight .vg {
470
+ color: #f8f8f2
471
+ }
472
+
473
+ /* Name.Variable.Global */
474
+ #inflaton_chatbot .highlight .vi {
475
+ color: #f8f8f2
476
+ }
477
+
478
+ /* Name.Variable.Instance */
479
+ #inflaton_chatbot .highlight .vm {
480
+ color: #f8f8f2
481
+ }
482
+
483
+ /* Name.Variable.Magic */
484
+ #inflaton_chatbot .highlight .il {
485
+ color: #ae81ff
486
+ }
487
+
488
+ /* Literal.Number.Integer.Long */
assets/favicon.ico ADDED
data/faiss_1024_512/index.faiss ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98e8c49e6c3ef2bcd0b258fb51ffe58fa92a63544b672f1c0c75857593afa2a8
3
+ size 5987373
data/faiss_1024_512/index.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8467d3647bf272f11151a512f54515ef6dd83f2081686156a437132380b28b4b
3
+ size 2035755
data/questions.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ What's PCI DSS?
2
+ Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?
3
+ new requirements for vulnerability assessments
4
+ more on penetration testing
eval_models.py ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import ast
2
+ import codecs
3
+ import json
4
+ from ragas import evaluate
5
+ from ragas.metrics import answer_relevancy, faithfulness
6
+ from datasets import Dataset
7
+ from langchain_openai.chat_models import ChatOpenAI
8
+
9
+
10
+ from app_modules.init import app_init
11
+
12
+ llm_loader, qa_chain = app_init()
13
+ qa = qa_chain.get_chain()
14
+
15
+ gpt4_turbo = ChatOpenAI(model_name="gpt-4-turbo-preview")
16
+
17
+
18
+ def load_notebook(filename, print_source=False):
19
+ f = codecs.open(filename, "r")
20
+ source = f.read()
21
+
22
+ print("loading: ", filename)
23
+ notebook = json.loads(source)
24
+
25
+ if print_source:
26
+ pySource = f"### Python code from {filename}:\n"
27
+ for x in notebook["cells"]:
28
+ for x2 in x["source"]:
29
+ pySource = pySource + x2
30
+ if x2[-1] != "\n":
31
+ pySource = pySource + "\n"
32
+
33
+ print(pySource)
34
+ return notebook
35
+
36
+
37
+ def parse_outputs(outputs):
38
+ questions = [
39
+ "Question: What's PCI DSS?\n",
40
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
41
+ "Question: new requirements for vulnerability assessments\n",
42
+ "Question: more on penetration testing\n",
43
+ ]
44
+ result = []
45
+ for question in questions:
46
+ start = outputs.index(question)
47
+ conversation = ast.literal_eval(outputs[start + 1])
48
+ index = start + 2
49
+
50
+ if len(conversation["chat_history"]) > 0:
51
+ conversation["standalone_question"] = ""
52
+ while not outputs[index].startswith("<on_llm_end>"):
53
+ conversation["standalone_question"] += outputs[index]
54
+ index += 1
55
+
56
+ index += 1
57
+ while outputs[index] == "\n":
58
+ index += 1
59
+
60
+ conversation["answer"] = ""
61
+
62
+ while not outputs[index].startswith("<on_llm_end>"):
63
+ conversation["answer"] += outputs[index]
64
+ index += 1
65
+
66
+ while not outputs[index].startswith("Completed"):
67
+ index += 1
68
+
69
+ timing = outputs[index].split()[-1]
70
+ conversation["time_used_in_seconds"] = timing[:-1]
71
+
72
+ result.append(conversation)
73
+
74
+ index += 1
75
+ total_time_used = outputs[index].split()[-2]
76
+
77
+ index += 1
78
+ num_tokens_generated = outputs[index].split()[-1]
79
+
80
+ index += 1
81
+ token_per_second = outputs[index].split()[-2]
82
+
83
+ return {
84
+ "conversations": result,
85
+ "total_time_used": total_time_used,
86
+ "num_tokens_generated": num_tokens_generated,
87
+ "token_per_second": token_per_second,
88
+ }
89
+
90
+
91
+ def parse_results(notebook):
92
+ result = {}
93
+ repetition_penalty = None
94
+ for x in notebook["cells"]:
95
+ source = x["source"]
96
+ for x2 in source:
97
+ # print(x2)
98
+ if "_RP" in x2:
99
+ start = x2.index("1.")
100
+ end = x2.index('"', start)
101
+ repetition_penalty = x2[start:end]
102
+ print("processing repetition_penalty:", repetition_penalty)
103
+
104
+ if source and repetition_penalty:
105
+ outputs = x["outputs"][0]["text"]
106
+ result[repetition_penalty] = parse_outputs(outputs)
107
+ repetition_penalty = None
108
+
109
+ return result
110
+
111
+
112
+ def calc_ragas_scores(conversations):
113
+ dict = {
114
+ "question": [],
115
+ "user_question": [],
116
+ "standalone_question": [],
117
+ "contexts": [],
118
+ "answer": [],
119
+ }
120
+
121
+ for conversation in conversations:
122
+ standalone_question = (
123
+ conversation["standalone_question"]
124
+ if "standalone_question" in conversation
125
+ else conversation["question"]
126
+ )
127
+ dict["question"].append(standalone_question)
128
+ dict["answer"].append(conversation["answer"])
129
+
130
+ dict["user_question"].append(conversation["question"])
131
+ dict["standalone_question"].append(
132
+ conversation["standalone_question"]
133
+ if "standalone_question" in conversation
134
+ else ""
135
+ )
136
+
137
+ contexts = []
138
+ docs = qa.retriever.get_relevant_documents(standalone_question)
139
+ for doc in docs:
140
+ contexts.append(doc.page_content)
141
+
142
+ dict["contexts"].append(contexts)
143
+
144
+ # print(dict)
145
+
146
+ ds = Dataset.from_dict(dict)
147
+
148
+ result = evaluate(
149
+ ds,
150
+ metrics=[
151
+ faithfulness,
152
+ answer_relevancy,
153
+ ],
154
+ llm=gpt4_turbo,
155
+ )
156
+
157
+ result["overall_score"] = 2 / (
158
+ 1 / result["faithfulness"] + 1 / result["answer_relevancy"]
159
+ )
160
+
161
+ print(f"\n\n# Ragas scores: {result}\n")
162
+ return dict, result
163
+
164
+
165
+ def evaluate_models(model_names, prefix="nvidia-4090"):
166
+ raw_data = {
167
+ "model_name": [],
168
+ "repetition_penalty": [],
169
+ "user_question": [],
170
+ "standalone_question": [],
171
+ "contexts": [],
172
+ "answer": [],
173
+ }
174
+ perf_data = {
175
+ "model_name": [],
176
+ "repetition_penalty": [],
177
+ "faithfulness": [],
178
+ "answer_relevancy": [],
179
+ "overall_score": [],
180
+ "total_time_used": [],
181
+ "num_tokens_generated": [],
182
+ "token_per_second": [],
183
+ }
184
+
185
+ repetition_penalties = ["1.05", "1.10", "1.15"]
186
+
187
+ openai_model_names = {
188
+ "1.05": "gpt-3.5-turbo",
189
+ "1.10": "gpt-3.5-turbo-instruct",
190
+ "1.15": "gpt-4",
191
+ }
192
+
193
+ for model_name in model_names:
194
+ notebook = load_notebook(f"./notebook/{prefix}-{model_name}.ipynb")
195
+ results = parse_results(notebook)
196
+ for repetition_penalty in repetition_penalties:
197
+ result = results[repetition_penalty]
198
+ dict, ragas = calc_ragas_scores(result["conversations"])
199
+
200
+ if model_name == "openai" or model_name.startswith("gpt-"):
201
+ model_name = openai_model_names[repetition_penalty]
202
+ repetition_penalty = ""
203
+
204
+ for _ in dict["question"]:
205
+ raw_data["model_name"].append(model_name)
206
+ raw_data["repetition_penalty"].append(repetition_penalty)
207
+
208
+ raw_data["user_question"] += dict["user_question"]
209
+ raw_data["standalone_question"] += dict["standalone_question"]
210
+ raw_data["contexts"] += dict["contexts"]
211
+ raw_data["answer"] += dict["answer"]
212
+
213
+ perf_data["model_name"].append(model_name)
214
+ perf_data["repetition_penalty"].append(repetition_penalty)
215
+
216
+ perf_data["faithfulness"].append(ragas["faithfulness"])
217
+ perf_data["answer_relevancy"].append(ragas["answer_relevancy"])
218
+ perf_data["overall_score"].append(ragas["overall_score"])
219
+ perf_data["num_tokens_generated"].append(
220
+ int(result["num_tokens_generated"])
221
+ )
222
+ perf_data["total_time_used"].append(float(result["total_time_used"]))
223
+ perf_data["token_per_second"].append(float(result["token_per_second"]))
224
+
225
+ perf_ds = Dataset.from_dict(perf_data)
226
+ perf_pd = perf_ds.to_pandas()
227
+
228
+ raw_ds = Dataset.from_dict(raw_data)
229
+ raw_pd = raw_ds.to_pandas()
230
+ return perf_pd, raw_pd
ingest.py ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # setting device on GPU if available, else CPU
2
+ import os
3
+ from timeit import default_timer as timer
4
+ from typing import List
5
+
6
+ from langchain.document_loaders import PyPDFDirectoryLoader
7
+ from langchain_community.embeddings import HuggingFaceInstructEmbeddings
8
+ from langchain.text_splitter import RecursiveCharacterTextSplitter
9
+ from langchain.vectorstores.base import VectorStore
10
+ from langchain.vectorstores.chroma import Chroma
11
+ from langchain.vectorstores.faiss import FAISS
12
+
13
+ from app_modules.init import *
14
+
15
+
16
+ def load_documents(source_pdfs_path, urls) -> List:
17
+ loader = PyPDFDirectoryLoader(source_pdfs_path, silent_errors=True)
18
+ documents = loader.load()
19
+ if urls is not None and len(urls) > 0:
20
+ for doc in documents:
21
+ source = doc.metadata["source"]
22
+ filename = source.split("/")[-1]
23
+ for url in urls:
24
+ if url.endswith(filename):
25
+ doc.metadata["url"] = url
26
+ break
27
+ return documents
28
+
29
+
30
+ def split_chunks(documents: List, chunk_size, chunk_overlap) -> List:
31
+ text_splitter = RecursiveCharacterTextSplitter(
32
+ chunk_size=chunk_size, chunk_overlap=chunk_overlap
33
+ )
34
+ return text_splitter.split_documents(documents)
35
+
36
+
37
+ def generate_index(
38
+ chunks: List, embeddings: HuggingFaceInstructEmbeddings
39
+ ) -> VectorStore:
40
+ if using_faiss:
41
+ faiss_instructor_embeddings = FAISS.from_documents(
42
+ documents=chunks, embedding=embeddings
43
+ )
44
+
45
+ faiss_instructor_embeddings.save_local(index_path)
46
+ return faiss_instructor_embeddings
47
+ else:
48
+ chromadb_instructor_embeddings = Chroma.from_documents(
49
+ documents=chunks, embedding=embeddings, persist_directory=index_path
50
+ )
51
+
52
+ chromadb_instructor_embeddings.persist()
53
+ return chromadb_instructor_embeddings
54
+
55
+
56
+ # Constants
57
+ device_type, hf_pipeline_device_type = get_device_types()
58
+ hf_embeddings_model_name = (
59
+ os.environ.get("HF_EMBEDDINGS_MODEL_NAME") or "hkunlp/instructor-xl"
60
+ )
61
+ index_path = os.environ.get("FAISS_INDEX_PATH") or os.environ.get("CHROMADB_INDEX_PATH")
62
+ using_faiss = os.environ.get("FAISS_INDEX_PATH") is not None
63
+ source_pdfs_path = os.environ.get("SOURCE_PDFS_PATH")
64
+ source_urls = os.environ.get("SOURCE_URLS")
65
+ chunk_size = os.environ.get("CHUNCK_SIZE")
66
+ chunk_overlap = os.environ.get("CHUNK_OVERLAP")
67
+
68
+ start = timer()
69
+ embeddings = HuggingFaceInstructEmbeddings(
70
+ model_name=hf_embeddings_model_name, model_kwargs={"device": device_type}
71
+ )
72
+ end = timer()
73
+
74
+ print(f"Completed in {end - start:.3f}s")
75
+
76
+ start = timer()
77
+
78
+ if not os.path.isdir(index_path):
79
+ print(
80
+ f"The index persist directory {index_path} is not present. Creating a new one."
81
+ )
82
+ os.mkdir(index_path)
83
+
84
+ if source_urls is not None:
85
+ # Open the file for reading
86
+ file = open(source_urls, "r")
87
+
88
+ # Read the contents of the file into a list of strings
89
+ lines = file.readlines()
90
+
91
+ # Close the file
92
+ file.close()
93
+
94
+ # Remove the newline characters from each string
95
+ source_urls = [line.strip() for line in lines]
96
+
97
+ print(
98
+ f"Loading {'' if source_urls is None else str(len(source_urls)) + ' '}PDF files from {source_pdfs_path}"
99
+ )
100
+ sources = load_documents(source_pdfs_path, source_urls)
101
+
102
+ print(f"Splitting {len(sources)} PDF pages in to chunks ...")
103
+
104
+ chunks = split_chunks(
105
+ sources, chunk_size=int(chunk_size), chunk_overlap=int(chunk_overlap)
106
+ )
107
+ print(f"Generating index for {len(chunks)} chunks ...")
108
+
109
+ index = generate_index(chunks, embeddings)
110
+ else:
111
+ print(f"The index persist directory {index_path} is present. Loading index ...")
112
+ index = (
113
+ FAISS.load_local(index_path, embeddings)
114
+ if using_faiss
115
+ else Chroma(embedding_function=embeddings, persist_directory=index_path)
116
+ )
117
+ query = "hi"
118
+ print(f"Load relevant documents for standalone question: {query}")
119
+
120
+ start2 = timer()
121
+ docs = index.as_retriever().get_relevant_documents(query)
122
+ end = timer()
123
+
124
+ print(f"Completed in {end - start2:.3f}s")
125
+ print(docs)
126
+
127
+ end = timer()
128
+
129
+ print(f"Completed in {end - start:.3f}s")
notebook/nvidia-4080-dolphin-2_6-phi-2-2.7b.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebook/nvidia-4080-llama-2-7b.ipynb ADDED
@@ -0,0 +1,2459 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "874cd58e",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "workding dir: /home/inflaton/code/projects/chat-with-orca-2\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "import os\n",
19
+ "import sys\n",
20
+ "from pathlib import Path\n",
21
+ "\n",
22
+ "workding_dir = str(Path.cwd().parent)\n",
23
+ "os.chdir(workding_dir)\n",
24
+ "sys.path.append(workding_dir)\n",
25
+ "print(\"workding dir:\", workding_dir)"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": 2,
31
+ "id": "19f967ca",
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"huggingface\"\n",
36
+ "os.environ[\"HUGGINGFACE_MODEL_NAME_OR_PATH\"] = \"meta-llama/Llama-2-7b-chat-hf\""
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": 3,
42
+ "id": "a6d96660",
43
+ "metadata": {},
44
+ "outputs": [
45
+ {
46
+ "name": "stdout",
47
+ "output_type": "stream",
48
+ "text": [
49
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
50
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
51
+ "MPS is NOT available\n",
52
+ "CUDA is available\n",
53
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
54
+ "CUDA is available, we have found 1 GPU(s)\n",
55
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
56
+ "CUDA version: 12.1\n",
57
+ "hf_embeddings_device_type: cuda:0\n",
58
+ "hf_pipeline_device_type: cuda:0\n",
59
+ "load INSTRUCTOR_Transformer\n",
60
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
61
+ " return self.fget.__get__(instance, owner)()\n",
62
+ "max_seq_length 512\n",
63
+ "Completed in 0.610s\n",
64
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
65
+ "Completed in 0.019s\n",
66
+ "initializing LLM: huggingface\n",
67
+ " hf_pipeline_device_type: cuda:0\n",
68
+ " load_quantized_model: None\n",
69
+ " torch_dtype: torch.float16\n",
70
+ " n_threds: 4\n",
71
+ " loading model: meta-llama/Llama-2-7b-chat-hf\n",
72
+ " HF auth token: None\n",
73
+ " repetition_penalty: 1.05\n",
74
+ "Loading checkpoint shards: 100%|██████████████████| 2/2 [02:47<00:00, 83.80s/it]\n",
75
+ "Model memory footprint: 13543948288\n",
76
+ "initialization complete\n",
77
+ "Completed in 172.421s\n",
78
+ "\n",
79
+ "Question: What's PCI DSS?\n",
80
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
81
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more. The goal of PCI DSS is to protect payment data from unauthorized access, use, disclosure, disruption, modification, or destruction.\n",
82
+ "\n",
83
+ "\n",
84
+ "\n",
85
+ "<on_llm_end>\n",
86
+ "\n",
87
+ "\n",
88
+ "Completed in 62.095s\n",
89
+ "\n",
90
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
91
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more. The goal of PCI DSS is to protect payment data from unauthorized access, use, disclosure, disruption, modification, or destruction.')]}\n",
92
+ "What are the key changes made in PCI DSS version 4.0 compared to version 3.2.1?\n",
93
+ "\n",
94
+ "\n",
95
+ "\n",
96
+ "<on_llm_end>\n",
97
+ "\n",
98
+ "\n",
99
+ " The key changes made in PCI DSS version 4.0 compared to version 3.2.1 include updated principal requirement titles, replaced \"firewalls\" and \"routers\" with \"network security controls\", and evolved requirements related to roles and responsibilities. Additionally, there are errata updates to correct entries in the Summary of New Requirements table and to add descriptions of changes made to certain requirements.\n",
100
+ "\n",
101
+ "\n",
102
+ "\n",
103
+ "<on_llm_end>\n",
104
+ "\n",
105
+ "\n",
106
+ "Completed in 56.760s\n",
107
+ "\n",
108
+ "Question: new requirements for vulnerability assessments\n",
109
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more. The goal of PCI DSS is to protect payment data from unauthorized access, use, disclosure, disruption, modification, or destruction.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The key changes made in PCI DSS version 4.0 compared to version 3.2.1 include updated principal requirement titles, replaced \"firewalls\" and \"routers\" with \"network security controls\", and evolved requirements related to roles and responsibilities. Additionally, there are errata updates to correct entries in the Summary of New Requirements table and to add descriptions of changes made to certain requirements.')]}\n",
110
+ "What are the updated requirements for vulnerability assessments in PCI DSS version 4.0 compared to version 3.2.1?\n",
111
+ "\n",
112
+ "\n",
113
+ "\n",
114
+ "<on_llm_end>\n",
115
+ "\n",
116
+ "\n",
117
+ " The updated requirements for vulnerability assessments in PCI DSS version 4.0 are as follows:\n",
118
+ "\n",
119
+ "\n",
120
+ "\n",
121
+ "\n",
122
+ "\n",
123
+ "\n",
124
+ "\n",
125
+ "\n",
126
+ "\n",
127
+ "\n",
128
+ "\n",
129
+ "\n",
130
+ "\n",
131
+ "\n",
132
+ "\n",
133
+ "\n",
134
+ "\n",
135
+ "\n",
136
+ "\n",
137
+ "\n",
138
+ "\n",
139
+ "\n",
140
+ "\n",
141
+ "\n",
142
+ "\n",
143
+ "\n",
144
+ "\n",
145
+ "\n",
146
+ "\n",
147
+ "\n",
148
+ "\n",
149
+ "\n",
150
+ "\n",
151
+ "\n",
152
+ "\n",
153
+ "\n",
154
+ "\n",
155
+ "\n",
156
+ "\n",
157
+ "\n",
158
+ "\n",
159
+ "\n",
160
+ "\n",
161
+ "\n",
162
+ "\n",
163
+ "\n",
164
+ "\n",
165
+ "\n",
166
+ "\n",
167
+ "\n",
168
+ "\n",
169
+ "\n",
170
+ "\n",
171
+ "\n",
172
+ "\n",
173
+ "\n",
174
+ "\n",
175
+ "\n",
176
+ "\n",
177
+ "\n",
178
+ "\n",
179
+ "\n",
180
+ "\n",
181
+ "\n",
182
+ "\n",
183
+ "\n",
184
+ "\n",
185
+ "\n",
186
+ "\n",
187
+ "\n",
188
+ "\n",
189
+ "\n",
190
+ "\n",
191
+ "\n",
192
+ "\n",
193
+ "\n",
194
+ "\n",
195
+ "\n",
196
+ "\n",
197
+ "\n",
198
+ "\n",
199
+ "\n",
200
+ "\n",
201
+ "\n",
202
+ "\n",
203
+ "\n",
204
+ "\n",
205
+ "\n",
206
+ "\n",
207
+ "\n",
208
+ "\n",
209
+ "\n",
210
+ "\n",
211
+ "\n",
212
+ "\n",
213
+ "\n",
214
+ "\n",
215
+ "\n",
216
+ "\n",
217
+ "\n",
218
+ "\n",
219
+ "\n",
220
+ "\n",
221
+ "\n",
222
+ "\n",
223
+ "\n",
224
+ "\n",
225
+ "\n",
226
+ "\n",
227
+ "\n",
228
+ "\n",
229
+ "\n",
230
+ "\n",
231
+ "\n",
232
+ "\n",
233
+ "\n",
234
+ "\n",
235
+ "\n",
236
+ "\n",
237
+ "\n",
238
+ "\n",
239
+ "\n",
240
+ "\n",
241
+ "\n",
242
+ "\n",
243
+ "\n",
244
+ "\n",
245
+ "\n",
246
+ "\n",
247
+ "\n",
248
+ "\n",
249
+ "\n",
250
+ "\n",
251
+ "\n",
252
+ "\n",
253
+ "\n",
254
+ "\n",
255
+ "\n",
256
+ "\n",
257
+ "\n",
258
+ "\n",
259
+ "\n",
260
+ "\n",
261
+ "\n",
262
+ "\n",
263
+ "\n",
264
+ "\n",
265
+ "\n",
266
+ "\n",
267
+ "\n",
268
+ "\n",
269
+ "\n",
270
+ "\n",
271
+ "\n",
272
+ "\n",
273
+ "\n",
274
+ "\n",
275
+ "\n",
276
+ "\n",
277
+ "\n",
278
+ "\n",
279
+ "\n",
280
+ "\n",
281
+ "\n",
282
+ "\n",
283
+ "\n",
284
+ "\n",
285
+ "\n",
286
+ "\n",
287
+ "\n",
288
+ "\n",
289
+ "\n",
290
+ "\n",
291
+ "\n",
292
+ "\n",
293
+ "\n",
294
+ "\n",
295
+ "\n",
296
+ "\n",
297
+ "\n",
298
+ "\n",
299
+ "\n",
300
+ "\n",
301
+ "\n",
302
+ "\n",
303
+ "\n",
304
+ "\n",
305
+ "\n",
306
+ "\n",
307
+ "\n",
308
+ "\n",
309
+ "\n",
310
+ "\n",
311
+ "\n",
312
+ "\n",
313
+ "\n",
314
+ "\n",
315
+ "\n",
316
+ "\n",
317
+ "\n",
318
+ "\n",
319
+ "\n",
320
+ "\n",
321
+ "\n",
322
+ "\n",
323
+ "\n",
324
+ "\n",
325
+ "\n",
326
+ "\n",
327
+ "\n",
328
+ "\n",
329
+ "\n",
330
+ "\n",
331
+ "\n",
332
+ "\n",
333
+ "\n",
334
+ "\n",
335
+ "\n",
336
+ "\n",
337
+ "\n",
338
+ "\n",
339
+ "\n",
340
+ "\n",
341
+ "\n",
342
+ "\n",
343
+ "\n",
344
+ "\n",
345
+ "\n",
346
+ "\n",
347
+ "\n",
348
+ "\n",
349
+ "\n",
350
+ "\n",
351
+ "\n",
352
+ "\n",
353
+ "\n",
354
+ "\n",
355
+ "\n",
356
+ "\n",
357
+ "\n",
358
+ "\n",
359
+ "\n",
360
+ "\n",
361
+ "\n",
362
+ "\n",
363
+ "\n",
364
+ "\n",
365
+ "\n",
366
+ "\n",
367
+ "\n",
368
+ "\n",
369
+ "\n",
370
+ "\n",
371
+ "\n",
372
+ "\n",
373
+ "\n",
374
+ "\n",
375
+ "\n",
376
+ "\n",
377
+ "\n",
378
+ "\n",
379
+ "\n",
380
+ "\n",
381
+ "\n",
382
+ "\n",
383
+ "\n",
384
+ "\n",
385
+ "\n",
386
+ "\n",
387
+ "\n",
388
+ "\n",
389
+ "\n",
390
+ "\n",
391
+ "\n",
392
+ "\n",
393
+ "\n",
394
+ "\n",
395
+ "\n",
396
+ "\n",
397
+ "\n",
398
+ "\n",
399
+ "\n",
400
+ "\n",
401
+ "\n",
402
+ "\n",
403
+ "\n",
404
+ "\n",
405
+ "\n",
406
+ "\n",
407
+ "\n",
408
+ "\n",
409
+ "\n",
410
+ "\n",
411
+ "\n",
412
+ "\n",
413
+ "\n",
414
+ "\n",
415
+ "\n",
416
+ "\n",
417
+ "\n",
418
+ "\n",
419
+ "\n",
420
+ "\n",
421
+ "\n",
422
+ "\n",
423
+ "\n",
424
+ "\n",
425
+ "\n",
426
+ "\n",
427
+ "\n",
428
+ "\n",
429
+ "\n",
430
+ "\n",
431
+ "\n",
432
+ "\n",
433
+ "\n",
434
+ "\n",
435
+ "\n",
436
+ "\n",
437
+ "\n",
438
+ "\n",
439
+ "\n",
440
+ "\n",
441
+ "\n",
442
+ "\n",
443
+ "\n",
444
+ "\n",
445
+ "\n",
446
+ "\n",
447
+ "\n",
448
+ "\n",
449
+ "\n",
450
+ "\n",
451
+ "\n",
452
+ "\n",
453
+ "\n",
454
+ "\n",
455
+ "\n",
456
+ "\n",
457
+ "\n",
458
+ "\n",
459
+ "\n",
460
+ "\n",
461
+ "\n",
462
+ "\n",
463
+ "\n",
464
+ "\n",
465
+ "\n",
466
+ "\n",
467
+ "\n",
468
+ "\n",
469
+ "\n",
470
+ "\n",
471
+ "\n",
472
+ "\n",
473
+ "\n",
474
+ "\n",
475
+ "\n",
476
+ "\n",
477
+ "\n",
478
+ "\n",
479
+ "\n",
480
+ "\n",
481
+ "\n",
482
+ "\n",
483
+ "\n",
484
+ "\n",
485
+ "\n",
486
+ "\n",
487
+ "\n",
488
+ "\n",
489
+ "\n",
490
+ "\n",
491
+ "\n",
492
+ "\n",
493
+ "\n",
494
+ "\n",
495
+ "\n",
496
+ "\n",
497
+ "\n",
498
+ "\n",
499
+ "\n",
500
+ "\n",
501
+ "\n",
502
+ "\n",
503
+ "\n",
504
+ "\n",
505
+ "\n",
506
+ "\n",
507
+ "\n",
508
+ "\n",
509
+ "\n",
510
+ "\n",
511
+ "\n",
512
+ "\n",
513
+ "\n",
514
+ "\n",
515
+ "\n",
516
+ "\n",
517
+ "\n",
518
+ "\n",
519
+ "\n",
520
+ "\n",
521
+ "\n",
522
+ "\n",
523
+ "\n",
524
+ "\n",
525
+ "\n",
526
+ "\n",
527
+ "\n",
528
+ "\n",
529
+ "\n",
530
+ "\n",
531
+ "\n",
532
+ "\n",
533
+ "\n",
534
+ "\n",
535
+ "\n",
536
+ "\n",
537
+ "\n",
538
+ "\n",
539
+ "\n",
540
+ "\n",
541
+ "\n",
542
+ "\n",
543
+ "\n",
544
+ "\n",
545
+ "\n",
546
+ "\n",
547
+ "\n",
548
+ "\n",
549
+ "\n",
550
+ "\n",
551
+ "\n",
552
+ "\n",
553
+ "\n",
554
+ "\n",
555
+ "\n",
556
+ "\n",
557
+ "\n",
558
+ "\n",
559
+ "\n",
560
+ "\n",
561
+ "\n",
562
+ "\n",
563
+ "\n",
564
+ "\n",
565
+ "\n",
566
+ "\n",
567
+ "\n",
568
+ "\n",
569
+ "\n",
570
+ "\n",
571
+ "\n",
572
+ "\n",
573
+ "\n",
574
+ "\n",
575
+ "\n",
576
+ "\n",
577
+ "\n",
578
+ "\n",
579
+ "\n",
580
+ "\n",
581
+ "\n",
582
+ "\n",
583
+ "\n",
584
+ "\n",
585
+ "\n",
586
+ "\n",
587
+ "\n",
588
+ "\n",
589
+ "\n",
590
+ "\n",
591
+ "\n",
592
+ "\n",
593
+ "\n",
594
+ "\n",
595
+ "\n",
596
+ "\n",
597
+ "\n",
598
+ "\n",
599
+ "\n",
600
+ "\n",
601
+ "\n",
602
+ "\n",
603
+ "\n",
604
+ "\n",
605
+ "\n",
606
+ "\n",
607
+ "\n",
608
+ "\n",
609
+ "\n",
610
+ "\n",
611
+ "\n",
612
+ "\n",
613
+ "\n",
614
+ "\n",
615
+ "\n",
616
+ "\n",
617
+ "\n",
618
+ "\n",
619
+ "\n",
620
+ "\n",
621
+ "\n",
622
+ "\n",
623
+ "\n",
624
+ "\n",
625
+ "\n",
626
+ "\n",
627
+ "\n",
628
+ "\n",
629
+ "\n",
630
+ "\n",
631
+ "\n",
632
+ "\n",
633
+ "\n",
634
+ "\n",
635
+ "\n",
636
+ "\n",
637
+ "\n",
638
+ "\n",
639
+ "\n",
640
+ "\n",
641
+ "\n",
642
+ "\n",
643
+ "\n",
644
+ "\n",
645
+ "\n",
646
+ "\n",
647
+ "\n",
648
+ "\n",
649
+ "\n",
650
+ "\n",
651
+ "\n",
652
+ "\n",
653
+ "\n",
654
+ "\n",
655
+ "\n",
656
+ "\n",
657
+ "\n",
658
+ "\n",
659
+ "\n",
660
+ "\n",
661
+ "\n",
662
+ "\n",
663
+ "\n",
664
+ "\n",
665
+ "\n",
666
+ "\n",
667
+ "\n",
668
+ "\n",
669
+ "\n",
670
+ "\n",
671
+ "\n",
672
+ "\n",
673
+ "\n",
674
+ "\n",
675
+ "\n",
676
+ "\n",
677
+ "\n",
678
+ "\n",
679
+ "\n",
680
+ "\n",
681
+ "\n",
682
+ "\n",
683
+ "\n",
684
+ "\n",
685
+ "\n",
686
+ "\n",
687
+ "\n",
688
+ "\n",
689
+ "\n",
690
+ "\n",
691
+ "\n",
692
+ "\n",
693
+ "\n",
694
+ "\n",
695
+ "\n",
696
+ "\n",
697
+ "\n",
698
+ "\n",
699
+ "\n",
700
+ "\n",
701
+ "\n",
702
+ "\n",
703
+ "\n",
704
+ "\n",
705
+ "\n",
706
+ "\n",
707
+ "\n",
708
+ "\n",
709
+ "\n",
710
+ "\n",
711
+ "\n",
712
+ "\n",
713
+ "\n",
714
+ "\n",
715
+ "\n",
716
+ "\n",
717
+ "\n",
718
+ "\n",
719
+ "\n",
720
+ "\n",
721
+ "\n",
722
+ "\n",
723
+ "\n",
724
+ "\n",
725
+ "\n",
726
+ "\n",
727
+ "\n",
728
+ "\n",
729
+ "\n",
730
+ "\n",
731
+ "\n",
732
+ "\n",
733
+ "\n",
734
+ "\n",
735
+ "\n",
736
+ "\n",
737
+ "\n",
738
+ "\n",
739
+ "\n",
740
+ "\n",
741
+ "\n",
742
+ "\n",
743
+ "\n",
744
+ "\n",
745
+ "\n",
746
+ "\n",
747
+ "\n",
748
+ "\n",
749
+ "\n",
750
+ "\n",
751
+ "\n",
752
+ "\n",
753
+ "\n",
754
+ "\n",
755
+ "\n",
756
+ "\n",
757
+ "\n",
758
+ "\n",
759
+ "\n",
760
+ "\n",
761
+ "\n",
762
+ "\n",
763
+ "\n",
764
+ "\n",
765
+ "\n",
766
+ "\n",
767
+ "\n",
768
+ "\n",
769
+ "\n",
770
+ "\n",
771
+ "\n",
772
+ "\n",
773
+ "\n",
774
+ "\n",
775
+ "\n",
776
+ "\n",
777
+ "\n",
778
+ "\n",
779
+ "\n",
780
+ "\n",
781
+ "\n",
782
+ "\n",
783
+ "\n",
784
+ "\n",
785
+ "\n",
786
+ "\n",
787
+ "\n",
788
+ "\n",
789
+ "\n",
790
+ "\n",
791
+ "\n",
792
+ "\n",
793
+ "\n",
794
+ "\n",
795
+ "\n",
796
+ "\n",
797
+ "\n",
798
+ "\n",
799
+ "\n",
800
+ "\n",
801
+ "\n",
802
+ "\n",
803
+ "\n",
804
+ "\n",
805
+ "\n",
806
+ "\n",
807
+ "\n",
808
+ "\n",
809
+ "\n",
810
+ "\n",
811
+ "\n",
812
+ "\n",
813
+ "\n",
814
+ "\n",
815
+ "\n",
816
+ "\n",
817
+ "\n",
818
+ "\n",
819
+ "\n",
820
+ "\n",
821
+ "\n",
822
+ "\n",
823
+ "\n",
824
+ "\n",
825
+ "\n",
826
+ "\n",
827
+ "\n",
828
+ "\n",
829
+ "\n",
830
+ "\n",
831
+ "\n",
832
+ "\n",
833
+ "\n",
834
+ "\n",
835
+ "\n",
836
+ "\n",
837
+ "\n",
838
+ "\n",
839
+ "\n",
840
+ "\n",
841
+ "\n",
842
+ "\n",
843
+ "\n",
844
+ "\n",
845
+ "\n",
846
+ "\n",
847
+ "\n",
848
+ "\n",
849
+ "\n",
850
+ "\n",
851
+ "\n",
852
+ "\n",
853
+ "\n",
854
+ "\n",
855
+ "\n",
856
+ "\n",
857
+ "\n",
858
+ "\n",
859
+ "\n",
860
+ "\n",
861
+ "\n",
862
+ "\n",
863
+ "\n",
864
+ "\n",
865
+ "\n",
866
+ "\n",
867
+ "\n",
868
+ "\n",
869
+ "\n",
870
+ "\n",
871
+ "\n",
872
+ "\n",
873
+ "\n",
874
+ "\n",
875
+ "\n",
876
+ "\n",
877
+ "\n",
878
+ "\n",
879
+ "\n",
880
+ "\n",
881
+ "\n",
882
+ "\n",
883
+ "\n",
884
+ "\n",
885
+ "\n",
886
+ "\n",
887
+ "\n",
888
+ "\n",
889
+ "\n",
890
+ "\n",
891
+ "\n",
892
+ "\n",
893
+ "\n",
894
+ "\n",
895
+ "\n",
896
+ "\n",
897
+ "\n",
898
+ "\n",
899
+ "\n",
900
+ "\n",
901
+ "\n",
902
+ "\n",
903
+ "\n",
904
+ "\n",
905
+ "\n",
906
+ "\n",
907
+ "\n",
908
+ "\n",
909
+ "\n",
910
+ "\n",
911
+ "\n",
912
+ "\n",
913
+ "\n",
914
+ "\n",
915
+ "\n",
916
+ "\n",
917
+ "\n",
918
+ "\n",
919
+ "\n",
920
+ "\n",
921
+ "\n",
922
+ "\n",
923
+ "\n",
924
+ "\n",
925
+ "\n",
926
+ "\n",
927
+ "\n",
928
+ "\n",
929
+ "\n",
930
+ "\n",
931
+ "\n",
932
+ "\n",
933
+ "\n",
934
+ "\n",
935
+ "\n",
936
+ "\n",
937
+ "\n",
938
+ "\n",
939
+ "\n",
940
+ "\n",
941
+ "\n",
942
+ "\n",
943
+ "\n",
944
+ "\n",
945
+ "\n",
946
+ "\n",
947
+ "\n",
948
+ "\n",
949
+ "\n",
950
+ "\n",
951
+ "\n",
952
+ "\n",
953
+ "\n",
954
+ "\n",
955
+ "\n",
956
+ "\n",
957
+ "\n",
958
+ "\n",
959
+ "\n",
960
+ "\n",
961
+ "\n",
962
+ "\n",
963
+ "\n",
964
+ "\n",
965
+ "\n",
966
+ "\n",
967
+ "\n",
968
+ "\n",
969
+ "\n",
970
+ "\n",
971
+ "\n",
972
+ "\n",
973
+ "\n",
974
+ "\n",
975
+ "\n",
976
+ "\n",
977
+ "\n",
978
+ "\n",
979
+ "\n",
980
+ "\n",
981
+ "\n",
982
+ "\n",
983
+ "\n",
984
+ "\n",
985
+ "\n",
986
+ "\n",
987
+ "\n",
988
+ "\n",
989
+ "\n",
990
+ "\n",
991
+ "\n",
992
+ "\n",
993
+ "\n",
994
+ "\n",
995
+ "\n",
996
+ "\n",
997
+ "\n",
998
+ "\n",
999
+ "\n",
1000
+ "\n",
1001
+ "\n",
1002
+ "\n",
1003
+ "\n",
1004
+ "\n",
1005
+ "\n",
1006
+ "\n",
1007
+ "\n",
1008
+ "\n",
1009
+ "\n",
1010
+ "\n",
1011
+ "\n",
1012
+ "\n",
1013
+ "\n",
1014
+ "\n",
1015
+ "\n",
1016
+ "\n",
1017
+ "\n",
1018
+ "\n",
1019
+ "\n",
1020
+ "\n",
1021
+ "\n",
1022
+ "\n",
1023
+ "\n",
1024
+ "\n",
1025
+ "\n",
1026
+ "\n",
1027
+ "\n",
1028
+ "\n",
1029
+ "\n",
1030
+ "\n",
1031
+ "\n",
1032
+ "\n",
1033
+ "\n",
1034
+ "\n",
1035
+ "\n",
1036
+ "\n",
1037
+ "\n",
1038
+ "\n",
1039
+ "\n",
1040
+ "\n",
1041
+ "\n",
1042
+ "\n",
1043
+ "\n",
1044
+ "\n",
1045
+ "\n",
1046
+ "\n",
1047
+ "\n",
1048
+ "\n",
1049
+ "\n",
1050
+ "\n",
1051
+ "\n",
1052
+ "\n",
1053
+ "\n",
1054
+ "\n",
1055
+ "\n",
1056
+ "\n",
1057
+ "\n",
1058
+ "\n",
1059
+ "\n",
1060
+ "\n",
1061
+ "\n",
1062
+ "\n",
1063
+ "\n",
1064
+ "\n",
1065
+ "\n",
1066
+ "\n",
1067
+ "\n",
1068
+ "\n",
1069
+ "\n",
1070
+ "\n",
1071
+ "\n",
1072
+ "\n",
1073
+ "\n",
1074
+ "\n",
1075
+ "\n",
1076
+ "\n",
1077
+ "\n",
1078
+ "\n",
1079
+ "\n",
1080
+ "\n",
1081
+ "\n",
1082
+ "\n",
1083
+ "\n",
1084
+ "\n",
1085
+ "\n",
1086
+ "\n",
1087
+ "\n",
1088
+ "\n",
1089
+ "\n",
1090
+ "\n",
1091
+ "\n",
1092
+ "\n",
1093
+ "\n",
1094
+ "\n",
1095
+ "\n",
1096
+ "\n",
1097
+ "\n",
1098
+ "\n",
1099
+ "\n",
1100
+ "\n",
1101
+ "\n",
1102
+ "\n",
1103
+ "\n",
1104
+ "\n",
1105
+ "\n",
1106
+ "\n",
1107
+ "\n",
1108
+ "\n",
1109
+ "\n",
1110
+ "\n",
1111
+ "\n",
1112
+ "\n",
1113
+ "\n",
1114
+ "\n",
1115
+ "\n",
1116
+ "\n",
1117
+ "\n",
1118
+ "\n",
1119
+ "\n",
1120
+ "\n",
1121
+ "\n",
1122
+ "\n",
1123
+ "\n",
1124
+ "\n",
1125
+ "\n",
1126
+ "\n",
1127
+ "\n",
1128
+ "\n",
1129
+ "\n",
1130
+ "\n",
1131
+ "\n",
1132
+ "\n",
1133
+ "\n",
1134
+ "\n",
1135
+ "\n",
1136
+ "\n",
1137
+ "\n",
1138
+ "\n",
1139
+ "\n",
1140
+ "\n",
1141
+ "\n",
1142
+ "\n",
1143
+ "\n",
1144
+ "\n",
1145
+ "\n",
1146
+ "\n",
1147
+ "\n",
1148
+ "\n",
1149
+ "\n",
1150
+ "\n",
1151
+ "\n",
1152
+ "\n",
1153
+ "\n",
1154
+ "\n",
1155
+ "\n",
1156
+ "\n",
1157
+ "\n",
1158
+ "\n",
1159
+ "\n",
1160
+ "\n",
1161
+ "\n",
1162
+ "\n",
1163
+ "\n",
1164
+ "\n",
1165
+ "\n",
1166
+ "\n",
1167
+ "\n",
1168
+ "\n",
1169
+ "\n",
1170
+ "\n",
1171
+ "\n",
1172
+ "\n",
1173
+ "\n",
1174
+ "\n",
1175
+ "\n",
1176
+ "\n",
1177
+ "\n",
1178
+ "\n",
1179
+ "\n",
1180
+ "\n",
1181
+ "\n",
1182
+ "\n",
1183
+ "\n",
1184
+ "\n",
1185
+ "\n",
1186
+ "\n",
1187
+ "\n",
1188
+ "\n",
1189
+ "\n",
1190
+ "\n",
1191
+ "\n",
1192
+ "\n",
1193
+ "\n",
1194
+ "\n",
1195
+ "\n",
1196
+ "\n",
1197
+ "\n",
1198
+ "\n",
1199
+ "\n",
1200
+ "\n",
1201
+ "\n",
1202
+ "\n",
1203
+ "\n",
1204
+ "\n",
1205
+ "\n",
1206
+ "\n",
1207
+ "\n",
1208
+ "\n",
1209
+ "\n",
1210
+ "\n",
1211
+ "\n",
1212
+ "\n",
1213
+ "\n",
1214
+ "\n",
1215
+ "\n",
1216
+ "\n",
1217
+ "\n",
1218
+ "\n",
1219
+ "\n",
1220
+ "\n",
1221
+ "\n",
1222
+ "\n",
1223
+ "\n",
1224
+ "\n",
1225
+ "\n",
1226
+ "\n",
1227
+ "\n",
1228
+ "\n",
1229
+ "\n",
1230
+ "\n",
1231
+ "\n",
1232
+ "\n",
1233
+ "\n",
1234
+ "\n",
1235
+ "\n",
1236
+ "\n",
1237
+ "\n",
1238
+ "\n",
1239
+ "\n",
1240
+ "\n",
1241
+ "\n",
1242
+ "\n",
1243
+ "\n",
1244
+ "\n",
1245
+ "\n",
1246
+ "\n",
1247
+ "\n",
1248
+ "\n",
1249
+ "\n",
1250
+ "\n",
1251
+ "\n",
1252
+ "\n",
1253
+ "\n",
1254
+ "\n",
1255
+ "\n",
1256
+ "\n",
1257
+ "\n",
1258
+ "\n",
1259
+ "\n",
1260
+ "\n",
1261
+ "\n",
1262
+ "\n",
1263
+ "\n",
1264
+ "\n",
1265
+ "\n",
1266
+ "\n",
1267
+ "\n",
1268
+ "\n",
1269
+ "\n",
1270
+ "\n",
1271
+ "\n",
1272
+ "\n",
1273
+ "\n",
1274
+ "\n",
1275
+ "\n",
1276
+ "\n",
1277
+ "\n",
1278
+ "\n",
1279
+ "\n",
1280
+ "\n",
1281
+ "\n",
1282
+ "\n",
1283
+ "\n",
1284
+ "\n",
1285
+ "\n",
1286
+ "\n",
1287
+ "\n",
1288
+ "\n",
1289
+ "\n",
1290
+ "\n",
1291
+ "\n",
1292
+ "\n",
1293
+ "\n",
1294
+ "\n",
1295
+ "\n",
1296
+ "\n",
1297
+ "\n",
1298
+ "\n",
1299
+ "\n",
1300
+ "\n",
1301
+ "\n",
1302
+ "\n",
1303
+ "\n",
1304
+ "\n",
1305
+ "\n",
1306
+ "\n",
1307
+ "\n",
1308
+ "\n",
1309
+ "\n",
1310
+ "\n",
1311
+ "\n",
1312
+ "\n",
1313
+ "\n",
1314
+ "\n",
1315
+ "\n",
1316
+ "\n",
1317
+ "\n",
1318
+ "\n",
1319
+ "\n",
1320
+ "\n",
1321
+ "\n",
1322
+ "\n",
1323
+ "\n",
1324
+ "\n",
1325
+ "\n",
1326
+ "\n",
1327
+ "\n",
1328
+ "\n",
1329
+ "\n",
1330
+ "\n",
1331
+ "\n",
1332
+ "\n",
1333
+ "\n",
1334
+ "\n",
1335
+ "\n",
1336
+ "\n",
1337
+ "\n",
1338
+ "\n",
1339
+ "\n",
1340
+ "\n",
1341
+ "\n",
1342
+ "\n",
1343
+ "\n",
1344
+ "\n",
1345
+ "\n",
1346
+ "\n",
1347
+ "\n",
1348
+ "\n",
1349
+ "\n",
1350
+ "\n",
1351
+ "\n",
1352
+ "\n",
1353
+ "\n",
1354
+ "\n",
1355
+ "\n",
1356
+ "\n",
1357
+ "\n",
1358
+ "\n",
1359
+ "\n",
1360
+ "\n",
1361
+ "\n",
1362
+ "\n",
1363
+ "\n",
1364
+ "\n",
1365
+ "\n",
1366
+ "\n",
1367
+ "\n",
1368
+ "\n",
1369
+ "\n",
1370
+ "\n",
1371
+ "\n",
1372
+ "\n",
1373
+ "\n",
1374
+ "\n",
1375
+ "\n",
1376
+ "\n",
1377
+ "\n",
1378
+ "\n",
1379
+ "\n",
1380
+ "\n",
1381
+ "\n",
1382
+ "\n",
1383
+ "\n",
1384
+ "\n",
1385
+ "\n",
1386
+ "\n",
1387
+ "\n",
1388
+ "\n",
1389
+ "\n",
1390
+ "\n",
1391
+ "\n",
1392
+ "\n",
1393
+ "\n",
1394
+ "\n",
1395
+ "\n",
1396
+ "\n",
1397
+ "\n",
1398
+ "\n",
1399
+ "\n",
1400
+ "\n",
1401
+ "\n",
1402
+ "\n",
1403
+ "\n",
1404
+ "\n",
1405
+ "\n",
1406
+ "\n",
1407
+ "\n",
1408
+ "\n",
1409
+ "\n",
1410
+ "\n",
1411
+ "\n",
1412
+ "\n",
1413
+ "\n",
1414
+ "\n",
1415
+ "\n",
1416
+ "\n",
1417
+ "\n",
1418
+ "\n",
1419
+ "\n",
1420
+ "\n",
1421
+ "\n",
1422
+ "\n",
1423
+ "\n",
1424
+ "\n",
1425
+ "\n",
1426
+ "\n",
1427
+ "\n",
1428
+ "\n",
1429
+ "\n",
1430
+ "\n",
1431
+ "\n",
1432
+ "\n",
1433
+ "\n",
1434
+ "\n",
1435
+ "\n",
1436
+ "\n",
1437
+ "\n",
1438
+ "\n",
1439
+ "\n",
1440
+ "\n",
1441
+ "\n",
1442
+ "\n",
1443
+ "\n",
1444
+ "\n",
1445
+ "\n",
1446
+ "\n",
1447
+ "\n",
1448
+ "\n",
1449
+ "\n",
1450
+ "\n",
1451
+ "\n",
1452
+ "\n",
1453
+ "\n",
1454
+ "\n",
1455
+ "\n",
1456
+ "\n",
1457
+ "\n",
1458
+ "\n",
1459
+ "\n",
1460
+ "\n",
1461
+ "\n",
1462
+ "\n",
1463
+ "\n",
1464
+ "\n",
1465
+ "\n",
1466
+ "\n",
1467
+ "\n",
1468
+ "\n",
1469
+ "\n",
1470
+ "\n",
1471
+ "\n",
1472
+ "\n",
1473
+ "\n",
1474
+ "\n",
1475
+ "\n",
1476
+ "\n",
1477
+ "\n",
1478
+ "\n",
1479
+ "\n",
1480
+ "\n",
1481
+ "\n",
1482
+ "\n",
1483
+ "\n",
1484
+ "\n",
1485
+ "\n",
1486
+ "\n",
1487
+ "\n",
1488
+ "\n",
1489
+ "\n",
1490
+ "\n",
1491
+ "\n",
1492
+ "\n",
1493
+ "\n",
1494
+ "\n",
1495
+ "\n",
1496
+ "\n",
1497
+ "\n",
1498
+ "\n",
1499
+ "\n",
1500
+ "\n",
1501
+ "\n",
1502
+ "\n",
1503
+ "\n",
1504
+ "\n",
1505
+ "\n",
1506
+ "\n",
1507
+ "\n",
1508
+ "\n",
1509
+ "\n",
1510
+ "\n",
1511
+ "\n",
1512
+ "\n",
1513
+ "\n",
1514
+ "\n",
1515
+ "\n",
1516
+ "\n",
1517
+ "\n",
1518
+ "\n",
1519
+ "\n",
1520
+ "\n",
1521
+ "\n",
1522
+ "\n",
1523
+ "\n",
1524
+ "\n",
1525
+ "\n",
1526
+ "\n",
1527
+ "\n",
1528
+ "\n",
1529
+ "\n",
1530
+ "\n",
1531
+ "\n",
1532
+ "\n",
1533
+ "\n",
1534
+ "\n",
1535
+ "\n",
1536
+ "\n",
1537
+ "\n",
1538
+ "\n",
1539
+ "\n",
1540
+ "\n",
1541
+ "\n",
1542
+ "\n",
1543
+ "\n",
1544
+ "\n",
1545
+ "\n",
1546
+ "\n",
1547
+ "\n",
1548
+ "\n",
1549
+ "\n",
1550
+ "\n",
1551
+ "\n",
1552
+ "\n",
1553
+ "\n",
1554
+ "\n",
1555
+ "\n",
1556
+ "\n",
1557
+ "\n",
1558
+ "\n",
1559
+ "\n",
1560
+ "\n",
1561
+ "\n",
1562
+ "\n",
1563
+ "\n",
1564
+ "\n",
1565
+ "\n",
1566
+ "\n",
1567
+ "\n",
1568
+ "\n",
1569
+ "\n",
1570
+ "\n",
1571
+ "\n",
1572
+ "\n",
1573
+ "\n",
1574
+ "\n",
1575
+ "\n",
1576
+ "\n",
1577
+ "\n",
1578
+ "\n",
1579
+ "\n",
1580
+ "\n",
1581
+ "\n",
1582
+ "\n",
1583
+ "\n",
1584
+ "\n",
1585
+ "\n",
1586
+ "\n",
1587
+ "\n",
1588
+ "\n",
1589
+ "\n",
1590
+ "\n",
1591
+ "\n",
1592
+ "\n",
1593
+ "\n",
1594
+ "\n",
1595
+ "\n",
1596
+ "\n",
1597
+ "\n",
1598
+ "\n",
1599
+ "\n",
1600
+ "\n",
1601
+ "\n",
1602
+ "\n",
1603
+ "\n",
1604
+ "\n",
1605
+ "\n",
1606
+ "\n",
1607
+ "\n",
1608
+ "\n",
1609
+ "\n",
1610
+ "\n",
1611
+ "\n",
1612
+ "\n",
1613
+ "\n",
1614
+ "\n",
1615
+ "\n",
1616
+ "\n",
1617
+ "\n",
1618
+ "\n",
1619
+ "\n",
1620
+ "\n",
1621
+ "\n",
1622
+ "\n",
1623
+ "\n",
1624
+ "\n",
1625
+ "\n",
1626
+ "\n",
1627
+ "\n",
1628
+ "\n",
1629
+ "\n",
1630
+ "\n",
1631
+ "\n",
1632
+ "\n",
1633
+ "\n",
1634
+ "\n",
1635
+ "\n",
1636
+ "\n",
1637
+ "\n",
1638
+ "\n",
1639
+ "\n",
1640
+ "\n",
1641
+ "\n",
1642
+ "\n",
1643
+ "\n",
1644
+ "\n",
1645
+ "\n",
1646
+ "\n",
1647
+ "\n",
1648
+ "\n",
1649
+ "\n",
1650
+ "\n",
1651
+ "\n",
1652
+ "\n",
1653
+ "\n",
1654
+ "\n",
1655
+ "\n",
1656
+ "\n",
1657
+ "\n",
1658
+ "\n",
1659
+ "\n",
1660
+ "\n",
1661
+ "\n",
1662
+ "\n",
1663
+ "\n",
1664
+ "\n",
1665
+ "\n",
1666
+ "\n",
1667
+ "\n",
1668
+ "\n",
1669
+ "\n",
1670
+ "\n",
1671
+ "\n",
1672
+ "\n",
1673
+ "\n",
1674
+ "\n",
1675
+ "\n",
1676
+ "\n",
1677
+ "\n",
1678
+ "\n",
1679
+ "\n",
1680
+ "\n",
1681
+ "\n",
1682
+ "\n",
1683
+ "\n",
1684
+ "\n",
1685
+ "\n",
1686
+ "\n",
1687
+ "\n",
1688
+ "\n",
1689
+ "\n",
1690
+ "\n",
1691
+ "\n",
1692
+ "\n",
1693
+ "\n",
1694
+ "\n",
1695
+ "\n",
1696
+ "\n",
1697
+ "\n",
1698
+ "\n",
1699
+ "\n",
1700
+ "\n",
1701
+ "\n",
1702
+ "\n",
1703
+ "\n",
1704
+ "\n",
1705
+ "\n",
1706
+ "\n",
1707
+ "\n",
1708
+ "\n",
1709
+ "\n",
1710
+ "\n",
1711
+ "\n",
1712
+ "\n",
1713
+ "\n",
1714
+ "\n",
1715
+ "\n",
1716
+ "\n",
1717
+ "\n",
1718
+ "\n",
1719
+ "\n",
1720
+ "\n",
1721
+ "\n",
1722
+ "\n",
1723
+ "\n",
1724
+ "\n",
1725
+ "\n",
1726
+ "\n",
1727
+ "\n",
1728
+ "\n",
1729
+ "\n",
1730
+ "\n",
1731
+ "\n",
1732
+ "\n",
1733
+ "\n",
1734
+ "\n",
1735
+ "\n",
1736
+ "\n",
1737
+ "\n",
1738
+ "\n",
1739
+ "\n",
1740
+ "\n",
1741
+ "\n",
1742
+ "\n",
1743
+ "\n",
1744
+ "\n",
1745
+ "\n",
1746
+ "\n",
1747
+ "\n",
1748
+ "\n",
1749
+ "\n",
1750
+ "\n",
1751
+ "\n",
1752
+ "\n",
1753
+ "\n",
1754
+ "\n",
1755
+ "\n",
1756
+ "\n",
1757
+ "\n",
1758
+ "\n",
1759
+ "\n",
1760
+ "\n",
1761
+ "\n",
1762
+ "\n",
1763
+ "\n",
1764
+ "\n",
1765
+ "\n",
1766
+ "\n",
1767
+ "\n",
1768
+ "\n",
1769
+ "\n",
1770
+ "\n",
1771
+ "\n",
1772
+ "\n",
1773
+ "\n",
1774
+ "\n",
1775
+ "\n",
1776
+ "\n",
1777
+ "\n",
1778
+ "\n",
1779
+ "\n",
1780
+ "\n",
1781
+ "\n",
1782
+ "\n",
1783
+ "\n",
1784
+ "\n",
1785
+ "\n",
1786
+ "\n",
1787
+ "\n",
1788
+ "\n",
1789
+ "\n",
1790
+ "\n",
1791
+ "\n",
1792
+ "\n",
1793
+ "\n",
1794
+ "\n",
1795
+ "\n",
1796
+ "\n",
1797
+ "\n",
1798
+ "\n",
1799
+ "\n",
1800
+ "\n",
1801
+ "\n",
1802
+ "\n",
1803
+ "\n",
1804
+ "\n",
1805
+ "\n",
1806
+ "\n",
1807
+ "\n",
1808
+ "\n",
1809
+ "\n",
1810
+ "\n",
1811
+ "\n",
1812
+ "\n",
1813
+ "\n",
1814
+ "\n",
1815
+ "\n",
1816
+ "\n",
1817
+ "\n",
1818
+ "\n",
1819
+ "\n",
1820
+ "\n",
1821
+ "\n",
1822
+ "\n",
1823
+ "\n",
1824
+ "\n",
1825
+ "\n",
1826
+ "\n",
1827
+ "\n",
1828
+ "\n",
1829
+ "\n",
1830
+ "\n",
1831
+ "\n",
1832
+ "\n",
1833
+ "\n",
1834
+ "\n",
1835
+ "\n",
1836
+ "\n",
1837
+ "\n",
1838
+ "\n",
1839
+ "\n",
1840
+ "\n",
1841
+ "\n",
1842
+ "\n",
1843
+ "\n",
1844
+ "\n",
1845
+ "\n",
1846
+ "\n",
1847
+ "\n",
1848
+ "\n",
1849
+ "\n",
1850
+ "\n",
1851
+ "\n",
1852
+ "\n",
1853
+ "\n",
1854
+ "\n",
1855
+ "\n",
1856
+ "\n",
1857
+ "\n",
1858
+ "\n",
1859
+ "\n",
1860
+ "\n",
1861
+ "\n",
1862
+ "\n",
1863
+ "\n",
1864
+ "\n",
1865
+ "\n",
1866
+ "\n",
1867
+ "\n",
1868
+ "\n",
1869
+ "\n",
1870
+ "\n",
1871
+ "\n",
1872
+ "\n",
1873
+ "\n",
1874
+ "\n",
1875
+ "\n",
1876
+ "\n",
1877
+ "\n",
1878
+ "\n",
1879
+ "\n",
1880
+ "\n",
1881
+ "\n",
1882
+ "\n",
1883
+ "\n",
1884
+ "\n",
1885
+ "\n",
1886
+ "\n",
1887
+ "\n",
1888
+ "\n",
1889
+ "\n",
1890
+ "\n",
1891
+ "\n",
1892
+ "\n",
1893
+ "\n",
1894
+ "\n",
1895
+ "\n",
1896
+ "\n",
1897
+ "\n",
1898
+ "\n",
1899
+ "\n",
1900
+ "\n",
1901
+ "\n",
1902
+ "\n",
1903
+ "\n",
1904
+ "\n",
1905
+ "\n",
1906
+ "\n",
1907
+ "\n",
1908
+ "\n",
1909
+ "\n",
1910
+ "\n",
1911
+ "\n",
1912
+ "\n",
1913
+ "\n",
1914
+ "\n",
1915
+ "\n",
1916
+ "\n",
1917
+ "\n",
1918
+ "\n",
1919
+ "\n",
1920
+ "\n",
1921
+ "\n",
1922
+ "\n",
1923
+ "\n",
1924
+ "\n",
1925
+ "\n",
1926
+ "\n",
1927
+ "\n",
1928
+ "\n",
1929
+ "\n",
1930
+ "\n",
1931
+ "\n",
1932
+ "\n",
1933
+ "\n",
1934
+ "\n",
1935
+ "\n",
1936
+ "\n",
1937
+ "\n",
1938
+ "\n",
1939
+ "\n",
1940
+ "\n",
1941
+ "\n",
1942
+ "\n",
1943
+ "\n",
1944
+ "\n",
1945
+ "\n",
1946
+ "\n",
1947
+ "\n",
1948
+ "\n",
1949
+ "\n",
1950
+ "\n",
1951
+ "\n",
1952
+ "\n",
1953
+ "\n",
1954
+ "\n",
1955
+ "\n",
1956
+ "\n",
1957
+ "\n",
1958
+ "\n",
1959
+ "\n",
1960
+ "\n",
1961
+ "\n",
1962
+ "\n",
1963
+ "\n",
1964
+ "\n",
1965
+ "\n",
1966
+ "\n",
1967
+ "\n",
1968
+ "\n",
1969
+ "\n",
1970
+ "\n",
1971
+ "\n",
1972
+ "\n",
1973
+ "\n",
1974
+ "\n",
1975
+ "\n",
1976
+ "\n",
1977
+ "\n",
1978
+ "\n",
1979
+ "\n",
1980
+ "\n",
1981
+ "\n",
1982
+ "\n",
1983
+ "\n",
1984
+ "\n",
1985
+ "\n",
1986
+ "\n",
1987
+ "\n",
1988
+ "\n",
1989
+ "\n",
1990
+ "\n",
1991
+ "\n",
1992
+ "\n",
1993
+ "\n",
1994
+ "\n",
1995
+ "\n",
1996
+ "\n",
1997
+ "\n",
1998
+ "\n",
1999
+ "\n",
2000
+ "\n",
2001
+ "\n",
2002
+ "\n",
2003
+ "\n",
2004
+ "\n",
2005
+ "\n",
2006
+ "\n",
2007
+ "\n",
2008
+ "\n",
2009
+ "\n",
2010
+ "\n",
2011
+ "\n",
2012
+ "\n",
2013
+ "\n",
2014
+ "\n",
2015
+ "\n",
2016
+ "\n",
2017
+ "\n",
2018
+ "\n",
2019
+ "\n",
2020
+ "\n",
2021
+ "\n",
2022
+ "\n",
2023
+ "\n",
2024
+ "\n",
2025
+ "\n",
2026
+ "\n",
2027
+ "\n",
2028
+ "\n",
2029
+ "\n",
2030
+ "\n",
2031
+ "\n",
2032
+ "\n",
2033
+ "\n",
2034
+ "\n",
2035
+ "\n",
2036
+ "\n",
2037
+ "\n",
2038
+ "\n",
2039
+ "\n",
2040
+ "\n",
2041
+ "\n",
2042
+ "\n",
2043
+ "\n",
2044
+ "\n",
2045
+ "\n",
2046
+ "\n",
2047
+ "\n",
2048
+ "\n",
2049
+ "\n",
2050
+ "\n",
2051
+ "\n",
2052
+ "\n",
2053
+ "\n",
2054
+ "\n",
2055
+ "\n",
2056
+ "\n",
2057
+ "\n",
2058
+ "\n",
2059
+ "\n",
2060
+ "\n",
2061
+ "\n",
2062
+ "\n",
2063
+ "\n",
2064
+ "\n",
2065
+ "\n",
2066
+ "\n",
2067
+ "\n",
2068
+ "\n",
2069
+ "\n",
2070
+ "\n",
2071
+ "\n",
2072
+ "\n",
2073
+ "\n",
2074
+ "\n",
2075
+ "\n",
2076
+ "\n",
2077
+ "\n",
2078
+ "\n",
2079
+ "\n",
2080
+ "\n",
2081
+ "\n",
2082
+ "\n",
2083
+ "\n",
2084
+ "\n",
2085
+ "\n",
2086
+ "\n",
2087
+ "\n",
2088
+ "\n",
2089
+ "\n",
2090
+ "\n",
2091
+ "\n",
2092
+ "\n",
2093
+ "\n",
2094
+ "\n",
2095
+ "\n",
2096
+ "\n",
2097
+ "\n",
2098
+ "\n",
2099
+ "\n",
2100
+ "\n",
2101
+ "\n",
2102
+ "\n",
2103
+ "\n",
2104
+ "\n",
2105
+ "\n",
2106
+ "\n",
2107
+ "\n",
2108
+ "\n",
2109
+ "\n",
2110
+ "\n",
2111
+ "\n",
2112
+ "\n",
2113
+ "\n",
2114
+ "\n",
2115
+ "\n",
2116
+ "\n",
2117
+ "\n",
2118
+ "\n",
2119
+ "\n",
2120
+ "\n",
2121
+ "\n",
2122
+ "\n",
2123
+ "\n",
2124
+ "\n",
2125
+ "\n",
2126
+ "\n",
2127
+ "\n",
2128
+ "\n",
2129
+ "\n",
2130
+ "\n",
2131
+ "\n",
2132
+ "\n",
2133
+ "\n",
2134
+ "\n",
2135
+ "\n",
2136
+ "\n",
2137
+ "\n",
2138
+ "\n",
2139
+ "\n",
2140
+ "\n",
2141
+ "\n",
2142
+ "\n",
2143
+ "\n",
2144
+ "\n",
2145
+ "\n",
2146
+ "<on_llm_end>\n",
2147
+ "\n",
2148
+ "\n",
2149
+ "Completed in 1051.367s\n",
2150
+ "\n",
2151
+ "Question: more on penetration testing\n",
2152
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more. The goal of PCI DSS is to protect payment data from unauthorized access, use, disclosure, disruption, modification, or destruction.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The key changes made in PCI DSS version 4.0 compared to version 3.2.1 include updated principal requirement titles, replaced \"firewalls\" and \"routers\" with \"network security controls\", and evolved requirements related to roles and responsibilities. Additionally, there are errata updates to correct entries in the Summary of New Requirements table and to add descriptions of changes made to certain requirements.'), ('new requirements for vulnerability assessments', 'The updated requirements for vulnerability assessments in PCI DSS version 4.0 are as follows:')]}\n",
2153
+ "What are the updated requirements for vulnerability assessments in PCI DSS version 4.0?\n",
2154
+ "\n",
2155
+ "\n",
2156
+ "\n",
2157
+ "<on_llm_end>\n",
2158
+ "\n",
2159
+ "\n",
2160
+ " The updated requirements for vulnerability assessments in PCI DSS version 4.0 can be found in Section 11 of the summary of changes document. According to the document, there are new requirements for managing all other applicable vulnerabilities (those not ranked as high-risk or critical) found during internal vulnerability scans, and for performing vulnerability assessments via authenticated scanning. Additionally, there is a new requirement for maintaining an inventory of trusted keys and certificates.\n",
2161
+ "\n",
2162
+ "\n",
2163
+ "\n",
2164
+ "<on_llm_end>\n",
2165
+ "\n",
2166
+ "\n",
2167
+ "Completed in 64.196s\n",
2168
+ "Total time used: 1234.418 s\n",
2169
+ "Number of tokens generated: 2457\n",
2170
+ "Average generation speed: 1.990 tokens/s\n",
2171
+ "CPU times: user 18.5 s, sys: 5.39 s, total: 23.8 s\n",
2172
+ "Wall time: 23min 32s\n"
2173
+ ]
2174
+ }
2175
+ ],
2176
+ "source": [
2177
+ "%%time\n",
2178
+ "\n",
2179
+ "os.environ[\"HF_RP\"] = \"1.05\"\n",
2180
+ "!python qa_chain_test.py"
2181
+ ]
2182
+ },
2183
+ {
2184
+ "cell_type": "code",
2185
+ "execution_count": 4,
2186
+ "id": "8a022a7b",
2187
+ "metadata": {},
2188
+ "outputs": [
2189
+ {
2190
+ "name": "stdout",
2191
+ "output_type": "stream",
2192
+ "text": [
2193
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
2194
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
2195
+ "MPS is NOT available\n",
2196
+ "CUDA is available\n",
2197
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
2198
+ "CUDA is available, we have found 1 GPU(s)\n",
2199
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
2200
+ "CUDA version: 12.1\n",
2201
+ "hf_embeddings_device_type: cuda:0\n",
2202
+ "hf_pipeline_device_type: cuda:0\n",
2203
+ "load INSTRUCTOR_Transformer\n",
2204
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
2205
+ " return self.fget.__get__(instance, owner)()\n",
2206
+ "max_seq_length 512\n",
2207
+ "Completed in 0.647s\n",
2208
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
2209
+ "Completed in 0.021s\n",
2210
+ "initializing LLM: huggingface\n",
2211
+ " hf_pipeline_device_type: cuda:0\n",
2212
+ " load_quantized_model: None\n",
2213
+ " torch_dtype: torch.float16\n",
2214
+ " n_threds: 4\n",
2215
+ " loading model: meta-llama/Llama-2-7b-chat-hf\n",
2216
+ " HF auth token: None\n",
2217
+ " repetition_penalty: 1.1\n",
2218
+ "Loading checkpoint shards: 100%|█████████████████| 2/2 [03:45<00:00, 112.81s/it]\n",
2219
+ "Model memory footprint: 13543948288\n",
2220
+ "initialization complete\n",
2221
+ "Completed in 260.223s\n",
2222
+ "\n",
2223
+ "Question: What's PCI DSS?\n",
2224
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
2225
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more.\n",
2226
+ "\n",
2227
+ "\n",
2228
+ "\n",
2229
+ "<on_llm_end>\n",
2230
+ "\n",
2231
+ "\n",
2232
+ "Completed in 62.521s\n",
2233
+ "\n",
2234
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
2235
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more.')]}\n",
2236
+ "What are the key changes made in PCI DSS version 4.0 compared to version 3.2.1?\n",
2237
+ "\n",
2238
+ "\n",
2239
+ "\n",
2240
+ "<on_llm_end>\n",
2241
+ "\n",
2242
+ "\n",
2243
+ " The key changes made in PCI DSS version 4.0 compared to version 3.2.1 include updated principal requirement titles, replaced \"firewalls\" and \"routers\" with \"network security controls\", and evolved requirements related to roles and responsibilities. Additionally, there were errata updates made in May 2022 and December 2022 to correct errors and provide additional information. However, I cannot provide a detailed answer without knowing your specific context or industry.\n",
2244
+ "\n",
2245
+ "\n",
2246
+ "\n",
2247
+ "<on_llm_end>\n",
2248
+ "\n",
2249
+ "\n",
2250
+ "Completed in 50.686s\n",
2251
+ "\n",
2252
+ "Question: new requirements for vulnerability assessments\n",
2253
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The key changes made in PCI DSS version 4.0 compared to version 3.2.1 include updated principal requirement titles, replaced \"firewalls\" and \"routers\" with \"network security controls\", and evolved requirements related to roles and responsibilities. Additionally, there were errata updates made in May 2022 and December 2022 to correct errors and provide additional information. However, I cannot provide a detailed answer without knowing your specific context or industry.')]}\n",
2254
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
2255
+ "\n",
2256
+ "\n",
2257
+ "\n",
2258
+ "<on_llm_end>\n",
2259
+ "\n",
2260
+ "\n",
2261
+ " According to the provided summary of changes, there are no new requirements for vulnerability assessments in PCI DSS version 4.0. The existing requirements for vulnerability assessments remain unchanged from version 3.2.1 to version 4.0.\n",
2262
+ "\n",
2263
+ "\n",
2264
+ "\n",
2265
+ "<on_llm_end>\n",
2266
+ "\n",
2267
+ "\n",
2268
+ "Completed in 42.544s\n",
2269
+ "\n",
2270
+ "Question: more on penetration testing\n",
2271
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The key changes made in PCI DSS version 4.0 compared to version 3.2.1 include updated principal requirement titles, replaced \"firewalls\" and \"routers\" with \"network security controls\", and evolved requirements related to roles and responsibilities. Additionally, there were errata updates made in May 2022 and December 2022 to correct errors and provide additional information. However, I cannot provide a detailed answer without knowing your specific context or industry.'), ('new requirements for vulnerability assessments', 'According to the provided summary of changes, there are no new requirements for vulnerability assessments in PCI DSS version 4.0. The existing requirements for vulnerability assessments remain unchanged from version 3.2.1 to version 4.0.')]}\n",
2272
+ "What are the key differences between penetration testing and vulnerability assessments in the context of PCI DSS compliance?\n",
2273
+ "\n",
2274
+ "\n",
2275
+ "\n",
2276
+ "<on_llm_end>\n",
2277
+ "\n",
2278
+ "\n",
2279
+ "Penetration testing and vulnerability assessments are both important components of PCI DSS compliance, but they serve different purposes and have distinct methodologies.\n",
2280
+ "Penetration testing involves simulating a cyber attack on an organization's network, systems, and applications to identify vulnerabilities that could be exploited by attackers. This type of testing is focused on identifying potential threats and weaknesses in the system, rather than simply identifying vulnerabilities. The goal of penetration testing is to provide recommendations for improving security posture and reducing the likelihood of a successful attack.\n",
2281
+ "Vulnerability assessments, on the other hand, involve identifying and classifying potential vulnerabilities in the system based on industry standards and best practices. This type of assessment is focused on identifying potential weaknesses in the system and prioritizing remediation efforts based on risk. Vulnerability assessments typically use automated tools to scan the system for known vulnerabilities and may also include manual testing to identify additional vulnerabilities.\n",
2282
+ "In summary, penetration testing is a more comprehensive and proactive approach to identifying security threats, while vulnerability assessments are a more reactive approach to identifying potential vulnerabilities. Both are important components of PCI DSS compliance and should be conducted regularly to ensure the security of cardholder data.\n",
2283
+ "\n",
2284
+ "\n",
2285
+ "\n",
2286
+ "<on_llm_end>\n",
2287
+ "\n",
2288
+ "\n",
2289
+ "Completed in 116.722s\n",
2290
+ "Total time used: 272.474 s\n",
2291
+ "Number of tokens generated: 623\n",
2292
+ "Average generation speed: 2.286 tokens/s\n",
2293
+ "CPU times: user 6.52 s, sys: 1.93 s, total: 8.45 s\n",
2294
+ "Wall time: 8min 57s\n"
2295
+ ]
2296
+ }
2297
+ ],
2298
+ "source": [
2299
+ "%%time\n",
2300
+ "\n",
2301
+ "os.environ[\"HF_RP\"] = \"1.10\"\n",
2302
+ "!python qa_chain_test.py"
2303
+ ]
2304
+ },
2305
+ {
2306
+ "cell_type": "code",
2307
+ "execution_count": 5,
2308
+ "id": "db48dcc4",
2309
+ "metadata": {},
2310
+ "outputs": [
2311
+ {
2312
+ "name": "stdout",
2313
+ "output_type": "stream",
2314
+ "text": [
2315
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
2316
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
2317
+ "MPS is NOT available\n",
2318
+ "CUDA is available\n",
2319
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
2320
+ "CUDA is available, we have found 1 GPU(s)\n",
2321
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
2322
+ "CUDA version: 12.1\n",
2323
+ "hf_embeddings_device_type: cuda:0\n",
2324
+ "hf_pipeline_device_type: cuda:0\n",
2325
+ "load INSTRUCTOR_Transformer\n",
2326
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
2327
+ " return self.fget.__get__(instance, owner)()\n",
2328
+ "max_seq_length 512\n",
2329
+ "Completed in 0.611s\n",
2330
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
2331
+ "Completed in 0.027s\n",
2332
+ "initializing LLM: huggingface\n",
2333
+ " hf_pipeline_device_type: cuda:0\n",
2334
+ " load_quantized_model: None\n",
2335
+ " torch_dtype: torch.float16\n",
2336
+ " n_threds: 4\n",
2337
+ " loading model: meta-llama/Llama-2-7b-chat-hf\n",
2338
+ " HF auth token: None\n",
2339
+ " repetition_penalty: 1.15\n",
2340
+ "Loading checkpoint shards: 100%|█████████████████| 2/2 [03:40<00:00, 110.30s/it]\n",
2341
+ "Model memory footprint: 13543948288\n",
2342
+ "initialization complete\n",
2343
+ "Completed in 254.385s\n",
2344
+ "\n",
2345
+ "Question: What's PCI DSS?\n",
2346
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
2347
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of security standards designed to ensure that companies that handle credit card transactions keep customer data safe from cyber threats. These standards are developed and maintained by the PCI Security Standards Council, a global forum that brings together industry leaders to address security concerns. By adhering to these standards, companies can help prevent data breaches and protect their customers' sensitive information.\n",
2348
+ "\n",
2349
+ "\n",
2350
+ "\n",
2351
+ "<on_llm_end>\n",
2352
+ "\n",
2353
+ "\n",
2354
+ "Completed in 63.409s\n",
2355
+ "\n",
2356
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
2357
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of security standards designed to ensure that companies that handle credit card transactions keep customer data safe from cyber threats. These standards are developed and maintained by the PCI Security Standards Council, a global forum that brings together industry leaders to address security concerns. By adhering to these standards, companies can help prevent data breaches and protect their customers' sensitive information.\")]}\n",
2358
+ "What are the key changes between PCI DSS versions 3.2.1 and 4.0?\n",
2359
+ "\n",
2360
+ "\n",
2361
+ "\n",
2362
+ "<on_llm_end>\n",
2363
+ "\n",
2364
+ "\n",
2365
+ "The key changes between PCI DSS versions 3.2.1 and 4.0 include updates to align with changes from PCI DSS v3.2 to PCI DSS v4.0, minor corrections and edits made for clarification and/or format, and additional changes per requirement. However, if you don't know the answer, it's okay to say so instead of trying to make something up.\n",
2366
+ "\n",
2367
+ "\n",
2368
+ "\n",
2369
+ "<on_llm_end>\n",
2370
+ "\n",
2371
+ "\n",
2372
+ "Completed in 49.842s\n",
2373
+ "\n",
2374
+ "Question: new requirements for vulnerability assessments\n",
2375
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of security standards designed to ensure that companies that handle credit card transactions keep customer data safe from cyber threats. These standards are developed and maintained by the PCI Security Standards Council, a global forum that brings together industry leaders to address security concerns. By adhering to these standards, companies can help prevent data breaches and protect their customers' sensitive information.\"), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', \"The key changes between PCI DSS versions 3.2.1 and 4.0 include updates to align with changes from PCI DSS v3.2 to PCI DSS v4.0, minor corrections and edits made for clarification and/or format, and additional changes per requirement. However, if you don't know the answer, it's okay to say so instead of trying to make something up.\")]}\n",
2376
+ "What are some of the new requirements for vulnerability assessments in PCI DSS version 4.0 compared to previous versions?\n",
2377
+ "\n",
2378
+ "\n",
2379
+ "\n",
2380
+ "<on_llm_end>\n",
2381
+ "\n",
2382
+ "\n",
2383
+ "In PCI DSS version 4.0, there are several new requirements related to vulnerability assessments, including:\n",
2384
+ "\n",
2385
+ "* A new requirement (4.1.2) for roles and responsibilities related to vulnerability management.\n",
2386
+ "* An updated bullet point (4.2.1) regarding the use of certificates for PAN transmissions over open, public networks, which includes a new best practice for maintaining an inventory of trusted keys and certificates.\n",
2387
+ "* A new requirement (4.2.1.1) to ensure that only authorized personnel have access to trusted keys and certificates.\n",
2388
+ "These changes aim to enhance the security posture of organizations handling cardholder data by providing more detailed guidelines for identifying and managing potential vulnerabilities.\n",
2389
+ "\n",
2390
+ "\n",
2391
+ "\n",
2392
+ "<on_llm_end>\n",
2393
+ "\n",
2394
+ "\n",
2395
+ "Completed in 77.258s\n",
2396
+ "\n",
2397
+ "Question: more on penetration testing\n",
2398
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of security standards designed to ensure that companies that handle credit card transactions keep customer data safe from cyber threats. These standards are developed and maintained by the PCI Security Standards Council, a global forum that brings together industry leaders to address security concerns. By adhering to these standards, companies can help prevent data breaches and protect their customers' sensitive information.\"), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', \"The key changes between PCI DSS versions 3.2.1 and 4.0 include updates to align with changes from PCI DSS v3.2 to PCI DSS v4.0, minor corrections and edits made for clarification and/or format, and additional changes per requirement. However, if you don't know the answer, it's okay to say so instead of trying to make something up.\"), ('new requirements for vulnerability assessments', 'In PCI DSS version 4.0, there are several new requirements related to vulnerability assessments, including:\\n\\n* A new requirement (4.1.2) for roles and responsibilities related to vulnerability management.\\n* An updated bullet point (4.2.1) regarding the use of certificates for PAN transmissions over open, public networks, which includes a new best practice for maintaining an inventory of trusted keys and certificates.\\n* A new requirement (4.2.1.1) to ensure that only authorized personnel have access to trusted keys and certificates.\\nThese changes aim to enhance the security posture of organizations handling cardholder data by providing more detailed guidelines for identifying and managing potential vulnerabilities.')]}\n",
2399
+ "What are some common techniques used in penetration testing to identify vulnerabilities in a system or network?\n",
2400
+ "\n",
2401
+ "\n",
2402
+ "\n",
2403
+ "<on_llm_end>\n",
2404
+ "\n",
2405
+ "\n",
2406
+ "Penetration testing involves various techniques to identify vulnerabilities in a system or network. Some common techniques include:\n",
2407
+ "\n",
2408
+ "• Vulnerability scanning: This technique involves identifying potential vulnerabilities in a system or network using automated tools. The tool scans the network or system and reports any identified vulnerabilities.\n",
2409
+ "• Social engineering: This technique involves manipulating individuals into divulging sensitive information or gaining unauthorized access to a system or network. Social engineers may use various tactics such as phishing emails, phone calls, or physical interactions to obtain information.\n",
2410
+ "• Network traffic analysis: This technique involves monitoring and analyzing network traffic to identify suspicious activity or potential vulnerabilities. Tools such as Wireshark or Tcpdump can be used to capture and analyze network packets.\n",
2411
+ "• Web application scanning: This technique involves identifying vulnerabilities in web applications using automated tools. The tool scans the application and reports any identified vulnerabilities.\n",
2412
+ "• Malware analysis: This technique involves analyzing malware samples to identify their capabilities and potential vulnerabilities. This can help identify potential attack vectors and inform mitigation strategies.\n",
2413
+ "• Compliance checking: This technique involves verifying that a system or network complies with relevant industry standards or regulations. By identifying non-compliant areas, organizations can prioritize remediation efforts.\n",
2414
+ "• Penetration testing frameworks: These frameworks provide structured approaches to conducting penetration tests. They typically involve creating a detailed test plan, executing the test, and reporting findings. Common penetration testing frameworks include OWASP ZAP, NIST SP 800-115, and OSSTMM.\n",
2415
+ "\n",
2416
+ "\n",
2417
+ "\n",
2418
+ "<on_llm_end>\n",
2419
+ "\n",
2420
+ "\n",
2421
+ "Completed in 129.022s\n",
2422
+ "Total time used: 319.531 s\n",
2423
+ "Number of tokens generated: 792\n",
2424
+ "Average generation speed: 2.479 tokens/s\n",
2425
+ "CPU times: user 7.12 s, sys: 2.03 s, total: 9.16 s\n",
2426
+ "Wall time: 9min 38s\n"
2427
+ ]
2428
+ }
2429
+ ],
2430
+ "source": [
2431
+ "%%time\n",
2432
+ "\n",
2433
+ "os.environ[\"HF_RP\"] = \"1.15\"\n",
2434
+ "!python qa_chain_test.py"
2435
+ ]
2436
+ }
2437
+ ],
2438
+ "metadata": {
2439
+ "kernelspec": {
2440
+ "display_name": "Python 3 (ipykernel)",
2441
+ "language": "python",
2442
+ "name": "python3"
2443
+ },
2444
+ "language_info": {
2445
+ "codemirror_mode": {
2446
+ "name": "ipython",
2447
+ "version": 3
2448
+ },
2449
+ "file_extension": ".py",
2450
+ "mimetype": "text/x-python",
2451
+ "name": "python",
2452
+ "nbconvert_exporter": "python",
2453
+ "pygments_lexer": "ipython3",
2454
+ "version": "3.11.7"
2455
+ }
2456
+ },
2457
+ "nbformat": 4,
2458
+ "nbformat_minor": 5
2459
+ }
notebook/nvidia-4080-orca-2-13b_tgi.ipynb ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "874cd58e",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "workding dir: /home/inflaton/code/projects/chat-with-orca-2\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "import os\n",
19
+ "import sys\n",
20
+ "from pathlib import Path\n",
21
+ "\n",
22
+ "workding_dir = str(Path.cwd().parent)\n",
23
+ "os.chdir(workding_dir)\n",
24
+ "sys.path.append(workding_dir)\n",
25
+ "print(\"workding dir:\", workding_dir)"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": 2,
31
+ "id": "19f967ca",
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"hftgi\"\n",
36
+ "os.environ[\"HFTGI_SERVER_URL\"] = \"https://enabled-factually-cougar.ngrok-free.app\""
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": 3,
42
+ "id": "a6d96660",
43
+ "metadata": {},
44
+ "outputs": [
45
+ {
46
+ "name": "stdout",
47
+ "output_type": "stream",
48
+ "text": [
49
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
50
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
51
+ "MPS is NOT available\n",
52
+ "CUDA is available\n",
53
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
54
+ "CUDA is available, we have found 1 GPU(s)\n",
55
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
56
+ "CUDA version: 12.1\n",
57
+ "hf_embeddings_device_type: cuda:0\n",
58
+ "hf_pipeline_device_type: cuda:0\n",
59
+ "load INSTRUCTOR_Transformer\n",
60
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
61
+ " return self.fget.__get__(instance, owner)()\n",
62
+ "max_seq_length 512\n",
63
+ "Completed in 0.554s\n",
64
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
65
+ "Completed in 0.018s\n",
66
+ "initializing LLM: hftgi\n",
67
+ " hf_pipeline_device_type: cuda:0\n",
68
+ " load_quantized_model: None\n",
69
+ " torch_dtype: torch.float16\n",
70
+ " n_threds: 4\n",
71
+ " repetition_penalty: 1.05\n",
72
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/pydantic/_internal/_fields.py:149: UserWarning: Field \"model_id\" has conflict with protected namespace \"model_\".\n",
73
+ "\n",
74
+ "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n",
75
+ " warnings.warn(\n",
76
+ "initialization complete\n",
77
+ "Completed in 0.011s\n",
78
+ "\n",
79
+ "Question: What's PCI DSS?\n",
80
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
81
+ " PCI DSS is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It helps ensure the security of cardholder data and reduces the risk of cyberattacks.\n",
82
+ "<on_llm_end>\n",
83
+ "\n",
84
+ "\n",
85
+ "Completed in 4.609s\n",
86
+ "\n",
87
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
88
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It helps ensure the security of cardholder data and reduces the risk of cyberattacks.')]}\n",
89
+ " ¿Puedes resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS?\n",
90
+ "<on_llm_end>\n",
91
+ "\n",
92
+ "\n",
93
+ " Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Además, hay cambios en las secciones introductorias, general y adicionales de los requisitos.\n",
94
+ "<on_llm_end>\n",
95
+ "\n",
96
+ "\n",
97
+ "Completed in 9.076s\n",
98
+ "\n",
99
+ "Question: new requirements for vulnerability assessments\n",
100
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It helps ensure the security of cardholder data and reduces the risk of cyberattacks.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Además, hay cambios en las secciones introductorias, general y adicionales de los requisitos.')]}\n",
101
+ " ¿Cuáles son las nuevas recomendaciones para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS?\n",
102
+ "<on_llm_end>\n",
103
+ "\n",
104
+ "\n",
105
+ "\n",
106
+ "Las nuevas recomendaciones para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS incluyen realizar escaneos de vulnerabilidad externa después de cualquier cambio significativo y resolver las vulnerabilidades con una puntuación de 4.0 o superior según el CVSS. Además, se recomienda realizar pruebas de penetración externa e interna regularmente y corregir las vulnerabilidades y debilidades de seguridad que sean explotables.\n",
107
+ "<on_llm_end>\n",
108
+ "\n",
109
+ "\n",
110
+ "Completed in 9.533s\n",
111
+ "\n",
112
+ "Question: more on penetration testing\n",
113
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It helps ensure the security of cardholder data and reduces the risk of cyberattacks.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Además, hay cambios en las secciones introductorias, general y adicionales de los requisitos.'), ('new requirements for vulnerability assessments', 'Las nuevas recomendaciones para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS incluyen realizar escaneos de vulnerabilidad externa después de cualquier cambio significativo y resolver las vulnerabilidades con una puntuación de 4.0 o superior según el CVSS. Además, se recomienda realizar pruebas de penetración externa e interna regularmente y corregir las vulnerabilidades y debilidades de seguridad que sean explotables.')]}\n",
114
+ " ¿Puedes dar más información sobre las pruebas de penetración?\n",
115
+ "<on_llm_end>\n",
116
+ "\n",
117
+ "\n",
118
+ " Sí, puedo dar más información sobre las pruebas de penetración. Para obtener más información, consulte la documentación y realice entrevistas con el personal involucrado en la implementación y ejecución de las pruebas de penetración. Asegúrese de identificar y documentar los números de referencia de la evidencia correspondientes a las secciones 6 para todas las entrevistas y documentaciones examinadas.\n",
119
+ "<on_llm_end>\n",
120
+ "\n",
121
+ "\n",
122
+ "Completed in 7.629s\n",
123
+ "Total time used: 30.847 s\n",
124
+ "Number of tokens generated: 455\n",
125
+ "Average generation speed: 14.750 tokens/s\n",
126
+ "CPU times: user 651 ms, sys: 120 ms, total: 771 ms\n",
127
+ "Wall time: 34.5 s\n"
128
+ ]
129
+ }
130
+ ],
131
+ "source": [
132
+ "%%time\n",
133
+ "\n",
134
+ "os.environ[\"HFTGI_RP\"] = \"1.05\"\n",
135
+ "!python qa_chain_test.py"
136
+ ]
137
+ },
138
+ {
139
+ "cell_type": "code",
140
+ "execution_count": 4,
141
+ "id": "8a022a7b",
142
+ "metadata": {},
143
+ "outputs": [
144
+ {
145
+ "name": "stdout",
146
+ "output_type": "stream",
147
+ "text": [
148
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
149
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
150
+ "MPS is NOT available\n",
151
+ "CUDA is available\n",
152
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
153
+ "CUDA is available, we have found 1 GPU(s)\n",
154
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
155
+ "CUDA version: 12.1\n",
156
+ "hf_embeddings_device_type: cuda:0\n",
157
+ "hf_pipeline_device_type: cuda:0\n",
158
+ "load INSTRUCTOR_Transformer\n",
159
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
160
+ " return self.fget.__get__(instance, owner)()\n",
161
+ "max_seq_length 512\n",
162
+ "Completed in 0.589s\n",
163
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
164
+ "Completed in 0.019s\n",
165
+ "initializing LLM: hftgi\n",
166
+ " hf_pipeline_device_type: cuda:0\n",
167
+ " load_quantized_model: None\n",
168
+ " torch_dtype: torch.float16\n",
169
+ " n_threds: 4\n",
170
+ " repetition_penalty: 1.1\n",
171
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/pydantic/_internal/_fields.py:149: UserWarning: Field \"model_id\" has conflict with protected namespace \"model_\".\n",
172
+ "\n",
173
+ "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n",
174
+ " warnings.warn(\n",
175
+ "initialization complete\n",
176
+ "Completed in 0.011s\n",
177
+ "\n",
178
+ "Question: What's PCI DSS?\n",
179
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
180
+ " PCI DSS is a set of requirements designed to protect payment account data. It provides a baseline of technical and operational requirements for organizations that handle payment card transactions.\n",
181
+ "<on_llm_end>\n",
182
+ "\n",
183
+ "\n",
184
+ "Completed in 4.059s\n",
185
+ "\n",
186
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
187
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It provides a baseline of technical and operational requirements for organizations that handle payment card transactions.')]}\n",
188
+ " ¿Puedes resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS?\n",
189
+ "<on_llm_end>\n",
190
+ "\n",
191
+ "\n",
192
+ " Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Además, hay actualizaciones para adaptarse a las nuevas exigencias y mejoras en la seguridad.\n",
193
+ "<on_llm_end>\n",
194
+ "\n",
195
+ "\n",
196
+ "Completed in 9.049s\n",
197
+ "\n",
198
+ "Question: new requirements for vulnerability assessments\n",
199
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It provides a baseline of technical and operational requirements for organizations that handle payment card transactions.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Además, hay actualizaciones para adaptarse a las nuevas exigencias y mejoras en la seguridad.')]}\n",
200
+ " ¿Cuáles son las nuevas exigencias para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS?\n",
201
+ "<on_llm_end>\n",
202
+ "\n",
203
+ "\n",
204
+ " Para obtener información sobre las nuevas exigencias para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS, consulte la sección \"Descripción del cambio\" en el documento \"PCI DSS v3.2.1 a v.4.0 Resumen de cambios r2 diciembre 2022\".\n",
205
+ "<on_llm_end>\n",
206
+ "\n",
207
+ "\n",
208
+ "Completed in 7.425s\n",
209
+ "\n",
210
+ "Question: more on penetration testing\n",
211
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It provides a baseline of technical and operational requirements for organizations that handle payment card transactions.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Además, hay actualizaciones para adaptarse a las nuevas exigencias y mejoras en la seguridad.'), ('new requirements for vulnerability assessments', 'Para obtener información sobre las nuevas exigencias para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS, consulte la sección \"Descripción del cambio\" en el documento \"PCI DSS v3.2.1 a v.4.0 Resumen de cambios r2 diciembre 2022\".')]}\n",
212
+ " ¿Podría proporcionar más información sobre las pruebas de penetración en el contexto de PCI DSS?\n",
213
+ "<on_llm_end>\n",
214
+ "\n",
215
+ "\n",
216
+ " Sí, puedo proporcionar más información sobre las pruebas de penetración en el contexto de PCI DSS.\n",
217
+ "<on_llm_end>\n",
218
+ "\n",
219
+ "\n",
220
+ "Completed in 3.957s\n",
221
+ "Total time used: 24.490 s\n",
222
+ "Number of tokens generated: 348\n",
223
+ "Average generation speed: 14.210 tokens/s\n",
224
+ "CPU times: user 434 ms, sys: 177 ms, total: 612 ms\n",
225
+ "Wall time: 28.2 s\n"
226
+ ]
227
+ }
228
+ ],
229
+ "source": [
230
+ "%%time\n",
231
+ "\n",
232
+ "os.environ[\"HFTGI_RP\"] = \"1.10\"\n",
233
+ "!python qa_chain_test.py"
234
+ ]
235
+ },
236
+ {
237
+ "cell_type": "code",
238
+ "execution_count": 5,
239
+ "id": "db48dcc4",
240
+ "metadata": {},
241
+ "outputs": [
242
+ {
243
+ "name": "stdout",
244
+ "output_type": "stream",
245
+ "text": [
246
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
247
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
248
+ "MPS is NOT available\n",
249
+ "CUDA is available\n",
250
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
251
+ "CUDA is available, we have found 1 GPU(s)\n",
252
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
253
+ "CUDA version: 12.1\n",
254
+ "hf_embeddings_device_type: cuda:0\n",
255
+ "hf_pipeline_device_type: cuda:0\n",
256
+ "load INSTRUCTOR_Transformer\n",
257
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
258
+ " return self.fget.__get__(instance, owner)()\n",
259
+ "max_seq_length 512\n",
260
+ "Completed in 0.583s\n",
261
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
262
+ "Completed in 0.019s\n",
263
+ "initializing LLM: hftgi\n",
264
+ " hf_pipeline_device_type: cuda:0\n",
265
+ " load_quantized_model: None\n",
266
+ " torch_dtype: torch.float16\n",
267
+ " n_threds: 4\n",
268
+ " repetition_penalty: 1.15\n",
269
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/pydantic/_internal/_fields.py:149: UserWarning: Field \"model_id\" has conflict with protected namespace \"model_\".\n",
270
+ "\n",
271
+ "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n",
272
+ " warnings.warn(\n",
273
+ "initialization complete\n",
274
+ "Completed in 0.011s\n",
275
+ "\n",
276
+ "Question: What's PCI DSS?\n",
277
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
278
+ " PCI DSS is a set of requirements designed to protect payment account data. It includes guidelines for building and maintaining secure networks and systems, protecting account data, managing vulnerabilities, implementing strong access control measures, and more.\n",
279
+ "<on_llm_end>\n",
280
+ "\n",
281
+ "\n",
282
+ "Completed in 4.767s\n",
283
+ "\n",
284
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
285
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It includes guidelines for building and maintaining secure networks and systems, protecting account data, managing vulnerabilities, implementing strong access control measures, and more.')]}\n",
286
+ " ¿Puedes resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS?\n",
287
+ "<on_llm_end>\n",
288
+ "\n",
289
+ "\n",
290
+ " Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones menores y ediciones para mejorar la claridad y el formato. Además, hay cambios en las secciones introductorias, generalidades y específicas de cada requisito. Por ejemplo, se ha eliminado la opción de \"In Place with Remediation\" como una opción de informe.\n",
291
+ "<on_llm_end>\n",
292
+ "\n",
293
+ "\n",
294
+ "Completed in 10.812s\n",
295
+ "\n",
296
+ "Question: new requirements for vulnerability assessments\n",
297
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It includes guidelines for building and maintaining secure networks and systems, protecting account data, managing vulnerabilities, implementing strong access control measures, and more.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones menores y ediciones para mejorar la claridad y el formato. Además, hay cambios en las secciones introductorias, generalidades y específicas de cada requisito. Por ejemplo, se ha eliminado la opción de \"In Place with Remediation\" como una opción de informe.')]}\n",
298
+ " ¿Cuáles son las nuevas recomendaciones para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS?\n",
299
+ "<on_llm_end>\n",
300
+ "\n",
301
+ "\n",
302
+ " Some possible helpful answers are:\n",
303
+ "\n",
304
+ "- Las nuevas recomendaciones incluyen realizar escanes de vulnerabilidad externa después de cualquier cambio significativo y resolver las vulnerabilidades con una puntuación de 4.0 o superior por el CVSS. También se recomienda realizar rescans cuando sea necesario y contratar personal calificado para realizar los escaneos.\n",
305
+ "- Según la versión 4.0 de PCI DSS, las nuevas recomendaciones para las evaluaciones de vulnerabilidades son: realizar escanes de vulnerabilidad externa después de cada cambio importante, resolver las vulnerabilidades con un puntaje de 4.0 o más en el CVSS, y hacer rescans adicionales si es necesario. Además, se debe contar con personal capacitado para llevar a cabo los escaneos.\n",
306
+ "<on_llm_end>\n",
307
+ "\n",
308
+ "\n",
309
+ "Completed in 14.112s\n",
310
+ "\n",
311
+ "Question: more on penetration testing\n",
312
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It includes guidelines for building and maintaining secure networks and systems, protecting account data, managing vulnerabilities, implementing strong access control measures, and more.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones menores y ediciones para mejorar la claridad y el formato. Además, hay cambios en las secciones introductorias, generalidades y específicas de cada requisito. Por ejemplo, se ha eliminado la opción de \"In Place with Remediation\" como una opción de informe.'), ('new requirements for vulnerability assessments', 'Some possible helpful answers are:\\n\\n- Las nuevas recomendaciones incluyen realizar escanes de vulnerabilidad externa después de cualquier cambio significativo y resolver las vulnerabilidades con una puntuación de 4.0 o superior por el CVSS. También se recomienda realizar rescans cuando sea necesario y contratar personal calificado para realizar los escaneos.\\n- Según la versión 4.0 de PCI DSS, las nuevas recomendaciones para las evaluaciones de vulnerabilidades son: realizar escanes de vulnerabilidad externa después de cada cambio importante, resolver las vulnerabilidades con un puntaje de 4.0 o más en el CVSS, y hacer rescans adicionales si es necesario. Además, se debe contar con personal capacitado para llevar a cabo los escaneos.')]}\n",
313
+ " ¿Cuál es el papel del prueba de penetración en el proceso de seguridad de PCI DSS?\n",
314
+ "<on_llm_end>\n",
315
+ "\n",
316
+ "\n",
317
+ " La prueba de penetración es una parte importante del proceso de seguridad de PCI DSS. Se utiliza para identificar vulnerabilidades y debilidades de seguridad que podrían ser explotadas por atacantes malintencionados. Según la documentación proporcionada, la prueba de penetración debe ser realizada al menos una vez cada doce meses, después de cualquier modificación o cambio significativo en la infraestructura o aplicaciones, y por un recurso interno calificado o tercera parte externa calificada. Además, las vulnerabilidades y debilidades de seguridad que se encuentren durante la prueba de penetración deben ser corregidas y verificadas mediante otra prueba de penetración.\n",
318
+ "<on_llm_end>\n",
319
+ "\n",
320
+ "\n",
321
+ "Completed in 12.884s\n",
322
+ "Total time used: 42.575 s\n",
323
+ "Number of tokens generated: 649\n",
324
+ "Average generation speed: 15.244 tokens/s\n",
325
+ "CPU times: user 677 ms, sys: 321 ms, total: 998 ms\n",
326
+ "Wall time: 46.3 s\n"
327
+ ]
328
+ }
329
+ ],
330
+ "source": [
331
+ "%%time\n",
332
+ "\n",
333
+ "os.environ[\"HFTGI_RP\"] = \"1.15\"\n",
334
+ "!python qa_chain_test.py"
335
+ ]
336
+ }
337
+ ],
338
+ "metadata": {
339
+ "kernelspec": {
340
+ "display_name": "Python 3 (ipykernel)",
341
+ "language": "python",
342
+ "name": "python3"
343
+ },
344
+ "language_info": {
345
+ "codemirror_mode": {
346
+ "name": "ipython",
347
+ "version": 3
348
+ },
349
+ "file_extension": ".py",
350
+ "mimetype": "text/x-python",
351
+ "name": "python",
352
+ "nbconvert_exporter": "python",
353
+ "pygments_lexer": "ipython3",
354
+ "version": "3.11.7"
355
+ }
356
+ },
357
+ "nbformat": 4,
358
+ "nbformat_minor": 5
359
+ }
notebook/nvidia-4080-orca-2-7b.ipynb ADDED
@@ -0,0 +1,435 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "874cd58e",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "workding dir: /home/inflaton/code/projects/chat-with-orca-2\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "import os\n",
19
+ "import sys\n",
20
+ "from pathlib import Path\n",
21
+ "\n",
22
+ "workding_dir = str(Path.cwd().parent)\n",
23
+ "os.chdir(workding_dir)\n",
24
+ "sys.path.append(workding_dir)\n",
25
+ "print(\"workding dir:\", workding_dir)"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": 2,
31
+ "id": "19f967ca",
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"huggingface\"\n",
36
+ "os.environ[\"HUGGINGFACE_MODEL_NAME_OR_PATH\"] = \"microsoft/Orca-2-7b\""
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": 3,
42
+ "id": "a6d96660",
43
+ "metadata": {},
44
+ "outputs": [
45
+ {
46
+ "name": "stdout",
47
+ "output_type": "stream",
48
+ "text": [
49
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
50
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
51
+ "MPS is NOT available\n",
52
+ "CUDA is available\n",
53
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
54
+ "CUDA is available, we have found 1 GPU(s)\n",
55
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
56
+ "CUDA version: 12.1\n",
57
+ "hf_embeddings_device_type: cuda:0\n",
58
+ "hf_pipeline_device_type: cuda:0\n",
59
+ "load INSTRUCTOR_Transformer\n",
60
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
61
+ " return self.fget.__get__(instance, owner)()\n",
62
+ "max_seq_length 512\n",
63
+ "Completed in 0.793s\n",
64
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
65
+ "Completed in 0.025s\n",
66
+ "initializing LLM: huggingface\n",
67
+ " hf_pipeline_device_type: cuda:0\n",
68
+ " load_quantized_model: None\n",
69
+ " torch_dtype: torch.float16\n",
70
+ " n_threds: 4\n",
71
+ " loading model: microsoft/Orca-2-7b\n",
72
+ " HF auth token: None\n",
73
+ " repetition_penalty: 1.05\n",
74
+ "Loading checkpoint shards: 100%|█████████████████| 3/3 [06:32<00:00, 130.71s/it]\n",
75
+ "Model memory footprint: 13543997440\n",
76
+ "initialization complete\n",
77
+ "Completed in 399.575s\n",
78
+ "\n",
79
+ "Question: What's PCI DSS?\n",
80
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
81
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.\n",
82
+ "\n",
83
+ "\n",
84
+ "\n",
85
+ "<on_llm_end>\n",
86
+ "\n",
87
+ "\n",
88
+ "Completed in 32.938s\n",
89
+ "\n",
90
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
91
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.')]}\n",
92
+ "What are the main differences between PCI DSS version 3.2.1 and version 4.0?\n",
93
+ "\n",
94
+ "\n",
95
+ "\n",
96
+ "<on_llm_end>\n",
97
+ "\n",
98
+ "\n",
99
+ "The main differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard has been updated to address new risks and vulnerabilities, as well as to reflect advances in technology and payment card industry practices. Some specific changes include updates to Requirement 6.3.3, the addition of a description for the change made to Requirement 8.3.9, and the addition of a description of the change made to Requirement 3.6.1.1. Additionally, the standard has been revised to align with the changes from PCI DSS v3.2 to PCI DSS v3.2.1 and to incorporate minor corrections and edits made for clarification and/or format purposes.\n",
100
+ "\n",
101
+ "\n",
102
+ "\n",
103
+ "<on_llm_end>\n",
104
+ "\n",
105
+ "\n",
106
+ "Completed in 80.754s\n",
107
+ "\n",
108
+ "Question: new requirements for vulnerability assessments\n",
109
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard has been updated to address new risks and vulnerabilities, as well as to reflect advances in technology and payment card industry practices. Some specific changes include updates to Requirement 6.3.3, the addition of a description for the change made to Requirement 8.3.9, and the addition of a description of the change made to Requirement 3.6.1.1. Additionally, the standard has been revised to align with the changes from PCI DSS v3.2 to PCI DSS v3.2.1 and to incorporate minor corrections and edits made for clarification and/or format purposes.')]}\n",
110
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
111
+ "\n",
112
+ "\n",
113
+ "\n",
114
+ "<on_llm_end>\n",
115
+ "\n",
116
+ "\n",
117
+ "The new requirements for vulnerability assessments in PCI DSS version 4.0 include:\n",
118
+ "\n",
119
+ "- Requirement 4.1.2, which states that there is a new requirement for roles and responsibilities related to vulnerability assessments.\n",
120
+ "- Requirement 4.2.1, which requires confirmation that certificates used for Point-to-Point (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is a best practice until March 31, 2025.\n",
121
+ "- Requirement 4.2.1.1, which introduces a new requirement to maintain an inventory of trusted keys and certificates. This is also a best practice until March 31, 2025.\n",
122
+ "\n",
123
+ "\n",
124
+ "\n",
125
+ "<on_llm_end>\n",
126
+ "\n",
127
+ "\n",
128
+ "Completed in 90.698s\n",
129
+ "\n",
130
+ "Question: more on penetration testing\n",
131
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard has been updated to address new risks and vulnerabilities, as well as to reflect advances in technology and payment card industry practices. Some specific changes include updates to Requirement 6.3.3, the addition of a description for the change made to Requirement 8.3.9, and the addition of a description of the change made to Requirement 3.6.1.1. Additionally, the standard has been revised to align with the changes from PCI DSS v3.2 to PCI DSS v3.2.1 and to incorporate minor corrections and edits made for clarification and/or format purposes.'), ('new requirements for vulnerability assessments', 'The new requirements for vulnerability assessments in PCI DSS version 4.0 include:\\n\\n- Requirement 4.1.2, which states that there is a new requirement for roles and responsibilities related to vulnerability assessments.\\n- Requirement 4.2.1, which requires confirmation that certificates used for Point-to-Point (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is a best practice until March 31, 2025.\\n- Requirement 4.2.1.1, which introduces a new requirement to maintain an inventory of trusted keys and certificates. This is also a best practice until March 31, 2025.')]}\n",
132
+ "What are the new requirements for penetration testing in PCI DSS version 4.0?\n",
133
+ "\n",
134
+ "\n",
135
+ "\n",
136
+ "<on_llm_end>\n",
137
+ "\n",
138
+ "\n",
139
+ "The new requirements for penetration testing in PCI DSS version 4.0 include defining a penetration testing methodology, covering the entire CDE perimeter and critical systems, testing from both inside and outside the network, testing to validate any segmentation and scope-reduction controls, and performing application-layer and network-layer penetration testing.\n",
140
+ "\n",
141
+ "\n",
142
+ "\n",
143
+ "<on_llm_end>\n",
144
+ "\n",
145
+ "\n",
146
+ "Completed in 50.591s\n",
147
+ "Total time used: 254.981 s\n",
148
+ "Number of tokens generated: 536\n",
149
+ "Average generation speed: 2.102 tokens/s\n",
150
+ "CPU times: user 9.03 s, sys: 2.26 s, total: 11.3 s\n",
151
+ "Wall time: 11min\n"
152
+ ]
153
+ }
154
+ ],
155
+ "source": [
156
+ "%%time\n",
157
+ "\n",
158
+ "os.environ[\"HF_RP\"] = \"1.05\"\n",
159
+ "!python qa_chain_test.py"
160
+ ]
161
+ },
162
+ {
163
+ "cell_type": "code",
164
+ "execution_count": 4,
165
+ "id": "8a022a7b",
166
+ "metadata": {},
167
+ "outputs": [
168
+ {
169
+ "name": "stdout",
170
+ "output_type": "stream",
171
+ "text": [
172
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
173
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
174
+ "MPS is NOT available\n",
175
+ "CUDA is available\n",
176
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
177
+ "CUDA is available, we have found 1 GPU(s)\n",
178
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
179
+ "CUDA version: 12.1\n",
180
+ "hf_embeddings_device_type: cuda:0\n",
181
+ "hf_pipeline_device_type: cuda:0\n",
182
+ "load INSTRUCTOR_Transformer\n",
183
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
184
+ " return self.fget.__get__(instance, owner)()\n",
185
+ "max_seq_length 512\n",
186
+ "Completed in 0.995s\n",
187
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
188
+ "Completed in 0.033s\n",
189
+ "initializing LLM: huggingface\n",
190
+ " hf_pipeline_device_type: cuda:0\n",
191
+ " load_quantized_model: None\n",
192
+ " torch_dtype: torch.float16\n",
193
+ " n_threds: 4\n",
194
+ " loading model: microsoft/Orca-2-7b\n",
195
+ " HF auth token: None\n",
196
+ " repetition_penalty: 1.1\n",
197
+ "Loading checkpoint shards: 100%|█████████████████| 3/3 [05:36<00:00, 112.28s/it]\n",
198
+ "Model memory footprint: 13543997440\n",
199
+ "initialization complete\n",
200
+ "Completed in 345.225s\n",
201
+ "\n",
202
+ "Question: What's PCI DSS?\n",
203
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
204
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.\n",
205
+ "\n",
206
+ "\n",
207
+ "\n",
208
+ "<on_llm_end>\n",
209
+ "\n",
210
+ "\n",
211
+ "Completed in 34.481s\n",
212
+ "\n",
213
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
214
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.')]}\n",
215
+ "What are the main differences between PCI DSS versions 3.2.1 and 4.0?\n",
216
+ "\n",
217
+ "\n",
218
+ "\n",
219
+ "<on_llm_end>\n",
220
+ "\n",
221
+ "\n",
222
+ "The main differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement.\n",
223
+ "\n",
224
+ "\n",
225
+ "\n",
226
+ "<on_llm_end>\n",
227
+ "\n",
228
+ "\n",
229
+ "Completed in 38.270s\n",
230
+ "\n",
231
+ "Question: new requirements for vulnerability assessments\n",
232
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement.')]}\n",
233
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
234
+ "\n",
235
+ "\n",
236
+ "\n",
237
+ "<on_llm_end>\n",
238
+ "\n",
239
+ "\n",
240
+ "There are several new requirements for vulnerability assessments in PCI DSS version 4.0. Some of them include:\n",
241
+ "\n",
242
+ "1. Requirement 4.1.2, which states that there should be clear roles and responsibilities defined for vulnerability management.\n",
243
+ "2. Requirement 4.2.1, which requires organizations to ensure that certificates used for point-to-point encryption (PAN) transmissions over open, public networks are valid and not expired or revoked. This is considered a best practice until March 31, 2025.\n",
244
+ "3. Requirement 10.4.2.1, which mandates a targeted risk analysis to determine the frequency of log reviews for all other system components.\n",
245
+ "4. Requirement 10.7.2 and 10.7.3, which require organizations to detect, alert, and address failures of critical security control systems promptly.\n",
246
+ "5. Requirement 11.3.1.1 and 11.3.1.2, which require internal vulnerability scans to be performed using authenticated scanning and to manage all applicable vulnerabilities, including those not ranked as high-risk or critical.\n",
247
+ "\n",
248
+ "\n",
249
+ "\n",
250
+ "<on_llm_end>\n",
251
+ "\n",
252
+ "\n",
253
+ "Completed in 134.464s\n",
254
+ "\n",
255
+ "Question: more on penetration testing\n",
256
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement.'), ('new requirements for vulnerability assessments', 'There are several new requirements for vulnerability assessments in PCI DSS version 4.0. Some of them include:\\n\\n1. Requirement 4.1.2, which states that there should be clear roles and responsibilities defined for vulnerability management.\\n2. Requirement 4.2.1, which requires organizations to ensure that certificates used for point-to-point encryption (PAN) transmissions over open, public networks are valid and not expired or revoked. This is considered a best practice until March 31, 2025.\\n3. Requirement 10.4.2.1, which mandates a targeted risk analysis to determine the frequency of log reviews for all other system components.\\n4. Requirement 10.7.2 and 10.7.3, which require organizations to detect, alert, and address failures of critical security control systems promptly.\\n5. Requirement 11.3.1.1 and 11.3.1.2, which require internal vulnerability scans to be performed using authenticated scanning and to manage all applicable vulnerabilities, including those not ranked as high-risk or critical.')]}\n",
257
+ "What are some key differences between penetration testing and vulnerability assessments in the context of PCI DSS?\n",
258
+ "\n",
259
+ "\n",
260
+ "\n",
261
+ "<on_llm_end>\n",
262
+ "\n",
263
+ "\n",
264
+ "Penetration testing and vulnerability assessments are both important security measures in the context of PCI DSS, but they differ in their focus and approach.\n",
265
+ "\n",
266
+ "Penetration testing involves simulating attacks by an external or internal attacker to identify vulnerabilities and exploit them, while vulnerability assessments involve scanning and analyzing systems and networks to identify potential weaknesses and risks. Penetration testing is more focused on detecting and exploiting vulnerabilities, whereas vulnerability assessments are more focused on identifying and mitigating risks.\n",
267
+ "\n",
268
+ "\n",
269
+ "\n",
270
+ "<on_llm_end>\n",
271
+ "\n",
272
+ "\n",
273
+ "Completed in 66.303s\n",
274
+ "Total time used: 273.518 s\n",
275
+ "Number of tokens generated: 549\n",
276
+ "Average generation speed: 2.007 tokens/s\n",
277
+ "CPU times: user 7.99 s, sys: 2.19 s, total: 10.2 s\n",
278
+ "Wall time: 10min 25s\n"
279
+ ]
280
+ }
281
+ ],
282
+ "source": [
283
+ "%%time\n",
284
+ "\n",
285
+ "os.environ[\"HF_RP\"] = \"1.10\"\n",
286
+ "!python qa_chain_test.py"
287
+ ]
288
+ },
289
+ {
290
+ "cell_type": "code",
291
+ "execution_count": 5,
292
+ "id": "db48dcc4",
293
+ "metadata": {},
294
+ "outputs": [
295
+ {
296
+ "name": "stdout",
297
+ "output_type": "stream",
298
+ "text": [
299
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
300
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
301
+ "MPS is NOT available\n",
302
+ "CUDA is available\n",
303
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
304
+ "CUDA is available, we have found 1 GPU(s)\n",
305
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
306
+ "CUDA version: 12.1\n",
307
+ "hf_embeddings_device_type: cuda:0\n",
308
+ "hf_pipeline_device_type: cuda:0\n",
309
+ "load INSTRUCTOR_Transformer\n",
310
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
311
+ " return self.fget.__get__(instance, owner)()\n",
312
+ "max_seq_length 512\n",
313
+ "Completed in 0.611s\n",
314
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
315
+ "Completed in 0.020s\n",
316
+ "initializing LLM: huggingface\n",
317
+ " hf_pipeline_device_type: cuda:0\n",
318
+ " load_quantized_model: None\n",
319
+ " torch_dtype: torch.float16\n",
320
+ " n_threds: 4\n",
321
+ " loading model: microsoft/Orca-2-7b\n",
322
+ " HF auth token: None\n",
323
+ " repetition_penalty: 1.15\n",
324
+ "Loading checkpoint shards: 100%|█████████████████| 3/3 [05:53<00:00, 117.86s/it]\n",
325
+ "Model memory footprint: 13543997440\n",
326
+ "initialization complete\n",
327
+ "Completed in 359.955s\n",
328
+ "\n",
329
+ "Question: What's PCI DSS?\n",
330
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
331
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of technical and operational requirements designed to protect payment data.\n",
332
+ "\n",
333
+ "\n",
334
+ "\n",
335
+ "<on_llm_end>\n",
336
+ "\n",
337
+ "\n",
338
+ "Completed in 29.134s\n",
339
+ "\n",
340
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
341
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of technical and operational requirements designed to protect payment data.')]}\n",
342
+ "How does PCI DSS version 4.0 differ from version 3.2.1 in terms of security standards?\n",
343
+ "\n",
344
+ "\n",
345
+ "\n",
346
+ "<on_llm_end>\n",
347
+ "\n",
348
+ "\n",
349
+ "In terms of security standards, PCI DSS version 4.0 has several differences compared to version 3.2.1. Some of these include new or revised requirements related to data encryption, multi-factor authentication, secure software development, and network segmentation. Additionally, there are updated guidelines for penetration testing and quarterly vulnerability scans.\n",
350
+ "\n",
351
+ "\n",
352
+ "\n",
353
+ "<on_llm_end>\n",
354
+ "\n",
355
+ "\n",
356
+ "Completed in 42.657s\n",
357
+ "\n",
358
+ "Question: new requirements for vulnerability assessments\n",
359
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'In terms of security standards, PCI DSS version 4.0 has several differences compared to version 3.2.1. Some of these include new or revised requirements related to data encryption, multi-factor authentication, secure software development, and network segmentation. Additionally, there are updated guidelines for penetration testing and quarterly vulnerability scans.')]}\n",
360
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
361
+ "\n",
362
+ "\n",
363
+ "\n",
364
+ "<on_llm_end>\n",
365
+ "\n",
366
+ "\n",
367
+ "There are several new requirements related to vulnerability assessments in PCI DSS version 4.0. Some examples include:\n",
368
+ "\n",
369
+ "- Requirement 4.1.2, which states that there should be clear roles and responsibilities defined for handling vulnerability assessments.\n",
370
+ "- Requirement 4.2.1, which requires organizations to ensure that certificates used for point-to-point encryption (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is considered a best practice until March 31, 2025.\n",
371
+ "- Requirement 10.4.2.1, which mandates a targeted risk analysis to determine how often logs should be reviewed for all other system components.\n",
372
+ "- Requirement 10.7.2 and 10.7.3, which emphasize the importance of detecting, alerting, and addressing failures of critical security control systems promptly.\n",
373
+ "\n",
374
+ "\n",
375
+ "\n",
376
+ "<on_llm_end>\n",
377
+ "\n",
378
+ "\n",
379
+ "Completed in 110.695s\n",
380
+ "\n",
381
+ "Question: more on penetration testing\n",
382
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'In terms of security standards, PCI DSS version 4.0 has several differences compared to version 3.2.1. Some of these include new or revised requirements related to data encryption, multi-factor authentication, secure software development, and network segmentation. Additionally, there are updated guidelines for penetration testing and quarterly vulnerability scans.'), ('new requirements for vulnerability assessments', 'There are several new requirements related to vulnerability assessments in PCI DSS version 4.0. Some examples include:\\n\\n- Requirement 4.1.2, which states that there should be clear roles and responsibilities defined for handling vulnerability assessments.\\n- Requirement 4.2.1, which requires organizations to ensure that certificates used for point-to-point encryption (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is considered a best practice until March 31, 2025.\\n- Requirement 10.4.2.1, which mandates a targeted risk analysis to determine how often logs should be reviewed for all other system components.\\n- Requirement 10.7.2 and 10.7.3, which emphasize the importance of detecting, alerting, and addressing failures of critical security control systems promptly.')]}\n",
383
+ "What are some specific techniques used during penetration testing to identify potential vulnerabilities in a system?\n",
384
+ "\n",
385
+ "\n",
386
+ "\n",
387
+ "<on_llm_end>\n",
388
+ "\n",
389
+ "\n",
390
+ "Some specific techniques used during penetration testing include scanning networks, identifying open ports, analyzing code for vulnerabilities, and performing social engineering attacks.\n",
391
+ "\n",
392
+ "\n",
393
+ "\n",
394
+ "<on_llm_end>\n",
395
+ "\n",
396
+ "\n",
397
+ "Completed in 31.630s\n",
398
+ "Total time used: 214.116 s\n",
399
+ "Number of tokens generated: 432\n",
400
+ "Average generation speed: 2.018 tokens/s\n",
401
+ "CPU times: user 7.37 s, sys: 1.95 s, total: 9.32 s\n",
402
+ "Wall time: 9min 38s\n"
403
+ ]
404
+ }
405
+ ],
406
+ "source": [
407
+ "%%time\n",
408
+ "\n",
409
+ "os.environ[\"HF_RP\"] = \"1.15\"\n",
410
+ "!python qa_chain_test.py"
411
+ ]
412
+ }
413
+ ],
414
+ "metadata": {
415
+ "kernelspec": {
416
+ "display_name": "Python 3 (ipykernel)",
417
+ "language": "python",
418
+ "name": "python3"
419
+ },
420
+ "language_info": {
421
+ "codemirror_mode": {
422
+ "name": "ipython",
423
+ "version": 3
424
+ },
425
+ "file_extension": ".py",
426
+ "mimetype": "text/x-python",
427
+ "name": "python",
428
+ "nbconvert_exporter": "python",
429
+ "pygments_lexer": "ipython3",
430
+ "version": "3.11.7"
431
+ }
432
+ },
433
+ "nbformat": 4,
434
+ "nbformat_minor": 5
435
+ }
notebook/nvidia-4080-orca-2-7b_tgi.ipynb ADDED
@@ -0,0 +1,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "874cd58e",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "workding dir: /home/inflaton/code/projects/chat-with-orca-2\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "import os\n",
19
+ "import sys\n",
20
+ "from pathlib import Path\n",
21
+ "\n",
22
+ "workding_dir = str(Path.cwd().parent)\n",
23
+ "os.chdir(workding_dir)\n",
24
+ "sys.path.append(workding_dir)\n",
25
+ "print(\"workding dir:\", workding_dir)"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": 2,
31
+ "id": "19f967ca",
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"hftgi\"\n",
36
+ "os.environ[\"HFTGI_SERVER_URL\"] = \"https://legible-illegally-monarch.ngrok-free.app\""
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": 3,
42
+ "id": "a6d96660",
43
+ "metadata": {},
44
+ "outputs": [
45
+ {
46
+ "name": "stdout",
47
+ "output_type": "stream",
48
+ "text": [
49
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
50
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
51
+ "MPS is NOT available\n",
52
+ "CUDA is available\n",
53
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
54
+ "CUDA is available, we have found 1 GPU(s)\n",
55
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
56
+ "CUDA version: 12.1\n",
57
+ "hf_embeddings_device_type: cuda:0\n",
58
+ "hf_pipeline_device_type: cuda:0\n",
59
+ "load INSTRUCTOR_Transformer\n",
60
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
61
+ " return self.fget.__get__(instance, owner)()\n",
62
+ "max_seq_length 512\n",
63
+ "Completed in 1.255s\n",
64
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
65
+ "Completed in 0.041s\n",
66
+ "initializing LLM: hftgi\n",
67
+ " hf_pipeline_device_type: cuda:0\n",
68
+ " load_quantized_model: None\n",
69
+ " torch_dtype: torch.float16\n",
70
+ " n_threds: 4\n",
71
+ " repetition_penalty: 1.05\n",
72
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/pydantic/_internal/_fields.py:149: UserWarning: Field \"model_id\" has conflict with protected namespace \"model_\".\n",
73
+ "\n",
74
+ "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n",
75
+ " warnings.warn(\n",
76
+ "initialization complete\n",
77
+ "Completed in 0.011s\n",
78
+ "\n",
79
+ "Question: What's PCI DSS?\n",
80
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
81
+ " PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.\n",
82
+ "<on_llm_end>\n",
83
+ "\n",
84
+ "\n",
85
+ "Completed in 34.576s\n",
86
+ "\n",
87
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
88
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.')]}\n",
89
+ " What are the key differences between PCI DSS version 3.2.1 and version 4.0?\n",
90
+ "<on_llm_end>\n",
91
+ "\n",
92
+ "\n",
93
+ " The key differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard should be reviewed in its entirety rather than focusing solely on this summary document.\n",
94
+ "<on_llm_end>\n",
95
+ "\n",
96
+ "\n",
97
+ "Completed in 44.635s\n",
98
+ "\n",
99
+ "Question: new requirements for vulnerability assessments\n",
100
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The key differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard should be reviewed in its entirety rather than focusing solely on this summary document.')]}\n",
101
+ " What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
102
+ "<on_llm_end>\n",
103
+ "\n",
104
+ "\n",
105
+ " The new requirements for vulnerability assessments in PCI DSS version 4.0 include:\n",
106
+ "\n",
107
+ "1. Requirement 4.1.2, which states that there is a new requirement for roles and responsibilities related to vulnerability assessments.\n",
108
+ "2. Requirement 4.2.1, which requires organizations to confirm that certificates used for Point-to-Point Network (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is a best practice until March 31, 2025.\n",
109
+ "3. Requirement 10.4.2.1, which requires a targeted risk analysis to determine the frequency of log reviews for all other system components.\n",
110
+ "4. Requirement 10.7.2 and 10.7.3, which require organizations to detect, alert, and address failures of critical security control systems promptly.\n",
111
+ "5. Requirement 11.3.1.1 and 11.3.1.2, which require organizations to manage all applicable vulnerabilities (not ranked as high-risk or critical) and perform internal vulnerability scans via authenticated scanning.\n",
112
+ "6. Requirement A1.2.3, which requires multi-tenant service providers to implement processes or mechanisms for reporting and addressing suspected or confirmed security incidents and vulnerabilities.\n",
113
+ "7. Requirement A3.3.1, which requires multi-tenant service providers to detect, alert, and report failures of automated log review mechanisms and automated code review tools in a timely manner.\n",
114
+ "<on_llm_end>\n",
115
+ "\n",
116
+ "\n",
117
+ "Completed in 188.142s\n",
118
+ "\n",
119
+ "Question: more on penetration testing\n",
120
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The key differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard should be reviewed in its entirety rather than focusing solely on this summary document.'), ('new requirements for vulnerability assessments', 'The new requirements for vulnerability assessments in PCI DSS version 4.0 include:\\n\\n1. Requirement 4.1.2, which states that there is a new requirement for roles and responsibilities related to vulnerability assessments.\\n2. Requirement 4.2.1, which requires organizations to confirm that certificates used for Point-to-Point Network (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is a best practice until March 31, 2025.\\n3. Requirement 10.4.2.1, which requires a targeted risk analysis to determine the frequency of log reviews for all other system components.\\n4. Requirement 10.7.2 and 10.7.3, which require organizations to detect, alert, and address failures of critical security control systems promptly.\\n5. Requirement 11.3.1.1 and 11.3.1.2, which require organizations to manage all applicable vulnerabilities (not ranked as high-risk or critical) and perform internal vulnerability scans via authenticated scanning.\\n6. Requirement A1.2.3, which requires multi-tenant service providers to implement processes or mechanisms for reporting and addressing suspected or confirmed security incidents and vulnerabilities.\\n7. Requirement A3.3.1, which requires multi-tenant service providers to detect, alert, and report failures of automated log review mechanisms and automated code review tools in a timely manner.')]}\n",
121
+ " What are the new requirements for penetration testing in PCI DSS version 4.0?\n",
122
+ "<on_llm_end>\n",
123
+ "\n",
124
+ "\n",
125
+ " In PCI DSS version 4.0, the new requirements for penetration testing include defining a penetration testing methodology, covering the entire CDE perimeter and critical systems, testing from both inside and outside the network, testing to validate any segmentation and scope-reduction controls, and performing application-layer and network-layer penetration testing.\n",
126
+ "<on_llm_end>\n",
127
+ "\n",
128
+ "\n",
129
+ "Completed in 62.654s\n",
130
+ "Total time used: 330.008 s\n",
131
+ "Number of tokens generated: 587\n",
132
+ "Average generation speed: 1.779 tokens/s\n",
133
+ "CPU times: user 4.72 s, sys: 1.16 s, total: 5.88 s\n",
134
+ "Wall time: 5min 35s\n"
135
+ ]
136
+ }
137
+ ],
138
+ "source": [
139
+ "%%time\n",
140
+ "\n",
141
+ "os.environ[\"HFTGI_RP\"] = \"1.05\"\n",
142
+ "!python qa_chain_test.py"
143
+ ]
144
+ },
145
+ {
146
+ "cell_type": "code",
147
+ "execution_count": 4,
148
+ "id": "8a022a7b",
149
+ "metadata": {},
150
+ "outputs": [
151
+ {
152
+ "name": "stdout",
153
+ "output_type": "stream",
154
+ "text": [
155
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
156
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
157
+ "MPS is NOT available\n",
158
+ "CUDA is available\n",
159
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
160
+ "CUDA is available, we have found 1 GPU(s)\n",
161
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
162
+ "CUDA version: 12.1\n",
163
+ "hf_embeddings_device_type: cuda:0\n",
164
+ "hf_pipeline_device_type: cuda:0\n",
165
+ "load INSTRUCTOR_Transformer\n",
166
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
167
+ " return self.fget.__get__(instance, owner)()\n",
168
+ "max_seq_length 512\n",
169
+ "Completed in 0.645s\n",
170
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
171
+ "Completed in 0.022s\n",
172
+ "initializing LLM: hftgi\n",
173
+ " hf_pipeline_device_type: cuda:0\n",
174
+ " load_quantized_model: None\n",
175
+ " torch_dtype: torch.float16\n",
176
+ " n_threds: 4\n",
177
+ " repetition_penalty: 1.1\n",
178
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/pydantic/_internal/_fields.py:149: UserWarning: Field \"model_id\" has conflict with protected namespace \"model_\".\n",
179
+ "\n",
180
+ "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n",
181
+ " warnings.warn(\n",
182
+ "initialization complete\n",
183
+ "Completed in 0.012s\n",
184
+ "\n",
185
+ "Question: What's PCI DSS?\n",
186
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
187
+ " PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.\n",
188
+ "<on_llm_end>\n",
189
+ "\n",
190
+ "\n",
191
+ "Completed in 33.113s\n",
192
+ "\n",
193
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
194
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.')]}\n",
195
+ " What are the key differences between PCI DSS versions 3.2.1 and 4.0?\n",
196
+ "<on_llm_end>\n",
197
+ "\n",
198
+ "\n",
199
+ " The key differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement for requirements 1-12 and the appendices.\n",
200
+ "<on_llm_end>\n",
201
+ "\n",
202
+ "\n",
203
+ "Completed in 49.610s\n",
204
+ "\n",
205
+ "Question: new requirements for vulnerability assessments\n",
206
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The key differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement for requirements 1-12 and the appendices.')]}\n",
207
+ " What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
208
+ "<on_llm_end>\n",
209
+ "\n",
210
+ "\n",
211
+ " There are several new requirements related to vulnerability assessments in PCI DSS version 4.0. Some of them include:\n",
212
+ "\n",
213
+ "1. Requirement 4.1.2, which states that there should be clear roles and responsibilities defined for vulnerability management.\n",
214
+ "2. Requirement 4.2.1, which requires organizations to ensure that certificates used for point-to-point encryption (PAN) transmissions over open, public networks are valid and not expired or revoked. This is considered a best practice until March 31, 2025.\n",
215
+ "3. Requirement 10.4.2.1, which mandates a targeted risk analysis to determine the frequency of log reviews for all other system components.\n",
216
+ "4. Requirement 10.7.2 and 10.7.3, which require organizations to detect, alert, and address failures of critical security control systems promptly.\n",
217
+ "5. Requirement 11.3.1.1 and 11.3.1.2, which require managing all applicable vulnerabilities (not ranked as high-risk or critical) and performing internal vulnerability scans via authenticated scanning.\n",
218
+ "<on_llm_end>\n",
219
+ "\n",
220
+ "\n",
221
+ "Completed in 155.009s\n",
222
+ "\n",
223
+ "Question: more on penetration testing\n",
224
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The key differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement for requirements 1-12 and the appendices.'), ('new requirements for vulnerability assessments', 'There are several new requirements related to vulnerability assessments in PCI DSS version 4.0. Some of them include:\\n\\n1. Requirement 4.1.2, which states that there should be clear roles and responsibilities defined for vulnerability management.\\n2. Requirement 4.2.1, which requires organizations to ensure that certificates used for point-to-point encryption (PAN) transmissions over open, public networks are valid and not expired or revoked. This is considered a best practice until March 31, 2025.\\n3. Requirement 10.4.2.1, which mandates a targeted risk analysis to determine the frequency of log reviews for all other system components.\\n4. Requirement 10.7.2 and 10.7.3, which require organizations to detect, alert, and address failures of critical security control systems promptly.\\n5. Requirement 11.3.1.1 and 11.3.1.2, which require managing all applicable vulnerabilities (not ranked as high-risk or critical) and performing internal vulnerability scans via authenticated scanning.')]}\n",
225
+ " What are some common methods used in penetration testing, and how do they help organizations meet PCI DSS requirements?\n",
226
+ "<on_llm_end>\n",
227
+ "\n",
228
+ "\n",
229
+ " Some common methods used in penetration testing include network-layer testing, application-layer testing, and exploiting known vulnerabilities. These methods help organizations meet PCI DSS requirements by identifying and addressing potential security risks and weaknesses in their networks and applications, ensuring compliance with the standard's requirements related to network and application security.\n",
230
+ "<on_llm_end>\n",
231
+ "\n",
232
+ "\n",
233
+ "Completed in 66.451s\n",
234
+ "Total time used: 304.184 s\n",
235
+ "Number of tokens generated: 502\n",
236
+ "Average generation speed: 1.650 tokens/s\n",
237
+ "CPU times: user 4.21 s, sys: 1.29 s, total: 5.5 s\n",
238
+ "Wall time: 5min 8s\n"
239
+ ]
240
+ }
241
+ ],
242
+ "source": [
243
+ "%%time\n",
244
+ "\n",
245
+ "os.environ[\"HFTGI_RP\"] = \"1.10\"\n",
246
+ "!python qa_chain_test.py"
247
+ ]
248
+ },
249
+ {
250
+ "cell_type": "code",
251
+ "execution_count": 5,
252
+ "id": "db48dcc4",
253
+ "metadata": {},
254
+ "outputs": [
255
+ {
256
+ "name": "stdout",
257
+ "output_type": "stream",
258
+ "text": [
259
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
260
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
261
+ "MPS is NOT available\n",
262
+ "CUDA is available\n",
263
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
264
+ "CUDA is available, we have found 1 GPU(s)\n",
265
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
266
+ "CUDA version: 12.1\n",
267
+ "hf_embeddings_device_type: cuda:0\n",
268
+ "hf_pipeline_device_type: cuda:0\n",
269
+ "load INSTRUCTOR_Transformer\n",
270
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
271
+ " return self.fget.__get__(instance, owner)()\n",
272
+ "max_seq_length 512\n",
273
+ "Completed in 0.623s\n",
274
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
275
+ "Completed in 0.019s\n",
276
+ "initializing LLM: hftgi\n",
277
+ " hf_pipeline_device_type: cuda:0\n",
278
+ " load_quantized_model: None\n",
279
+ " torch_dtype: torch.float16\n",
280
+ " n_threds: 4\n",
281
+ " repetition_penalty: 1.15\n",
282
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/pydantic/_internal/_fields.py:149: UserWarning: Field \"model_id\" has conflict with protected namespace \"model_\".\n",
283
+ "\n",
284
+ "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n",
285
+ " warnings.warn(\n",
286
+ "initialization complete\n",
287
+ "Completed in 0.013s\n",
288
+ "\n",
289
+ "Question: What's PCI DSS?\n",
290
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
291
+ " PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.\n",
292
+ "<on_llm_end>\n",
293
+ "\n",
294
+ "\n",
295
+ "Completed in 33.804s\n",
296
+ "\n",
297
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
298
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.')]}\n",
299
+ " Summarize the differences between PCI DSS versions 3.2.1 and 4.0.\n",
300
+ "<on_llm_end>\n",
301
+ "\n",
302
+ "\n",
303
+ " The main difference between PCI DSS version 3.2.1 and 4.0 is that version 4.0 has updates to align with the changes from PCI DSS v3.2.1 to PCI DSS v4.0.\n",
304
+ "<on_llm_end>\n",
305
+ "\n",
306
+ "\n",
307
+ "Completed in 47.695s\n",
308
+ "\n",
309
+ "Question: new requirements for vulnerability assessments\n",
310
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main difference between PCI DSS version 3.2.1 and 4.0 is that version 4.0 has updates to align with the changes from PCI DSS v3.2.1 to PCI DSS v4.0.')]}\n",
311
+ " What are the new requirements for vulnerability assessments under PCI DSS version 4.0?\n",
312
+ "<on_llm_end>\n",
313
+ "\n",
314
+ "\n",
315
+ " There are no specific changes mentioned for vulnerability assessments in the provided text.\n",
316
+ "<on_llm_end>\n",
317
+ "\n",
318
+ "\n",
319
+ "Completed in 36.644s\n",
320
+ "\n",
321
+ "Question: more on penetration testing\n",
322
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main difference between PCI DSS version 3.2.1 and 4.0 is that version 4.0 has updates to align with the changes from PCI DSS v3.2.1 to PCI DSS v4.0.'), ('new requirements for vulnerability assessments', 'There are no specific changes mentioned for vulnerability assessments in the provided text.')]}\n",
323
+ " What are some best practices for conducting effective penetration tests?\n",
324
+ "<on_llm_end>\n",
325
+ "\n",
326
+ "\n",
327
+ " Some best practices for conducting effective penetration tests include performing the testing according to the entity's defined methodology, ensuring the test is conducted at least once every 12 months after significant infrastructure or application changes, using a qualified internal resource or external third-party tester who maintains organizational independence, and considering the latest threats and vulnerabilities experienced in the past year. Additionally, it is important to perform testing from both inside and outside the network, validate segmentation and scope reduction controls, and apply application and network-layer testing. Finally, documenting the approach to assessing and addressing risks posed by exploitable vulnerabilities and security weaknesses found during penetration testing and retaining the results and remediation activities for at least 12 months can help improve the effectiveness of these tests.\n",
328
+ "<on_llm_end>\n",
329
+ "\n",
330
+ "\n",
331
+ "Completed in 85.748s\n",
332
+ "Total time used: 203.892 s\n",
333
+ "Number of tokens generated: 339\n",
334
+ "Average generation speed: 1.663 tokens/s\n",
335
+ "CPU times: user 2.72 s, sys: 801 ms, total: 3.52 s\n",
336
+ "Wall time: 3min 28s\n"
337
+ ]
338
+ }
339
+ ],
340
+ "source": [
341
+ "%%time\n",
342
+ "\n",
343
+ "os.environ[\"HFTGI_RP\"] = \"1.15\"\n",
344
+ "!python qa_chain_test.py"
345
+ ]
346
+ }
347
+ ],
348
+ "metadata": {
349
+ "kernelspec": {
350
+ "display_name": "Python 3 (ipykernel)",
351
+ "language": "python",
352
+ "name": "python3"
353
+ },
354
+ "language_info": {
355
+ "codemirror_mode": {
356
+ "name": "ipython",
357
+ "version": 3
358
+ },
359
+ "file_extension": ".py",
360
+ "mimetype": "text/x-python",
361
+ "name": "python",
362
+ "nbconvert_exporter": "python",
363
+ "pygments_lexer": "ipython3",
364
+ "version": "3.11.7"
365
+ }
366
+ },
367
+ "nbformat": 4,
368
+ "nbformat_minor": 5
369
+ }
notebook/nvidia-4080-phi-2-2.7b.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebook/nvidia-4090-dolphin-2_6-phi-2-2.7b.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebook/nvidia-4090-llama-2-13b.ipynb ADDED
@@ -0,0 +1,478 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "874cd58e",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "workding dir: /home/inflaton/code/chat-with-orca-2\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "import os\n",
19
+ "import sys\n",
20
+ "from pathlib import Path\n",
21
+ "\n",
22
+ "workding_dir = str(Path.cwd().parent)\n",
23
+ "os.chdir(workding_dir)\n",
24
+ "sys.path.append(workding_dir)\n",
25
+ "print(\"workding dir:\", workding_dir)"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": 2,
31
+ "id": "19f967ca",
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"huggingface\"\n",
36
+ "os.environ[\"HUGGINGFACE_MODEL_NAME_OR_PATH\"] = \"meta-llama/Llama-2-13b-chat-hf\""
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": 3,
42
+ "id": "a6d96660",
43
+ "metadata": {},
44
+ "outputs": [
45
+ {
46
+ "name": "stdout",
47
+ "output_type": "stream",
48
+ "text": [
49
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
50
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
51
+ "MPS is NOT available\n",
52
+ "CUDA is available\n",
53
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
54
+ "CUDA is available, we have found 1 GPU(s)\n",
55
+ "NVIDIA GeForce RTX 4090\n",
56
+ "CUDA version: 12.1\n",
57
+ "hf_embeddings_device_type: cuda:0\n",
58
+ "hf_pipeline_device_type: cuda:0\n",
59
+ "load INSTRUCTOR_Transformer\n",
60
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
61
+ " return self.fget.__get__(instance, owner)()\n",
62
+ "max_seq_length 512\n",
63
+ "Completed in 0.974s\n",
64
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
65
+ "Completed in 0.024s\n",
66
+ "initializing LLM: huggingface\n",
67
+ " hf_pipeline_device_type: cuda:0\n",
68
+ " load_quantized_model: None\n",
69
+ " torch_dtype: torch.bfloat16\n",
70
+ " n_threds: 4\n",
71
+ " loading model: meta-llama/Llama-2-13b-chat-hf\n",
72
+ " HF auth token: None\n",
73
+ " repetition_penalty: 1.05\n",
74
+ "Loading checkpoint shards: 100%|██████████████████| 3/3 [00:08<00:00, 2.78s/it]\n",
75
+ "initialization complete\n",
76
+ "Completed in 20.662s\n",
77
+ "\n",
78
+ "Question: What's PCI DSS?\n",
79
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
80
+ "PCI DSS is the Payment Card Industry Data Security Standard, a global standard that provides a baseline of technical and operational requirements to protect payment data. It's a standard that helps protect payment account data by providing a baseline of technical and operational requirements designed to ensure the secure handling of cardholder data.\n",
81
+ "\n",
82
+ "\n",
83
+ "\n",
84
+ "<on_llm_end>\n",
85
+ "\n",
86
+ "\n",
87
+ "Completed in 46.005s\n",
88
+ "\n",
89
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
90
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS is the Payment Card Industry Data Security Standard, a global standard that provides a baseline of technical and operational requirements to protect payment data. It's a standard that helps protect payment account data by providing a baseline of technical and operational requirements designed to ensure the secure handling of cardholder data.\")]}\n",
91
+ "What are the key changes between PCI DSS version 3.2.1 and version 4.0?\n",
92
+ "\n",
93
+ "Please rephrase the follow-up question to be a standalone question.\n",
94
+ "\n",
95
+ "\n",
96
+ "\n",
97
+ "<on_llm_end>\n",
98
+ "\n",
99
+ "\n",
100
+ " What are the key changes between PCI DSS version 3.2.1 and version 4.0?\n",
101
+ "\n",
102
+ "\n",
103
+ "\n",
104
+ "<on_llm_end>\n",
105
+ "\n",
106
+ "\n",
107
+ "Completed in 40.791s\n",
108
+ "\n",
109
+ "Question: new requirements for vulnerability assessments\n",
110
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS is the Payment Card Industry Data Security Standard, a global standard that provides a baseline of technical and operational requirements to protect payment data. It's a standard that helps protect payment account data by providing a baseline of technical and operational requirements designed to ensure the secure handling of cardholder data.\"), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'What are the key changes between PCI DSS version 3.2.1 and version 4.0?')]}\n",
111
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
112
+ "\n",
113
+ "Please provide the rephrased follow-up question as a standalone question in its original language.\n",
114
+ "\n",
115
+ "The follow-up question should be:\n",
116
+ "\n",
117
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
118
+ "\n",
119
+ "\n",
120
+ "\n",
121
+ "<on_llm_end>\n",
122
+ "\n",
123
+ "\n",
124
+ "\n",
125
+ "\n",
126
+ "According to the provided document, there are two new requirements for vulnerability assessments in PCI DSS version 4.0:\n",
127
+ "\n",
128
+ "1. Maintain an inventory of bespoke and custom software (6.3.2).\n",
129
+ "2. Manage all other applicable vulnerabilities (those not ranked as high-risk or critical) found during internal vulnerability scans (11.3.1.1). This requirement is a best practice until March 31, 2025.\n",
130
+ "\n",
131
+ "\n",
132
+ "\n",
133
+ "<on_llm_end>\n",
134
+ "\n",
135
+ "\n",
136
+ "Completed in 100.915s\n",
137
+ "\n",
138
+ "Question: more on penetration testing\n",
139
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS is the Payment Card Industry Data Security Standard, a global standard that provides a baseline of technical and operational requirements to protect payment data. It's a standard that helps protect payment account data by providing a baseline of technical and operational requirements designed to ensure the secure handling of cardholder data.\"), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'What are the key changes between PCI DSS version 3.2.1 and version 4.0?'), ('new requirements for vulnerability assessments', 'According to the provided document, there are two new requirements for vulnerability assessments in PCI DSS version 4.0:\\n\\n1. Maintain an inventory of bespoke and custom software (6.3.2).\\n2. Manage all other applicable vulnerabilities (those not ranked as high-risk or critical) found during internal vulnerability scans (11.3.1.1). This requirement is a best practice until March 31, 2025.')]}\n",
140
+ "What are the new requirements for penetration testing in PCI DSS version 4.0?\n",
141
+ "\n",
142
+ "\n",
143
+ "\n",
144
+ "<on_llm_end>\n",
145
+ "\n",
146
+ "\n",
147
+ " Based on the provided information, the new requirements for penetration testing in PCI DSS version 4.0 include the following:\n",
148
+ "\n",
149
+ "1. Penetration testing must be performed regularly, and exploitable vulnerabilities and security weaknesses must be corrected.\n",
150
+ "2. The penetration testing methodology must include industry-accepted approaches, coverage for the entire CDE perimeter and critical systems, testing from both inside and outside the network, and testing to validate any segmentation and scope-reduction controls.\n",
151
+ "3. Application-layer penetration testing must be performed to identify at least the vulnerabilities listed in Requirement 6.2.4.\n",
152
+ "4. Network-layer penetration tests must encompass all components that support network functions as well as operating systems.\n",
153
+ "5. The assessor must examine the scope of work and results from the most recent external penetration test to verify that penetration testing is performed according to all elements specified in this requirement.\n",
154
+ "6. The assessor must interview personnel to verify that the external penetration test was performed by a qualified internal resource or qualified external third-party and that organizational independence of the tester exists.\n",
155
+ "\n",
156
+ "Note: These requirements are based on the provided PCI DSS version 4.0 ROC Template r1 and Summary of Changes r2, and may not be comprehensive or up-to-date. It is important to consult the latest version of the PCI DSS documentation for the most current and accurate information.\n",
157
+ "\n",
158
+ "\n",
159
+ "\n",
160
+ "<on_llm_end>\n",
161
+ "\n",
162
+ "\n",
163
+ "Completed in 181.373s\n",
164
+ "Total time used: 369.084 s\n",
165
+ "Number of tokens generated: 677\n",
166
+ "Average generation speed: 1.834 tokens/s\n",
167
+ "CPU times: user 3.36 s, sys: 1.15 s, total: 4.51 s\n",
168
+ "Wall time: 6min 35s\n"
169
+ ]
170
+ }
171
+ ],
172
+ "source": [
173
+ "%%time\n",
174
+ "\n",
175
+ "os.environ[\"HF_RP\"] = \"1.05\"\n",
176
+ "!python qa_chain_test.py"
177
+ ]
178
+ },
179
+ {
180
+ "cell_type": "code",
181
+ "execution_count": 4,
182
+ "id": "8a022a7b",
183
+ "metadata": {},
184
+ "outputs": [
185
+ {
186
+ "name": "stdout",
187
+ "output_type": "stream",
188
+ "text": [
189
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
190
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
191
+ "MPS is NOT available\n",
192
+ "CUDA is available\n",
193
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
194
+ "CUDA is available, we have found 1 GPU(s)\n",
195
+ "NVIDIA GeForce RTX 4090\n",
196
+ "CUDA version: 12.1\n",
197
+ "hf_embeddings_device_type: cuda:0\n",
198
+ "hf_pipeline_device_type: cuda:0\n",
199
+ "load INSTRUCTOR_Transformer\n",
200
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
201
+ " return self.fget.__get__(instance, owner)()\n",
202
+ "max_seq_length 512\n",
203
+ "Completed in 0.941s\n",
204
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
205
+ "Completed in 0.025s\n",
206
+ "initializing LLM: huggingface\n",
207
+ " hf_pipeline_device_type: cuda:0\n",
208
+ " load_quantized_model: None\n",
209
+ " torch_dtype: torch.bfloat16\n",
210
+ " n_threds: 4\n",
211
+ " loading model: meta-llama/Llama-2-13b-chat-hf\n",
212
+ " HF auth token: None\n",
213
+ " repetition_penalty: 1.1\n",
214
+ "Loading checkpoint shards: 100%|██████████████████| 3/3 [00:18<00:00, 6.31s/it]\n",
215
+ "initialization complete\n",
216
+ "Completed in 37.005s\n",
217
+ "\n",
218
+ "Question: What's PCI DSS?\n",
219
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
220
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It's a set of security requirements designed to protect payment card data.\n",
221
+ "\n",
222
+ "\n",
223
+ "\n",
224
+ "<on_llm_end>\n",
225
+ "\n",
226
+ "\n",
227
+ "Completed in 36.327s\n",
228
+ "\n",
229
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
230
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS stands for Payment Card Industry Data Security Standard. It's a set of security requirements designed to protect payment card data.\")]}\n",
231
+ "What are the key changes between PCI DSS version 3.2.1 and version 4.0?\n",
232
+ "\n",
233
+ "Please help me with this! Thank you!\n",
234
+ "\n",
235
+ "\n",
236
+ "\n",
237
+ "<on_llm_end>\n",
238
+ "\n",
239
+ "\n",
240
+ " Based on the provided document, here are the key changes between PCI DSS version 3.2.1 and version 4.0:\n",
241
+ "\n",
242
+ "1. Introduction: The introduction has been updated to reflect the new version number (4.0) and to note that the standard should be reviewed in its entirety due to the extent of changes.\n",
243
+ "\n",
244
+ "2. Change Types: The document highlights three types of changes: modifications, clarifications, and rephrased text.\n",
245
+ "\n",
246
+ "3. Summary of Changes to PCI DSS Introductory Sections: This section summarizes changes made to the introductory sections of the standard, including updates to the definition of \"cardholder data\" and the addition of a new requirement for multi-factor authentication.\n",
247
+ "\n",
248
+ "4. Summary of General Changes to PCI DSS Requirements: This section summarizes changes made throughout the requirements, testing procedures, and guidance, including updates to requirements related to password policies, incident response, and vulnerability management.\n",
249
+ "\n",
250
+ "5. Additional Changes per Requirement: This section provides a detailed list of changes made to each of the 12 requirements, including updates to requirements related to network segmentation, access control, and security testing.\n",
251
+ "\n",
252
+ "Based on this information, it appears that the key changes between PCI DSS version 3.2.1 and version 4.0 include updates to the introductory sections, requirements related to password policies, incident response, and vulnerability management, as well as additional changes to each of the 12 requirements.\n",
253
+ "\n",
254
+ "\n",
255
+ "\n",
256
+ "<on_llm_end>\n",
257
+ "\n",
258
+ "\n",
259
+ "Completed in 195.181s\n",
260
+ "\n",
261
+ "Question: new requirements for vulnerability assessments\n",
262
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS stands for Payment Card Industry Data Security Standard. It's a set of security requirements designed to protect payment card data.\"), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Based on the provided document, here are the key changes between PCI DSS version 3.2.1 and version 4.0:\\n\\n1. Introduction: The introduction has been updated to reflect the new version number (4.0) and to note that the standard should be reviewed in its entirety due to the extent of changes.\\n\\n2. Change Types: The document highlights three types of changes: modifications, clarifications, and rephrased text.\\n\\n3. Summary of Changes to PCI DSS Introductory Sections: This section summarizes changes made to the introductory sections of the standard, including updates to the definition of \"cardholder data\" and the addition of a new requirement for multi-factor authentication.\\n\\n4. Summary of General Changes to PCI DSS Requirements: This section summarizes changes made throughout the requirements, testing procedures, and guidance, including updates to requirements related to password policies, incident response, and vulnerability management.\\n\\n5. Additional Changes per Requirement: This section provides a detailed list of changes made to each of the 12 requirements, including updates to requirements related to network segmentation, access control, and security testing.\\n\\nBased on this information, it appears that the key changes between PCI DSS version 3.2.1 and version 4.0 include updates to the introductory sections, requirements related to password policies, incident response, and vulnerability management, as well as additional changes to each of the 12 requirements.')]}\n",
263
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
264
+ "\n",
265
+ "\n",
266
+ "\n",
267
+ "<on_llm_end>\n",
268
+ "\n",
269
+ "\n",
270
+ " According to the provided document, there are several new requirements for vulnerability assessments in PCI DSS version 4.0. These include:\n",
271
+ "\n",
272
+ "* Performing a targeted risk analysis to determine the frequency of log reviews for all other system components (10.4.2.1)\n",
273
+ "* Detecting, alerting, and addressing promptly failures of critical security control systems (10.7.2 and 10.7.3)\n",
274
+ "* Documenting, assigning, and understanding roles and responsibilities for performing activities in Requirement 11 (11.1.2)\n",
275
+ "* Managing all other applicable vulnerabilities (those not ranked as high-risk or critical) (11.3.1.1)\n",
276
+ "* Performing internal vulnerability scans via authenticated scanning (11.3.1.2)\n",
277
+ "* Supporting multi-tenant service providers (11.4.7)\n",
278
+ "* Implementing processes or mechanisms for reporting and addressing suspected or confirmed security incidents and vulnerabilities (A1.2.3)\n",
279
+ "* Detecting, alerting, and reporting in a timely manner failures of automated log review mechanisms and automated code review tools (A3.3.1)\n",
280
+ "\n",
281
+ "\n",
282
+ "\n",
283
+ "<on_llm_end>\n",
284
+ "\n",
285
+ "\n",
286
+ "Completed in 170.772s\n",
287
+ "\n",
288
+ "Question: more on penetration testing\n",
289
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS stands for Payment Card Industry Data Security Standard. It's a set of security requirements designed to protect payment card data.\"), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Based on the provided document, here are the key changes between PCI DSS version 3.2.1 and version 4.0:\\n\\n1. Introduction: The introduction has been updated to reflect the new version number (4.0) and to note that the standard should be reviewed in its entirety due to the extent of changes.\\n\\n2. Change Types: The document highlights three types of changes: modifications, clarifications, and rephrased text.\\n\\n3. Summary of Changes to PCI DSS Introductory Sections: This section summarizes changes made to the introductory sections of the standard, including updates to the definition of \"cardholder data\" and the addition of a new requirement for multi-factor authentication.\\n\\n4. Summary of General Changes to PCI DSS Requirements: This section summarizes changes made throughout the requirements, testing procedures, and guidance, including updates to requirements related to password policies, incident response, and vulnerability management.\\n\\n5. Additional Changes per Requirement: This section provides a detailed list of changes made to each of the 12 requirements, including updates to requirements related to network segmentation, access control, and security testing.\\n\\nBased on this information, it appears that the key changes between PCI DSS version 3.2.1 and version 4.0 include updates to the introductory sections, requirements related to password policies, incident response, and vulnerability management, as well as additional changes to each of the 12 requirements.'), ('new requirements for vulnerability assessments', 'According to the provided document, there are several new requirements for vulnerability assessments in PCI DSS version 4.0. These include:\\n\\n* Performing a targeted risk analysis to determine the frequency of log reviews for all other system components (10.4.2.1)\\n* Detecting, alerting, and addressing promptly failures of critical security control systems (10.7.2 and 10.7.3)\\n* Documenting, assigning, and understanding roles and responsibilities for performing activities in Requirement 11 (11.1.2)\\n* Managing all other applicable vulnerabilities (those not ranked as high-risk or critical) (11.3.1.1)\\n* Performing internal vulnerability scans via authenticated scanning (11.3.1.2)\\n* Supporting multi-tenant service providers (11.4.7)\\n* Implementing processes or mechanisms for reporting and addressing suspected or confirmed security incidents and vulnerabilities (A1.2.3)\\n* Detecting, alerting, and reporting in a timely manner failures of automated log review mechanisms and automated code review tools (A3.3.1)')]}\n",
290
+ "What are the new requirements for penetration testing in PCI DSS version 4.0?\n",
291
+ "\n",
292
+ "\n",
293
+ "\n",
294
+ "<on_llm_end>\n",
295
+ "\n",
296
+ "\n",
297
+ " Based on the provided information, there are two new requirements for penetration testing in PCI DSS version 4.0. Firstly, the penetration testing methodology must include industry-accepted penetration testing approaches, coverage for the entire CDE perimeter, and testing from both inside and outside the network. Secondly, the assessment must examine the scope of work and results from the most recent external penetration test to ensure that penetration testing is performed according to all elements specified in this requirement. Additionally, the assessor must interview personnel to verify that the external penetration test was performed by a qualified internal resource or qualified external third-party and that organizational independence of the tester exists.\n",
298
+ "\n",
299
+ "\n",
300
+ "\n",
301
+ "<on_llm_end>\n",
302
+ "\n",
303
+ "\n",
304
+ "Completed in 103.536s\n",
305
+ "Total time used: 505.816 s\n",
306
+ "Number of tokens generated: 881\n",
307
+ "Average generation speed: 1.742 tokens/s\n",
308
+ "CPU times: user 4.76 s, sys: 1.45 s, total: 6.21 s\n",
309
+ "Wall time: 9min 9s\n"
310
+ ]
311
+ }
312
+ ],
313
+ "source": [
314
+ "%%time\n",
315
+ "\n",
316
+ "os.environ[\"HF_RP\"] = \"1.10\"\n",
317
+ "!python qa_chain_test.py"
318
+ ]
319
+ },
320
+ {
321
+ "cell_type": "code",
322
+ "execution_count": 5,
323
+ "id": "db48dcc4",
324
+ "metadata": {},
325
+ "outputs": [
326
+ {
327
+ "name": "stdout",
328
+ "output_type": "stream",
329
+ "text": [
330
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
331
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
332
+ "MPS is NOT available\n",
333
+ "CUDA is available\n",
334
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
335
+ "CUDA is available, we have found 1 GPU(s)\n",
336
+ "NVIDIA GeForce RTX 4090\n",
337
+ "CUDA version: 12.1\n",
338
+ "hf_embeddings_device_type: cuda:0\n",
339
+ "hf_pipeline_device_type: cuda:0\n",
340
+ "load INSTRUCTOR_Transformer\n",
341
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
342
+ " return self.fget.__get__(instance, owner)()\n",
343
+ "max_seq_length 512\n",
344
+ "Completed in 1.202s\n",
345
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
346
+ "Completed in 0.040s\n",
347
+ "initializing LLM: huggingface\n",
348
+ " hf_pipeline_device_type: cuda:0\n",
349
+ " load_quantized_model: None\n",
350
+ " torch_dtype: torch.bfloat16\n",
351
+ " n_threds: 4\n",
352
+ " loading model: meta-llama/Llama-2-13b-chat-hf\n",
353
+ " HF auth token: None\n",
354
+ " repetition_penalty: 1.15\n",
355
+ "Loading checkpoint shards: 100%|██████████████████| 3/3 [00:08<00:00, 2.72s/it]\n",
356
+ "initialization complete\n",
357
+ "Completed in 20.624s\n",
358
+ "\n",
359
+ "Question: What's PCI DSS?\n",
360
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
361
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It's a set of security requirements designed to protect payment card data.\n",
362
+ "\n",
363
+ "\n",
364
+ "\n",
365
+ "<on_llm_end>\n",
366
+ "\n",
367
+ "\n",
368
+ "Completed in 31.125s\n",
369
+ "\n",
370
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
371
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS stands for Payment Card Industry Data Security Standard. It's a set of security requirements designed to protect payment card data.\")]}\n",
372
+ "What are the key changes between PCI DSS version 3.2.1 and version 4.0?\n",
373
+ "\n",
374
+ "Please help me with this! Thank you so much!\n",
375
+ "\n",
376
+ "\n",
377
+ "\n",
378
+ "<on_llm_end>\n",
379
+ "\n",
380
+ "\n",
381
+ " Based on the provided document, here are some key changes between PCI DSS version 3.2.1 and version 4.0:\n",
382
+ "\n",
383
+ "1. The introduction has been updated to reflect the new version number (4.0) and to note that the standard should be reviewed in its entirety due to the extent of changes.\n",
384
+ "2. There have been significant updates to the introductory sections, including changes to the definitions of \"account information\" and \"sensitive authentication data.\"\n",
385
+ "3. Requirement 8.3.9 has been updated to clarify that multi-factor authentication is required for all remote access to the cardholder data environment.\n",
386
+ "4. Requirement 6.3.3 has been updated to require that all user accounts have expiration dates and prohibit password reuse within the last four years.\n",
387
+ "5. A new requirement (3.6.1.1) has been added to mandate the use of secure protocols for all network communication.\n",
388
+ "6. Minor corrections and edits have been made throughout the document for clarification and formatting purposes.\n",
389
+ "\n",
390
+ "\n",
391
+ "\n",
392
+ "<on_llm_end>\n",
393
+ "\n",
394
+ "\n",
395
+ "Completed in 139.938s\n",
396
+ "\n",
397
+ "Question: new requirements for vulnerability assessments\n",
398
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS stands for Payment Card Industry Data Security Standard. It's a set of security requirements designed to protect payment card data.\"), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Based on the provided document, here are some key changes between PCI DSS version 3.2.1 and version 4.0:\\n\\n1. The introduction has been updated to reflect the new version number (4.0) and to note that the standard should be reviewed in its entirety due to the extent of changes.\\n2. There have been significant updates to the introductory sections, including changes to the definitions of \"account information\" and \"sensitive authentication data.\"\\n3. Requirement 8.3.9 has been updated to clarify that multi-factor authentication is required for all remote access to the cardholder data environment.\\n4. Requirement 6.3.3 has been updated to require that all user accounts have expiration dates and prohibit password reuse within the last four years.\\n5. A new requirement (3.6.1.1) has been added to mandate the use of secure protocols for all network communication.\\n6. Minor corrections and edits have been made throughout the document for clarification and formatting purposes.')]}\n",
399
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
400
+ "\n",
401
+ "\n",
402
+ "\n",
403
+ "<on_llm_end>\n",
404
+ "\n",
405
+ "\n",
406
+ " According to the provided document, there are several new requirements for vulnerability assessments in PCI DSS version 4.0. These include:\n",
407
+ "\n",
408
+ "* Performing a targeted risk analysis to determine the frequency of log reviews for all other system components (10.4.2.1)\n",
409
+ "* Detecting, alerting, and addressing failures of critical security control systems promptly (10.7.2 and 10.7.3)\n",
410
+ "* Documenting, assigning, and understanding roles and responsibilities for performing activities in Requirement 11 (11.1.2)\n",
411
+ "* Managing all other applicable vulnerabilities (not ranked as high-risk or critical) (11.3.1.1)\n",
412
+ "* Performing internal vulnerability scans via authenticated scanning (11.3.1.2)\n",
413
+ "* Supporting multi-tenant services (11.4.7)\n",
414
+ "* Implementing processes or mechanisms for reporting and addressing suspected or confirmed security incidents and vulnerabilities (A1.2.3)\n",
415
+ "* Detecting, alerting, and reporting failures of automated log review mechanisms and automated code review tools in a timely manner (A3.3.1)\n",
416
+ "\n",
417
+ "\n",
418
+ "\n",
419
+ "<on_llm_end>\n",
420
+ "\n",
421
+ "\n",
422
+ "Completed in 164.073s\n",
423
+ "\n",
424
+ "Question: more on penetration testing\n",
425
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", \"PCI DSS stands for Payment Card Industry Data Security Standard. It's a set of security requirements designed to protect payment card data.\"), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Based on the provided document, here are some key changes between PCI DSS version 3.2.1 and version 4.0:\\n\\n1. The introduction has been updated to reflect the new version number (4.0) and to note that the standard should be reviewed in its entirety due to the extent of changes.\\n2. There have been significant updates to the introductory sections, including changes to the definitions of \"account information\" and \"sensitive authentication data.\"\\n3. Requirement 8.3.9 has been updated to clarify that multi-factor authentication is required for all remote access to the cardholder data environment.\\n4. Requirement 6.3.3 has been updated to require that all user accounts have expiration dates and prohibit password reuse within the last four years.\\n5. A new requirement (3.6.1.1) has been added to mandate the use of secure protocols for all network communication.\\n6. Minor corrections and edits have been made throughout the document for clarification and formatting purposes.'), ('new requirements for vulnerability assessments', 'According to the provided document, there are several new requirements for vulnerability assessments in PCI DSS version 4.0. These include:\\n\\n* Performing a targeted risk analysis to determine the frequency of log reviews for all other system components (10.4.2.1)\\n* Detecting, alerting, and addressing failures of critical security control systems promptly (10.7.2 and 10.7.3)\\n* Documenting, assigning, and understanding roles and responsibilities for performing activities in Requirement 11 (11.1.2)\\n* Managing all other applicable vulnerabilities (not ranked as high-risk or critical) (11.3.1.1)\\n* Performing internal vulnerability scans via authenticated scanning (11.3.1.2)\\n* Supporting multi-tenant services (11.4.7)\\n* Implementing processes or mechanisms for reporting and addressing suspected or confirmed security incidents and vulnerabilities (A1.2.3)\\n* Detecting, alerting, and reporting failures of automated log review mechanisms and automated code review tools in a timely manner (A3.3.1)')]}\n",
426
+ "What are the new requirements for penetration testing in PCI DSS version 4.0?\n",
427
+ "\n",
428
+ "\n",
429
+ "\n",
430
+ "<on_llm_end>\n",
431
+ "\n",
432
+ "\n",
433
+ " Based on the provided information, there are two new requirements for penetration testing in PCI DSS version 4.0. Firstly, the penetration testing methodology must include industry-accepted penetration testing approaches, coverage for the entire CDE perimeter, and testing from both inside and outside the network. Secondly, the assessment must examine the scope of work and results from the most recent external penetration test to ensure that penetration testing is performed according to all elements specified in this requirement. Additionally, the assessor must interview personnel to verify that the external penetration test was performed by a qualified internal resource or qualified external third-party and that organizational independence of the tester exists.\n",
434
+ "\n",
435
+ "\n",
436
+ "\n",
437
+ "<on_llm_end>\n",
438
+ "\n",
439
+ "\n",
440
+ "Completed in 100.293s\n",
441
+ "Total time used: 435.429 s\n",
442
+ "Number of tokens generated: 777\n",
443
+ "Average generation speed: 1.784 tokens/s\n",
444
+ "CPU times: user 3.96 s, sys: 1.08 s, total: 5.04 s\n",
445
+ "Wall time: 7min 44s\n"
446
+ ]
447
+ }
448
+ ],
449
+ "source": [
450
+ "%%time\n",
451
+ "\n",
452
+ "os.environ[\"HF_RP\"] = \"1.15\"\n",
453
+ "!python qa_chain_test.py"
454
+ ]
455
+ }
456
+ ],
457
+ "metadata": {
458
+ "kernelspec": {
459
+ "display_name": "Python 3 (ipykernel)",
460
+ "language": "python",
461
+ "name": "python3"
462
+ },
463
+ "language_info": {
464
+ "codemirror_mode": {
465
+ "name": "ipython",
466
+ "version": 3
467
+ },
468
+ "file_extension": ".py",
469
+ "mimetype": "text/x-python",
470
+ "name": "python",
471
+ "nbconvert_exporter": "python",
472
+ "pygments_lexer": "ipython3",
473
+ "version": "3.11.7"
474
+ }
475
+ },
476
+ "nbformat": 4,
477
+ "nbformat_minor": 5
478
+ }
notebook/nvidia-4090-llama-2-7b.ipynb ADDED
@@ -0,0 +1,451 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "874cd58e",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "workding dir: /home/inflaton/code/chat-with-orca-2\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "import os\n",
19
+ "import sys\n",
20
+ "from pathlib import Path\n",
21
+ "\n",
22
+ "workding_dir = str(Path.cwd().parent)\n",
23
+ "os.chdir(workding_dir)\n",
24
+ "sys.path.append(workding_dir)\n",
25
+ "print(\"workding dir:\", workding_dir)"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": 2,
31
+ "id": "19f967ca",
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"huggingface\"\n",
36
+ "os.environ[\"HUGGINGFACE_MODEL_NAME_OR_PATH\"] = \"meta-llama/Llama-2-7b-chat-hf\""
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": 3,
42
+ "id": "a6d96660",
43
+ "metadata": {},
44
+ "outputs": [
45
+ {
46
+ "name": "stdout",
47
+ "output_type": "stream",
48
+ "text": [
49
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
50
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
51
+ "MPS is NOT available\n",
52
+ "CUDA is available\n",
53
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
54
+ "CUDA is available, we have found 1 GPU(s)\n",
55
+ "NVIDIA GeForce RTX 4090\n",
56
+ "CUDA version: 12.1\n",
57
+ "hf_embeddings_device_type: cuda:0\n",
58
+ "hf_pipeline_device_type: cuda:0\n",
59
+ "load INSTRUCTOR_Transformer\n",
60
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
61
+ " return self.fget.__get__(instance, owner)()\n",
62
+ "max_seq_length 512\n",
63
+ "Completed in 0.947s\n",
64
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
65
+ "Completed in 0.028s\n",
66
+ "initializing LLM: huggingface\n",
67
+ " hf_pipeline_device_type: cuda:0\n",
68
+ " load_quantized_model: None\n",
69
+ " torch_dtype: torch.bfloat16\n",
70
+ " n_threds: 4\n",
71
+ " loading model: meta-llama/Llama-2-7b-chat-hf\n",
72
+ " HF auth token: None\n",
73
+ " repetition_penalty: 1.05\n",
74
+ "Loading checkpoint shards: 100%|██████████████████| 2/2 [00:07<00:00, 3.74s/it]\n",
75
+ "initialization complete\n",
76
+ "Completed in 42.539s\n",
77
+ "\n",
78
+ "Question: What's PCI DSS?\n",
79
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
80
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard was developed by the PCI Security Standards Council and is widely adopted by organizations that handle payment card data. PCI DSS v4.0 is the latest version of the standard, which includes new controls to address sophisticated cyber attacks.\n",
81
+ "\n",
82
+ "\n",
83
+ "\n",
84
+ "<on_llm_end>\n",
85
+ "\n",
86
+ "\n",
87
+ "Completed in 4.870s\n",
88
+ "\n",
89
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
90
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard was developed by the PCI Security Standards Council and is widely adopted by organizations that handle payment card data. PCI DSS v4.0 is the latest version of the standard, which includes new controls to address sophisticated cyber attacks.')]}\n",
91
+ "What are the key changes made in PCI DSS version 4.0 compared to version 3.2.1?\n",
92
+ "\n",
93
+ "\n",
94
+ "\n",
95
+ "<on_llm_end>\n",
96
+ "\n",
97
+ "\n",
98
+ " Based on the provided document, the key changes made in PCI DSS version 4.0 compared to version 3.2.1 include:\n",
99
+ "\n",
100
+ "* Update of principal requirement title to reflect the focus on \"network security controls\"\n",
101
+ "* Replacement of \"firewalls\" and \"routers\" with \"network security controls\" to support a broader range of technologies used to meet the security objectives traditionally met by firewalls\n",
102
+ "* Removal of requirement for \"Description of groups, roles, and responsibilities for management of network components\" and replacement with a general requirement for roles and responsibilities for Requirement 1\n",
103
+ "* Refocusing of former \"null\" requirement (all content pointed to other requirements) on defining,\n",
104
+ "\n",
105
+ "Unhelpful Answer: I'm not sure, can you provide more context or information about the changes made in PCI DSS version 4.0 compared to version 3.2.1?\n",
106
+ "\n",
107
+ "\n",
108
+ "\n",
109
+ "<on_llm_end>\n",
110
+ "\n",
111
+ "\n",
112
+ "Completed in 5.714s\n",
113
+ "\n",
114
+ "Question: new requirements for vulnerability assessments\n",
115
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard was developed by the PCI Security Standards Council and is widely adopted by organizations that handle payment card data. PCI DSS v4.0 is the latest version of the standard, which includes new controls to address sophisticated cyber attacks.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Based on the provided document, the key changes made in PCI DSS version 4.0 compared to version 3.2.1 include:\\n\\n* Update of principal requirement title to reflect the focus on \"network security controls\"\\n* Replacement of \"firewalls\" and \"routers\" with \"network security controls\" to support a broader range of technologies used to meet the security objectives traditionally met by firewalls\\n* Removal of requirement for \"Description of groups, roles, and responsibilities for management of network components\" and replacement with a general requirement for roles and responsibilities for Requirement 1\\n* Refocusing of former \"null\" requirement (all content pointed to other requirements) on defining,\\n\\nUnhelpful Answer: I\\'m not sure, can you provide more context or information about the changes made in PCI DSS version 4.0 compared to version 3.2.1?')]}\n",
116
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0 compared to version 3.2.1?\n",
117
+ "\n",
118
+ "\n",
119
+ "\n",
120
+ "<on_llm_end>\n",
121
+ "\n",
122
+ "\n",
123
+ " According to the provided summary of changes, there are two new requirements for vulnerability assessments in PCI DSS version 4.0 compared to version 3.2.1:\n",
124
+ "\n",
125
+ "* Requirement 4.1.2: New requirement for roles and responsibilities.\n",
126
+ "* Requirement 6.3.2: New requirement to maintain an inventory of bespoke and custom software.\n",
127
+ "\n",
128
+ "Unhelpful Answer: I don't know the answer to your question.\n",
129
+ "\n",
130
+ "\n",
131
+ "\n",
132
+ "<on_llm_end>\n",
133
+ "\n",
134
+ "\n",
135
+ "Completed in 3.566s\n",
136
+ "\n",
137
+ "Question: more on penetration testing\n",
138
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard was developed by the PCI Security Standards Council and is widely adopted by organizations that handle payment card data. PCI DSS v4.0 is the latest version of the standard, which includes new controls to address sophisticated cyber attacks.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Based on the provided document, the key changes made in PCI DSS version 4.0 compared to version 3.2.1 include:\\n\\n* Update of principal requirement title to reflect the focus on \"network security controls\"\\n* Replacement of \"firewalls\" and \"routers\" with \"network security controls\" to support a broader range of technologies used to meet the security objectives traditionally met by firewalls\\n* Removal of requirement for \"Description of groups, roles, and responsibilities for management of network components\" and replacement with a general requirement for roles and responsibilities for Requirement 1\\n* Refocusing of former \"null\" requirement (all content pointed to other requirements) on defining,\\n\\nUnhelpful Answer: I\\'m not sure, can you provide more context or information about the changes made in PCI DSS version 4.0 compared to version 3.2.1?'), ('new requirements for vulnerability assessments', \"According to the provided summary of changes, there are two new requirements for vulnerability assessments in PCI DSS version 4.0 compared to version 3.2.1:\\n\\n* Requirement 4.1.2: New requirement for roles and responsibilities.\\n* Requirement 6.3.2: New requirement to maintain an inventory of bespoke and custom software.\\n\\nUnhelpful Answer: I don't know the answer to your question.\")]}\n",
139
+ "What are the new requirements for penetration testing in PCI DSS version 4.0 compared to version 3.2.1?\n",
140
+ "\n",
141
+ "\n",
142
+ "\n",
143
+ "<on_llm_end>\n",
144
+ "\n",
145
+ "\n",
146
+ " The new requirement for penetration testing in PCI DSS version 4.0 is 11.4.1, which states that external and internal penetration testing is regularly performed, and exploitable vulnerabilities and security weaknesses are corrected. This requirement includes a detailed list of what the penetration testing methodology should cover, such as industry-accepted penetration testing approaches, coverage of the entire CDE perimeter and critical systems, testing from both inside and outside the network, and application-layer penetration testing to identify vulnerabilities listed in Requirement 6.2.4. Additionally, the requirement includes network-layer penetration tests that encompass all components that support network functions as well as operating systems.\n",
147
+ "\n",
148
+ "Unhelpful Answer: I don't know the answer to your question.\n",
149
+ "\n",
150
+ "\n",
151
+ "\n",
152
+ "<on_llm_end>\n",
153
+ "\n",
154
+ "\n",
155
+ "Completed in 5.318s\n",
156
+ "Total time used: 19.468 s\n",
157
+ "Number of tokens generated: 679\n",
158
+ "Average generation speed: 34.878 tokens/s\n",
159
+ "CPU times: user 638 ms, sys: 275 ms, total: 913 ms\n",
160
+ "Wall time: 1min 7s\n"
161
+ ]
162
+ }
163
+ ],
164
+ "source": [
165
+ "%%time\n",
166
+ "\n",
167
+ "os.environ[\"HF_RP\"] = \"1.05\"\n",
168
+ "!python qa_chain_test.py"
169
+ ]
170
+ },
171
+ {
172
+ "cell_type": "code",
173
+ "execution_count": 4,
174
+ "id": "8a022a7b",
175
+ "metadata": {},
176
+ "outputs": [
177
+ {
178
+ "name": "stdout",
179
+ "output_type": "stream",
180
+ "text": [
181
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
182
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
183
+ "MPS is NOT available\n",
184
+ "CUDA is available\n",
185
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
186
+ "CUDA is available, we have found 1 GPU(s)\n",
187
+ "NVIDIA GeForce RTX 4090\n",
188
+ "CUDA version: 12.1\n",
189
+ "hf_embeddings_device_type: cuda:0\n",
190
+ "hf_pipeline_device_type: cuda:0\n",
191
+ "load INSTRUCTOR_Transformer\n",
192
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
193
+ " return self.fget.__get__(instance, owner)()\n",
194
+ "max_seq_length 512\n",
195
+ "Completed in 0.498s\n",
196
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
197
+ "Completed in 0.025s\n",
198
+ "initializing LLM: huggingface\n",
199
+ " hf_pipeline_device_type: cuda:0\n",
200
+ " load_quantized_model: None\n",
201
+ " torch_dtype: torch.bfloat16\n",
202
+ " n_threds: 4\n",
203
+ " loading model: meta-llama/Llama-2-7b-chat-hf\n",
204
+ " HF auth token: None\n",
205
+ " repetition_penalty: 1.1\n",
206
+ "Loading checkpoint shards: 100%|██████████████████| 2/2 [00:02<00:00, 1.04s/it]\n",
207
+ "initialization complete\n",
208
+ "Completed in 7.318s\n",
209
+ "\n",
210
+ "Question: What's PCI DSS?\n",
211
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
212
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more. The latest version of PCI DSS, version 4.0, was released in December 2022, and it includes new controls to address sophisticated cyber attacks.\n",
213
+ "\n",
214
+ "\n",
215
+ "\n",
216
+ "<on_llm_end>\n",
217
+ "\n",
218
+ "\n",
219
+ "Completed in 6.128s\n",
220
+ "\n",
221
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
222
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more. The latest version of PCI DSS, version 4.0, was released in December 2022, and it includes new controls to address sophisticated cyber attacks.')]}\n",
223
+ "What are the key changes made in PCI DSS version 4.0 compared to version 3.2.1?\n",
224
+ "\n",
225
+ "\n",
226
+ "\n",
227
+ "<on_llm_end>\n",
228
+ "\n",
229
+ "\n",
230
+ "The key changes made in PCI DSS version 4.0 compared to version 3.2.1 include updated principal requirement titles, replaced \"firewalls\" and \"routers\" with \"network security controls\", and refocused former \"null\" requirements on defining roles and responsibilities. Additionally, there were errata updates made in May 2022 to correct the change description for PCI DSS v4.0 requirement 8.3.9 and in December 2022 to add a description of the change made to Requirement 6.3.3 and to correct the entry in the Summary of New Requirements table for Requirement 3.6.1.1.\n",
231
+ "\n",
232
+ "\n",
233
+ "\n",
234
+ "<on_llm_end>\n",
235
+ "\n",
236
+ "\n",
237
+ "Completed in 4.480s\n",
238
+ "\n",
239
+ "Question: new requirements for vulnerability assessments\n",
240
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more. The latest version of PCI DSS, version 4.0, was released in December 2022, and it includes new controls to address sophisticated cyber attacks.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The key changes made in PCI DSS version 4.0 compared to version 3.2.1 include updated principal requirement titles, replaced \"firewalls\" and \"routers\" with \"network security controls\", and refocused former \"null\" requirements on defining roles and responsibilities. Additionally, there were errata updates made in May 2022 to correct the change description for PCI DSS v4.0 requirement 8.3.9 and in December 2022 to add a description of the change made to Requirement 6.3.3 and to correct the entry in the Summary of New Requirements table for Requirement 3.6.1.1.')]}\n",
241
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0 compared to previous versions?\n",
242
+ "\n",
243
+ "\n",
244
+ "\n",
245
+ "<on_llm_end>\n",
246
+ "\n",
247
+ "\n",
248
+ "The new requirement for vulnerability assessments in PCI DSS version 4.0 is 6.3.2, which adds a bullet to clarify applicability to vulnerabilities for bespoke and custom and third-party software. Additionally, there are general changes implemented throughout PCI DSS requirements, such as reformatted overview sections, updated guidance, and renumbered requirements and testing procedures. However, I cannot provide an exact answer without knowing the specific context of your environment and the version of PCI DSS you are referring to.\n",
249
+ "\n",
250
+ "\n",
251
+ "\n",
252
+ "<on_llm_end>\n",
253
+ "\n",
254
+ "\n",
255
+ "Completed in 3.577s\n",
256
+ "\n",
257
+ "Question: more on penetration testing\n",
258
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. The standard is developed and maintained by the PCI Security Standards Council, and it includes requirements for building and maintaining a secure network and systems, protecting account data, maintaining a vulnerability management program, implementing strong access control measures, and more. The latest version of PCI DSS, version 4.0, was released in December 2022, and it includes new controls to address sophisticated cyber attacks.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The key changes made in PCI DSS version 4.0 compared to version 3.2.1 include updated principal requirement titles, replaced \"firewalls\" and \"routers\" with \"network security controls\", and refocused former \"null\" requirements on defining roles and responsibilities. Additionally, there were errata updates made in May 2022 to correct the change description for PCI DSS v4.0 requirement 8.3.9 and in December 2022 to add a description of the change made to Requirement 6.3.3 and to correct the entry in the Summary of New Requirements table for Requirement 3.6.1.1.'), ('new requirements for vulnerability assessments', 'The new requirement for vulnerability assessments in PCI DSS version 4.0 is 6.3.2, which adds a bullet to clarify applicability to vulnerabilities for bespoke and custom and third-party software. Additionally, there are general changes implemented throughout PCI DSS requirements, such as reformatted overview sections, updated guidance, and renumbered requirements and testing procedures. However, I cannot provide an exact answer without knowing the specific context of your environment and the version of PCI DSS you are referring to.')]}\n",
259
+ "What are the new requirements for penetration testing in PCI DSS version 4.0?\n",
260
+ "\n",
261
+ "\n",
262
+ "\n",
263
+ "<on_llm_end>\n",
264
+ "\n",
265
+ "\n",
266
+ "The new requirements for penetration testing in PCI DSS version 4.0 can be found on pages 372-377 of the PCI DSS v4.0 ROC Template r1 published in December 2022. Specifically, the new requirements include:\n",
267
+ "\n",
268
+ "* A penetration testing methodology must be defined, documented, and implemented by the entity (Requirement 11.4.1).\n",
269
+ "* Penetration testing must be conducted regularly and must cover the entire CDE perimeter and critical systems (Requirement 11.4.2).\n",
270
+ "* Testing must be performed from both inside and outside the network (Requirement 11.4.2).\n",
271
+ "* Testing must validate any segmentation and scope-reduction controls (Requirement 11.4.2).\n",
272
+ "* Application-layer penetration testing must be conducted to identify, at a minimum, the vulnerabilities listed in Requirement 6.2.4 (Requirement 11.4.1).\n",
273
+ "* Network-layer penetration tests must encompass all components that support network functions as well as operating systems (Requirement 11.4.1).\n",
274
+ "\n",
275
+ "If you don't know the answer, please say so.\n",
276
+ "\n",
277
+ "\n",
278
+ "\n",
279
+ "<on_llm_end>\n",
280
+ "\n",
281
+ "\n",
282
+ "Completed in 7.484s\n",
283
+ "Total time used: 21.670 s\n",
284
+ "Number of tokens generated: 759\n",
285
+ "Average generation speed: 35.026 tokens/s\n",
286
+ "CPU times: user 356 ms, sys: 147 ms, total: 503 ms\n",
287
+ "Wall time: 33.6 s\n"
288
+ ]
289
+ }
290
+ ],
291
+ "source": [
292
+ "%%time\n",
293
+ "\n",
294
+ "os.environ[\"HF_RP\"] = \"1.10\"\n",
295
+ "!python qa_chain_test.py"
296
+ ]
297
+ },
298
+ {
299
+ "cell_type": "code",
300
+ "execution_count": 5,
301
+ "id": "db48dcc4",
302
+ "metadata": {},
303
+ "outputs": [
304
+ {
305
+ "name": "stdout",
306
+ "output_type": "stream",
307
+ "text": [
308
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
309
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
310
+ "MPS is NOT available\n",
311
+ "CUDA is available\n",
312
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
313
+ "CUDA is available, we have found 1 GPU(s)\n",
314
+ "NVIDIA GeForce RTX 4090\n",
315
+ "CUDA version: 12.1\n",
316
+ "hf_embeddings_device_type: cuda:0\n",
317
+ "hf_pipeline_device_type: cuda:0\n",
318
+ "load INSTRUCTOR_Transformer\n",
319
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
320
+ " return self.fget.__get__(instance, owner)()\n",
321
+ "max_seq_length 512\n",
322
+ "Completed in 0.454s\n",
323
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
324
+ "Completed in 0.014s\n",
325
+ "initializing LLM: huggingface\n",
326
+ " hf_pipeline_device_type: cuda:0\n",
327
+ " load_quantized_model: None\n",
328
+ " torch_dtype: torch.bfloat16\n",
329
+ " n_threds: 4\n",
330
+ " loading model: meta-llama/Llama-2-7b-chat-hf\n",
331
+ " HF auth token: None\n",
332
+ " repetition_penalty: 1.15\n",
333
+ "Loading checkpoint shards: 100%|██████████████████| 2/2 [00:01<00:00, 1.25it/s]\n",
334
+ "initialization complete\n",
335
+ "Completed in 5.131s\n",
336
+ "\n",
337
+ "Question: What's PCI DSS?\n",
338
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
339
+ "According to the given quick reference guide, PCI DSS stands for \"Payment Card Industry Data Security Standard.\" It is a global standard providing a baseline of technical and operational requirements designed to protect payment account data.\n",
340
+ "\n",
341
+ "\n",
342
+ "\n",
343
+ "<on_llm_end>\n",
344
+ "\n",
345
+ "\n",
346
+ "Completed in 3.775s\n",
347
+ "\n",
348
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
349
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'According to the given quick reference guide, PCI DSS stands for \"Payment Card Industry Data Security Standard.\" It is a global standard providing a baseline of technical and operational requirements designed to protect payment account data.')]}\n",
350
+ "What are the key changes between PCI DSS versions 3.2.1 and 4.0?\n",
351
+ "\n",
352
+ "\n",
353
+ "\n",
354
+ "<on_llm_end>\n",
355
+ "\n",
356
+ "\n",
357
+ "The document highlights several significant modifications between PCI DSS versions 3.2.1 and 4.0, including updates to introductory sections, general adjustments to requirements, and extra alterations according to each requirement. However, I cannot provide detailed information about these changes without access to the full version of the standard or expertise in PCI compliance.\n",
358
+ "\n",
359
+ "\n",
360
+ "\n",
361
+ "<on_llm_end>\n",
362
+ "\n",
363
+ "\n",
364
+ "Completed in 2.568s\n",
365
+ "\n",
366
+ "Question: new requirements for vulnerability assessments\n",
367
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'According to the given quick reference guide, PCI DSS stands for \"Payment Card Industry Data Security Standard.\" It is a global standard providing a baseline of technical and operational requirements designed to protect payment account data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The document highlights several significant modifications between PCI DSS versions 3.2.1 and 4.0, including updates to introductory sections, general adjustments to requirements, and extra alterations according to each requirement. However, I cannot provide detailed information about these changes without access to the full version of the standard or expertise in PCI compliance.')]}\n",
368
+ "What are some of the new requirements for vulnerability assessments introduced in PCI DSS version 4.0 compared to previous versions?\n",
369
+ "\n",
370
+ "\n",
371
+ "\n",
372
+ "<on_llm_end>\n",
373
+ "\n",
374
+ "\n",
375
+ "According to the provided documents, one of the new requirements for vulnerability assessments introduced in PCI DSS version 4.0 is the addition of a bullet point in requirement 6.3.1 to clarify applicability to vulnerabilities for bespoke and custom and third-party software (see page 10). Additionally, there is a new requirement for maintaining an inventory of trusted keys and certificates (see page 1), which is a best practice until March 31, 2025.\n",
376
+ "\n",
377
+ "\n",
378
+ "\n",
379
+ "<on_llm_end>\n",
380
+ "\n",
381
+ "\n",
382
+ "Completed in 3.544s\n",
383
+ "\n",
384
+ "Question: more on penetration testing\n",
385
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'According to the given quick reference guide, PCI DSS stands for \"Payment Card Industry Data Security Standard.\" It is a global standard providing a baseline of technical and operational requirements designed to protect payment account data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The document highlights several significant modifications between PCI DSS versions 3.2.1 and 4.0, including updates to introductory sections, general adjustments to requirements, and extra alterations according to each requirement. However, I cannot provide detailed information about these changes without access to the full version of the standard or expertise in PCI compliance.'), ('new requirements for vulnerability assessments', 'According to the provided documents, one of the new requirements for vulnerability assessments introduced in PCI DSS version 4.0 is the addition of a bullet point in requirement 6.3.1 to clarify applicability to vulnerabilities for bespoke and custom and third-party software (see page 10). Additionally, there is a new requirement for maintaining an inventory of trusted keys and certificates (see page 1), which is a best practice until March 31, 2025.')]}\n",
386
+ "Could you explain what penetration testing entails in the context of PCI DSS compliance?\n",
387
+ "\n",
388
+ "\n",
389
+ "\n",
390
+ "<on_llm_end>\n",
391
+ "\n",
392
+ "\n",
393
+ "Sure! Penetration testing is a crucial component of PCI DSS compliance, which involves simulating cyber attacks against an organization's computer systems and networks to identify vulnerabilities and weaknesses. The goal of penetration testing is to help organizations strengthen their defenses against attackers who might exploit these vulnerabilities to gain unauthorized access to sensitive data.\n",
394
+ "\n",
395
+ "The PCI DSS requires organizations to conduct regular penetration testing to ensure that their systems and networks are secure and protected against potential threats. This includes testing the perimeter of the cardholder data environment (CDE), critical systems, and application layers to identify any vulnerabilities that could be exploited by attackers.\n",
396
+ "\n",
397
+ "There are several key aspects of penetration testing that organizations should be aware of when implementing PCI DSS compliance:\n",
398
+ "\n",
399
+ "1. Defining a penetration testing methodology: Organizations must define a comprehensive approach to penetration testing that includes industry- accepted techniques and best practices.\n",
400
+ "2. Coverage of the entire CDE perimeter and critical systems: Penetration testing should cover the entire perimeter of the CDE, including firewalls, routers, switches, and other network devices, as well as critical systems such as databases, servers, and applications.\n",
401
+ "3. Testing from both inside and outside the network: Penetration testing should involve testing from both inside and outside the network to simulate real-world attacks and identify vulnerabilities that may not be visible from within the network.\n",
402
+ "4. Validating segmentation and scope-reduction controls: Penetration testing should also validate the effectiveness of segmentation and scope-reduction controls to prevent unauthorized access to sensitive data.\n",
403
+ "5. Identifying vulnerabilities in application layers: Penetration testing should include testing of application layers to identify any vulnerabilities that could be exploited by attackers.\n",
404
+ "6. Correction of identified vulnerabilities: Once vulnerabilities are identified through penetration testing, they must be corrected promptly to minimize the risk of attack.\n",
405
+ "\n",
406
+ "By understanding the importance of penetration testing in PCI DSS compliance, organizations can take proactive steps to protect their systems and networks from cyber threats and maintain the trust of their customers and stakeholders.\n",
407
+ "\n",
408
+ "\n",
409
+ "\n",
410
+ "<on_llm_end>\n",
411
+ "\n",
412
+ "\n",
413
+ "Completed in 12.717s\n",
414
+ "Total time used: 22.604 s\n",
415
+ "Number of tokens generated: 803\n",
416
+ "Average generation speed: 35.524 tokens/s\n",
417
+ "CPU times: user 397 ms, sys: 149 ms, total: 546 ms\n",
418
+ "Wall time: 31.6 s\n"
419
+ ]
420
+ }
421
+ ],
422
+ "source": [
423
+ "%%time\n",
424
+ "\n",
425
+ "os.environ[\"HF_RP\"] = \"1.15\"\n",
426
+ "!python qa_chain_test.py"
427
+ ]
428
+ }
429
+ ],
430
+ "metadata": {
431
+ "kernelspec": {
432
+ "display_name": "Python 3 (ipykernel)",
433
+ "language": "python",
434
+ "name": "python3"
435
+ },
436
+ "language_info": {
437
+ "codemirror_mode": {
438
+ "name": "ipython",
439
+ "version": 3
440
+ },
441
+ "file_extension": ".py",
442
+ "mimetype": "text/x-python",
443
+ "name": "python",
444
+ "nbconvert_exporter": "python",
445
+ "pygments_lexer": "ipython3",
446
+ "version": "3.11.7"
447
+ }
448
+ },
449
+ "nbformat": 4,
450
+ "nbformat_minor": 5
451
+ }
notebook/nvidia-4090-openai.ipynb ADDED
@@ -0,0 +1,369 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "874cd58e",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "workding dir: /home/inflaton/code/chat-with-orca-2\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "import os\n",
19
+ "import sys\n",
20
+ "from pathlib import Path\n",
21
+ "\n",
22
+ "workding_dir = str(Path.cwd().parent)\n",
23
+ "os.chdir(workding_dir)\n",
24
+ "sys.path.append(workding_dir)\n",
25
+ "print(\"workding dir:\", workding_dir)"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": 2,
31
+ "id": "19f967ca",
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"openai\""
36
+ ]
37
+ },
38
+ {
39
+ "cell_type": "code",
40
+ "execution_count": 3,
41
+ "id": "a6d96660",
42
+ "metadata": {},
43
+ "outputs": [
44
+ {
45
+ "name": "stdout",
46
+ "output_type": "stream",
47
+ "text": [
48
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
49
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
50
+ "MPS is NOT available\n",
51
+ "CUDA is available\n",
52
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
53
+ "CUDA is available, we have found 1 GPU(s)\n",
54
+ "NVIDIA GeForce RTX 4090\n",
55
+ "CUDA version: 12.1\n",
56
+ "hf_embeddings_device_type: cuda:0\n",
57
+ "hf_pipeline_device_type: cuda:0\n",
58
+ "load INSTRUCTOR_Transformer\n",
59
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
60
+ " return self.fget.__get__(instance, owner)()\n",
61
+ "max_seq_length 512\n",
62
+ "Completed in 0.427s\n",
63
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
64
+ "Completed in 0.014s\n",
65
+ "initializing LLM: openai\n",
66
+ " hf_pipeline_device_type: cuda:0\n",
67
+ " load_quantized_model: None\n",
68
+ " torch_dtype: torch.bfloat16\n",
69
+ " n_threds: 4\n",
70
+ " using model: gpt-3.5-turbo\n",
71
+ "initialization complete\n",
72
+ "Completed in 0.024s\n",
73
+ "\n",
74
+ "Question: What's PCI DSS?\n",
75
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
76
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that outlines the technical and operational requirements for protecting payment card data. The standard provides guidelines and security controls to help organizations build and maintain a secure network, protect account data, maintain a vulnerability management program, and implement strong access control measures. Compliance with PCI DSS is required for any organization that handles payment card data.\n",
77
+ "<on_llm_end>\n",
78
+ "\n",
79
+ "\n",
80
+ "Completed in 4.178s\n",
81
+ "\n",
82
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
83
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that outlines the technical and operational requirements for protecting payment card data. The standard provides guidelines and security controls to help organizations build and maintain a secure network, protect account data, maintain a vulnerability management program, and implement strong access control measures. Compliance with PCI DSS is required for any organization that handles payment card data.')]}\n",
84
+ "What are the differences between PCI DSS version 3.2.1 and version 4.0?\n",
85
+ "<on_llm_end>\n",
86
+ "\n",
87
+ "\n",
88
+ "The document provided does not specify the specific differences between PCI DSS version 3.2.1 and version 4.0. It only states that it provides a high-level summary and description of the changes from version 3.2.1 to version 4.0. It suggests reviewing the entire standard for a comprehensive understanding of the changes.\n",
89
+ "<on_llm_end>\n",
90
+ "\n",
91
+ "\n",
92
+ "Completed in 2.636s\n",
93
+ "\n",
94
+ "Question: new requirements for vulnerability assessments\n",
95
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that outlines the technical and operational requirements for protecting payment card data. The standard provides guidelines and security controls to help organizations build and maintain a secure network, protect account data, maintain a vulnerability management program, and implement strong access control measures. Compliance with PCI DSS is required for any organization that handles payment card data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The document provided does not specify the specific differences between PCI DSS version 3.2.1 and version 4.0. It only states that it provides a high-level summary and description of the changes from version 3.2.1 to version 4.0. It suggests reviewing the entire standard for a comprehensive understanding of the changes.')]}\n",
96
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
97
+ "<on_llm_end>\n",
98
+ "\n",
99
+ "\n",
100
+ "In PCI DSS version 4.0, there are several new requirements for vulnerability assessments. Here are the new requirements:\n",
101
+ "\n",
102
+ "- Requirement 11.3.1.1: Manage all other applicable vulnerabilities (those not ranked as high-risk or critical).\n",
103
+ "- Requirement 11.3.1.2: Internal vulnerability scans are performed via authenticated scanning.\n",
104
+ "- Requirement A3.3.1: Failures of automated log review mechanisms and automated code review tools are detected, alerted, and reported in a timely manner.\n",
105
+ "\n",
106
+ "These new requirements are applicable to all entities and service providers and are effective immediately for all v4.0 assessments.\n",
107
+ "<on_llm_end>\n",
108
+ "\n",
109
+ "\n",
110
+ "Completed in 3.809s\n",
111
+ "\n",
112
+ "Question: more on penetration testing\n",
113
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that outlines the technical and operational requirements for protecting payment card data. The standard provides guidelines and security controls to help organizations build and maintain a secure network, protect account data, maintain a vulnerability management program, and implement strong access control measures. Compliance with PCI DSS is required for any organization that handles payment card data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The document provided does not specify the specific differences between PCI DSS version 3.2.1 and version 4.0. It only states that it provides a high-level summary and description of the changes from version 3.2.1 to version 4.0. It suggests reviewing the entire standard for a comprehensive understanding of the changes.'), ('new requirements for vulnerability assessments', 'In PCI DSS version 4.0, there are several new requirements for vulnerability assessments. Here are the new requirements:\\n\\n- Requirement 11.3.1.1: Manage all other applicable vulnerabilities (those not ranked as high-risk or critical).\\n- Requirement 11.3.1.2: Internal vulnerability scans are performed via authenticated scanning.\\n- Requirement A3.3.1: Failures of automated log review mechanisms and automated code review tools are detected, alerted, and reported in a timely manner.\\n\\nThese new requirements are applicable to all entities and service providers and are effective immediately for all v4.0 assessments.')]}\n",
114
+ "Can you provide more information about the changes related to penetration testing in PCI DSS version 4.0?\n",
115
+ "<on_llm_end>\n",
116
+ "\n",
117
+ "\n",
118
+ "I'm sorry, but I don't have access to the specific changes related to penetration testing in PCI DSS version 4.0. The information provided does not include details about the changes made to penetration testing requirements. It is recommended to review the PCI DSS version 4.0 document in its entirety to understand the changes related to penetration testing.\n",
119
+ "<on_llm_end>\n",
120
+ "\n",
121
+ "\n",
122
+ "Completed in 2.609s\n",
123
+ "Total time used: 13.232 s\n",
124
+ "Number of tokens generated: 425\n",
125
+ "Average generation speed: 32.119 tokens/s\n",
126
+ "CPU times: user 137 ms, sys: 76.1 ms, total: 213 ms\n",
127
+ "Wall time: 16.5 s\n"
128
+ ]
129
+ }
130
+ ],
131
+ "source": [
132
+ "%%time\n",
133
+ "\n",
134
+ "os.environ[\"HF_RP\"] = \"1.05\"\n",
135
+ "os.environ[\"OPENAI_MODEL_NAME\"] = \"gpt-3.5-turbo\"\n",
136
+ "!python qa_chain_test.py"
137
+ ]
138
+ },
139
+ {
140
+ "cell_type": "code",
141
+ "execution_count": 7,
142
+ "id": "8a022a7b",
143
+ "metadata": {},
144
+ "outputs": [
145
+ {
146
+ "name": "stdout",
147
+ "output_type": "stream",
148
+ "text": [
149
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
150
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
151
+ "MPS is NOT available\n",
152
+ "CUDA is available\n",
153
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
154
+ "CUDA is available, we have found 1 GPU(s)\n",
155
+ "NVIDIA GeForce RTX 4090\n",
156
+ "CUDA version: 12.1\n",
157
+ "hf_embeddings_device_type: cuda:0\n",
158
+ "hf_pipeline_device_type: cuda:0\n",
159
+ "load INSTRUCTOR_Transformer\n",
160
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
161
+ " return self.fget.__get__(instance, owner)()\n",
162
+ "max_seq_length 512\n",
163
+ "Completed in 0.429s\n",
164
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
165
+ "Completed in 0.013s\n",
166
+ "initializing LLM: openai\n",
167
+ " hf_pipeline_device_type: cuda:0\n",
168
+ " load_quantized_model: None\n",
169
+ " torch_dtype: torch.bfloat16\n",
170
+ " n_threds: 4\n",
171
+ " using model: gpt-3.5-turbo-instruct\n",
172
+ "initialization complete\n",
173
+ "Completed in 0.024s\n",
174
+ "\n",
175
+ "Question: What's PCI DSS?\n",
176
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
177
+ " The PCI Data Security Standard (PCI DSS) is a global standard that provides a baseline of technical and operational requirements designated to protect payment data. It is developed and managed by the PCI Security Standards Council (PCI SSC) and is constantly evolving to address new threats and vulnerabilities in the payment industry.\n",
178
+ "<on_llm_end>\n",
179
+ "\n",
180
+ "\n",
181
+ "Completed in 4.007s\n",
182
+ "\n",
183
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
184
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'The PCI Data Security Standard (PCI DSS) is a global standard that provides a baseline of technical and operational requirements designated to protect payment data. It is developed and managed by the PCI Security Standards Council (PCI SSC) and is constantly evolving to address new threats and vulnerabilities in the payment industry.')]}\n",
185
+ " What changes were made from PCI DSS version 3.2.1 to version 4.0?\n",
186
+ "<on_llm_end>\n",
187
+ "\n",
188
+ "\n",
189
+ " The changes made from PCI DSS version 3.2.1 to version 4.0 include updates to align with the changes from PCI DSS v3.2.1 to v4.0, as well as minor corrections and edits for clarification and/or format. These changes can be found in the Summary of Changes document and include changes to the introductory sections, general changes to requirements, and additional changes per requirement.\n",
190
+ "<on_llm_end>\n",
191
+ "\n",
192
+ "\n",
193
+ "Completed in 2.118s\n",
194
+ "\n",
195
+ "Question: new requirements for vulnerability assessments\n",
196
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'The PCI Data Security Standard (PCI DSS) is a global standard that provides a baseline of technical and operational requirements designated to protect payment data. It is developed and managed by the PCI Security Standards Council (PCI SSC) and is constantly evolving to address new threats and vulnerabilities in the payment industry.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The changes made from PCI DSS version 3.2.1 to version 4.0 include updates to align with the changes from PCI DSS v3.2.1 to v4.0, as well as minor corrections and edits for clarification and/or format. These changes can be found in the Summary of Changes document and include changes to the introductory sections, general changes to requirements, and additional changes per requirement.')]}\n",
197
+ " What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
198
+ "<on_llm_end>\n",
199
+ "\n",
200
+ "\n",
201
+ " The new requirements for vulnerability assessments in PCI DSS version 4.0 include performing internal vulnerability scans via authenticated scanning, managing all other applicable vulnerabilities, and maintaining an inventory of bespoke and custom software. These requirements are effective immediately for all v4.0 assessments. Additionally, there is a new requirement for targeted risk analysis to determine the frequency of log reviews for all other system components, which will be effective until 31 March 2025.\n",
202
+ "<on_llm_end>\n",
203
+ "\n",
204
+ "\n",
205
+ "Completed in 2.111s\n",
206
+ "\n",
207
+ "Question: more on penetration testing\n",
208
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'The PCI Data Security Standard (PCI DSS) is a global standard that provides a baseline of technical and operational requirements designated to protect payment data. It is developed and managed by the PCI Security Standards Council (PCI SSC) and is constantly evolving to address new threats and vulnerabilities in the payment industry.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The changes made from PCI DSS version 3.2.1 to version 4.0 include updates to align with the changes from PCI DSS v3.2.1 to v4.0, as well as minor corrections and edits for clarification and/or format. These changes can be found in the Summary of Changes document and include changes to the introductory sections, general changes to requirements, and additional changes per requirement.'), ('new requirements for vulnerability assessments', 'The new requirements for vulnerability assessments in PCI DSS version 4.0 include performing internal vulnerability scans via authenticated scanning, managing all other applicable vulnerabilities, and maintaining an inventory of bespoke and custom software. These requirements are effective immediately for all v4.0 assessments. Additionally, there is a new requirement for targeted risk analysis to determine the frequency of log reviews for all other system components, which will be effective until 31 March 2025.')]}\n",
209
+ " Can you provide more information about the new requirements for penetration testing in PCI DSS version 4.0?\n",
210
+ "<on_llm_end>\n",
211
+ "\n",
212
+ "\n",
213
+ " The new requirements for penetration testing in PCI DSS version 4.0 include defining and documenting a penetration testing methodology, using industry-accepted approaches, testing the entire CDE perimeter and critical systems, testing from both inside and outside the network, and conducting application-layer and network-layer penetration tests. Additionally, there are new requirements for maintaining an inventory of trusted keys and certificates, and confirming the validity of certificates used for PAN transmissions over open, public networks. These requirements are effective immediately for all v4.0 assessments and are considered evolving requirements until March 31, 2025.\n",
214
+ "<on_llm_end>\n",
215
+ "\n",
216
+ "\n",
217
+ "Completed in 2.124s\n",
218
+ "Total time used: 10.360 s\n",
219
+ "Number of tokens generated: 411\n",
220
+ "Average generation speed: 39.673 tokens/s\n",
221
+ "CPU times: user 120 ms, sys: 58.6 ms, total: 178 ms\n",
222
+ "Wall time: 13.6 s\n"
223
+ ]
224
+ }
225
+ ],
226
+ "source": [
227
+ "%%time\n",
228
+ "\n",
229
+ "os.environ[\"HF_RP\"] = \"1.10\"\n",
230
+ "os.environ[\"OPENAI_MODEL_NAME\"] = \"gpt-3.5-turbo-instruct\"\n",
231
+ "!python qa_chain_test.py"
232
+ ]
233
+ },
234
+ {
235
+ "cell_type": "code",
236
+ "execution_count": 6,
237
+ "id": "db48dcc4",
238
+ "metadata": {},
239
+ "outputs": [
240
+ {
241
+ "name": "stdout",
242
+ "output_type": "stream",
243
+ "text": [
244
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
245
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
246
+ "MPS is NOT available\n",
247
+ "CUDA is available\n",
248
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
249
+ "CUDA is available, we have found 1 GPU(s)\n",
250
+ "NVIDIA GeForce RTX 4090\n",
251
+ "CUDA version: 12.1\n",
252
+ "hf_embeddings_device_type: cuda:0\n",
253
+ "hf_pipeline_device_type: cuda:0\n",
254
+ "load INSTRUCTOR_Transformer\n",
255
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
256
+ " return self.fget.__get__(instance, owner)()\n",
257
+ "max_seq_length 512\n",
258
+ "Completed in 0.391s\n",
259
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
260
+ "Completed in 0.013s\n",
261
+ "initializing LLM: openai\n",
262
+ " hf_pipeline_device_type: cuda:0\n",
263
+ " load_quantized_model: None\n",
264
+ " torch_dtype: torch.bfloat16\n",
265
+ " n_threds: 4\n",
266
+ " using model: gpt-4\n",
267
+ "initialization complete\n",
268
+ "Completed in 0.026s\n",
269
+ "\n",
270
+ "Question: What's PCI DSS?\n",
271
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
272
+ "The PCI Data Security Standard (PCI DSS) is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It includes requirements for building and maintaining a secure network, protecting account data, maintaining a vulnerability management program, and implementing strong access control measures. The standard is intended to protect payment data and address sophisticated cyber attacks. It is managed by the PCI Security Standards Council.\n",
273
+ "<on_llm_end>\n",
274
+ "\n",
275
+ "\n",
276
+ "Completed in 7.688s\n",
277
+ "\n",
278
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
279
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'The PCI Data Security Standard (PCI DSS) is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It includes requirements for building and maintaining a secure network, protecting account data, maintaining a vulnerability management program, and implementing strong access control measures. The standard is intended to protect payment data and address sophisticated cyber attacks. It is managed by the PCI Security Standards Council.')]}\n",
280
+ "Can you provide a summary of the changes that were made from version 3.2.1 to version 4.0 of the PCI Data Security Standard (PCI DSS)?\n",
281
+ "<on_llm_end>\n",
282
+ "\n",
283
+ "\n",
284
+ "I'm sorry, but the provided context does not include specific details about the changes made from version 3.2.1 to version 4.0 of the PCI Data Security Standard (PCI DSS). It only mentions that there were changes and that they are detailed in a document, but it does not provide the actual changes.\n",
285
+ "<on_llm_end>\n",
286
+ "\n",
287
+ "\n",
288
+ "Completed in 6.529s\n",
289
+ "\n",
290
+ "Question: new requirements for vulnerability assessments\n",
291
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'The PCI Data Security Standard (PCI DSS) is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It includes requirements for building and maintaining a secure network, protecting account data, maintaining a vulnerability management program, and implementing strong access control measures. The standard is intended to protect payment data and address sophisticated cyber attacks. It is managed by the PCI Security Standards Council.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', \"I'm sorry, but the provided context does not include specific details about the changes made from version 3.2.1 to version 4.0 of the PCI Data Security Standard (PCI DSS). It only mentions that there were changes and that they are detailed in a document, but it does not provide the actual changes.\")]}\n",
292
+ "What are the new requirements for vulnerability assessments in the PCI DSS?\n",
293
+ "<on_llm_end>\n",
294
+ "\n",
295
+ "\n",
296
+ "The new requirements for vulnerability assessments in the PCI DSS v4.0 as compared to v3.2.1 are:\n",
297
+ "\n",
298
+ "1. Requirement 10.4.2.1: A targeted risk analysis is performed to determine the frequency of log reviews for all other system components.\n",
299
+ "\n",
300
+ "2. Requirement 11.3.1.1: Manage all other applicable vulnerabilities (those not ranked as high-risk or critical).\n",
301
+ "\n",
302
+ "3. Requirement 11.3.1.2: Internal vulnerability scans are performed via authenticated scanning.\n",
303
+ "\n",
304
+ "4. Requirement A1.2.3: The multi-tenant service provider implements processes or mechanisms for reporting and addressing suspected or confirmed security incidents and vulnerabilities.\n",
305
+ "\n",
306
+ "5. Requirement A3.3.1: Failures of the following are detected, alerted, and reported in a timely manner: Automated log review mechanisms and Automated code review tools.\n",
307
+ "<on_llm_end>\n",
308
+ "\n",
309
+ "\n",
310
+ "Completed in 11.546s\n",
311
+ "\n",
312
+ "Question: more on penetration testing\n",
313
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'The PCI Data Security Standard (PCI DSS) is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It includes requirements for building and maintaining a secure network, protecting account data, maintaining a vulnerability management program, and implementing strong access control measures. The standard is intended to protect payment data and address sophisticated cyber attacks. It is managed by the PCI Security Standards Council.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', \"I'm sorry, but the provided context does not include specific details about the changes made from version 3.2.1 to version 4.0 of the PCI Data Security Standard (PCI DSS). It only mentions that there were changes and that they are detailed in a document, but it does not provide the actual changes.\"), ('new requirements for vulnerability assessments', 'The new requirements for vulnerability assessments in the PCI DSS v4.0 as compared to v3.2.1 are:\\n\\n1. Requirement 10.4.2.1: A targeted risk analysis is performed to determine the frequency of log reviews for all other system components.\\n\\n2. Requirement 11.3.1.1: Manage all other applicable vulnerabilities (those not ranked as high-risk or critical).\\n\\n3. Requirement 11.3.1.2: Internal vulnerability scans are performed via authenticated scanning.\\n\\n4. Requirement A1.2.3: The multi-tenant service provider implements processes or mechanisms for reporting and addressing suspected or confirmed security incidents and vulnerabilities.\\n\\n5. Requirement A3.3.1: Failures of the following are detected, alerted, and reported in a timely manner: Automated log review mechanisms and Automated code review tools.')]}\n",
314
+ "Can you provide more information on penetration testing in the context of PCI DSS?\n",
315
+ "<on_llm_end>\n",
316
+ "\n",
317
+ "\n",
318
+ "Penetration testing in the context of PCI DSS (Payment Card Industry Data Security Standard) is a requirement for entities that handle cardholder data. According to the PCI DSS v4.0 ROC Template, Requirement 11.4 states that external and internal penetration testing must be regularly performed, and any exploitable vulnerabilities and security weaknesses identified must be corrected.\n",
319
+ "\n",
320
+ "The penetration testing methodology should be defined, documented, and implemented by the entity. It should include industry-accepted penetration testing approaches and cover the entire Cardholder Data Environment (CDE) perimeter and critical systems. The testing should be conducted from both inside and outside the network.\n",
321
+ "\n",
322
+ "The testing should also validate any segmentation and scope-reduction controls. It should include application-layer penetration testing to identify, at a minimum, the vulnerabilities listed in Requirement 6.2.4. Network-layer penetration tests should encompass all components that support network functions as well as operating systems.\n",
323
+ "\n",
324
+ "If exploitable vulnerabilities and security weaknesses are found during penetration testing, they should be corrected in accordance with the entity's assessment of the risk posed by the security issue as defined in Requirement 6.3.1. The penetration testing should then be repeated to verify the corrections.\n",
325
+ "\n",
326
+ "The external penetration test should be performed by a qualified internal resource or a qualified external third-party, ensuring that organizational independence of the tester exists.\n",
327
+ "<on_llm_end>\n",
328
+ "\n",
329
+ "\n",
330
+ "Completed in 16.494s\n",
331
+ "Total time used: 42.257 s\n",
332
+ "Number of tokens generated: 670\n",
333
+ "Average generation speed: 15.855 tokens/s\n",
334
+ "CPU times: user 356 ms, sys: 177 ms, total: 533 ms\n",
335
+ "Wall time: 45.5 s\n"
336
+ ]
337
+ }
338
+ ],
339
+ "source": [
340
+ "%%time\n",
341
+ "\n",
342
+ "os.environ[\"HF_RP\"] = \"1.15\"\n",
343
+ "os.environ[\"OPENAI_MODEL_NAME\"] = \"gpt-4\"\n",
344
+ "!python qa_chain_test.py"
345
+ ]
346
+ }
347
+ ],
348
+ "metadata": {
349
+ "kernelspec": {
350
+ "display_name": "Python 3 (ipykernel)",
351
+ "language": "python",
352
+ "name": "python3"
353
+ },
354
+ "language_info": {
355
+ "codemirror_mode": {
356
+ "name": "ipython",
357
+ "version": 3
358
+ },
359
+ "file_extension": ".py",
360
+ "mimetype": "text/x-python",
361
+ "name": "python",
362
+ "nbconvert_exporter": "python",
363
+ "pygments_lexer": "ipython3",
364
+ "version": "3.11.7"
365
+ }
366
+ },
367
+ "nbformat": 4,
368
+ "nbformat_minor": 5
369
+ }
notebook/nvidia-4090-orca-2-13b.ipynb ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "874cd58e",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "workding dir: /home/inflaton/code/chat-with-orca-2\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "import os\n",
19
+ "import sys\n",
20
+ "from pathlib import Path\n",
21
+ "\n",
22
+ "workding_dir = str(Path.cwd().parent)\n",
23
+ "os.chdir(workding_dir)\n",
24
+ "sys.path.append(workding_dir)\n",
25
+ "print(\"workding dir:\", workding_dir)"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": 2,
31
+ "id": "19f967ca",
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"huggingface\"\n",
36
+ "os.environ[\"HUGGINGFACE_MODEL_NAME_OR_PATH\"] = \"microsoft/Orca-2-13b\""
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": 3,
42
+ "id": "a6d96660",
43
+ "metadata": {},
44
+ "outputs": [
45
+ {
46
+ "name": "stdout",
47
+ "output_type": "stream",
48
+ "text": [
49
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
50
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
51
+ "MPS is NOT available\n",
52
+ "CUDA is available\n",
53
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
54
+ "CUDA is available, we have found 1 GPU(s)\n",
55
+ "NVIDIA GeForce RTX 4090\n",
56
+ "CUDA version: 12.1\n",
57
+ "hf_embeddings_device_type: cuda:0\n",
58
+ "hf_pipeline_device_type: cuda:0\n",
59
+ "load INSTRUCTOR_Transformer\n",
60
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
61
+ " return self.fget.__get__(instance, owner)()\n",
62
+ "max_seq_length 512\n",
63
+ "Completed in 0.427s\n",
64
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
65
+ "Completed in 0.013s\n",
66
+ "initializing LLM: huggingface\n",
67
+ " hf_pipeline_device_type: cuda:0\n",
68
+ " load_quantized_model: None\n",
69
+ " torch_dtype: torch.bfloat16\n",
70
+ " n_threds: 4\n",
71
+ " loading model: microsoft/Orca-2-13b\n",
72
+ " HF auth token: None\n",
73
+ " repetition_penalty: 1.05\n",
74
+ "Loading checkpoint shards: 100%|██████████████████| 6/6 [00:16<00:00, 2.72s/it]\n",
75
+ "initialization complete\n",
76
+ "Completed in 33.618s\n",
77
+ "\n",
78
+ "Question: What's PCI DSS?\n",
79
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
80
+ "PCI DSS is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It helps ensure the security of cardholder data and reduces the risk of cyberattacks.\n",
81
+ "\n",
82
+ "\n",
83
+ "\n",
84
+ "<on_llm_end>\n",
85
+ "\n",
86
+ "\n",
87
+ "Completed in 49.719s\n",
88
+ "\n",
89
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
90
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It helps ensure the security of cardholder data and reduces the risk of cyberattacks.')]}\n",
91
+ "¿Puedes resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS?\n",
92
+ "\n",
93
+ "\n",
94
+ "\n",
95
+ "<on_llm_end>\n",
96
+ "\n",
97
+ "\n",
98
+ "Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones de PCI DSS 3.2 a PCI DSS 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Luego, en la versión 4.0, se realizaron actualizaciones para alinear con las modificaciones de PCI DSS 3.2.1 a PCI DSS 4.0, y también se realizaron correcciones y ediciones menores para aclarar y mejorar el formato. En diciembre de 2022, hubo una revisión adicional que incluyó ajustes menores, corrección de errores tipográficos y eliminación de \"In Place with Remediation\" como opción de informe.\n",
99
+ "\n",
100
+ "\n",
101
+ "\n",
102
+ "<on_llm_end>\n",
103
+ "\n",
104
+ "\n",
105
+ "Completed in 144.641s\n",
106
+ "\n",
107
+ "Question: new requirements for vulnerability assessments\n",
108
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It helps ensure the security of cardholder data and reduces the risk of cyberattacks.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones de PCI DSS 3.2 a PCI DSS 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Luego, en la versión 4.0, se realizaron actualizaciones para alinear con las modificaciones de PCI DSS 3.2.1 a PCI DSS 4.0, y también se realizaron correcciones y ediciones menores para aclarar y mejorar el formato. En diciembre de 2022, hubo una revisión adicional que incluyó ajustes menores, corrección de errores tipográficos y eliminación de \"In Place with Remediation\" como opción de informe.')]}\n",
109
+ "¿Cuáles son las nuevas requisitos para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS?\n",
110
+ "\n",
111
+ "\n",
112
+ "\n",
113
+ "<on_llm_end>\n",
114
+ "\n",
115
+ "\n",
116
+ "Las nuevas requisitos para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS incluyen resolver vulnerabilidades con una puntuación de 4.0 o más en el CVSS, realizar rescans cuando sea necesario, y tener un método de penetration testing definido, documentado e implementado que incluye enfoques aceptados por la industria y cobertura para el perímetro del SDE y los sistemas críticos.\n",
117
+ "\n",
118
+ "\n",
119
+ "\n",
120
+ "<on_llm_end>\n",
121
+ "\n",
122
+ "\n",
123
+ "Completed in 87.622s\n",
124
+ "\n",
125
+ "Question: more on penetration testing\n",
126
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a global standard that provides a baseline of technical and operational requirements designed to protect payment account data. It helps ensure the security of cardholder data and reduces the risk of cyberattacks.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones de PCI DSS 3.2 a PCI DSS 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Luego, en la versión 4.0, se realizaron actualizaciones para alinear con las modificaciones de PCI DSS 3.2.1 a PCI DSS 4.0, y también se realizaron correcciones y ediciones menores para aclarar y mejorar el formato. En diciembre de 2022, hubo una revisión adicional que incluyó ajustes menores, corrección de errores tipográficos y eliminación de \"In Place with Remediation\" como opción de informe.'), ('new requirements for vulnerability assessments', 'Las nuevas requisitos para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS incluyen resolver vulnerabilidades con una puntuación de 4.0 o más en el CVSS, realizar rescans cuando sea necesario, y tener un método de penetration testing definido, documentado e implementado que incluye enfoques aceptados por la industria y cobertura para el perímetro del SDE y los sistemas críticos.')]}\n",
127
+ "¿Puedes dar más detalles sobre las prácticas de prueba de penetración en PCI DSS?\n",
128
+ "\n",
129
+ "\n",
130
+ "\n",
131
+ "<on_llm_end>\n",
132
+ "\n",
133
+ "\n",
134
+ "Sí, puedo dar más detalles sobre las prácticas de prueba de penetración en PCI DSS. La PCI DSS requiere que se realice un penetration testing externo al menos una vez cada 12 meses y después de cualquier modificación o cambio significativo en la infraestructura o el software. El penetration testing debe ser realizado por un recurso interno calificado o un tercero de fuera de la organización calificado y debe cumplir con la metodología definida por la entidad. Además, las vulnerabilidades y debilidades de seguridad que se encuentren durante el penetration testing deben ser corregidas y verificadas mediante la repetición del testing.\n",
135
+ "\n",
136
+ "\n",
137
+ "\n",
138
+ "<on_llm_end>\n",
139
+ "\n",
140
+ "\n",
141
+ "Completed in 115.566s\n",
142
+ "Total time used: 397.548 s\n",
143
+ "Number of tokens generated: 641\n",
144
+ "Average generation speed: 1.612 tokens/s\n",
145
+ "CPU times: user 3.51 s, sys: 1.02 s, total: 4.53 s\n",
146
+ "Wall time: 7min 16s\n"
147
+ ]
148
+ }
149
+ ],
150
+ "source": [
151
+ "%%time\n",
152
+ "\n",
153
+ "os.environ[\"HF_RP\"] = \"1.05\"\n",
154
+ "!python qa_chain_test.py"
155
+ ]
156
+ },
157
+ {
158
+ "cell_type": "code",
159
+ "execution_count": 4,
160
+ "id": "8a022a7b",
161
+ "metadata": {},
162
+ "outputs": [
163
+ {
164
+ "name": "stdout",
165
+ "output_type": "stream",
166
+ "text": [
167
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
168
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
169
+ "MPS is NOT available\n",
170
+ "CUDA is available\n",
171
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
172
+ "CUDA is available, we have found 1 GPU(s)\n",
173
+ "NVIDIA GeForce RTX 4090\n",
174
+ "CUDA version: 12.1\n",
175
+ "hf_embeddings_device_type: cuda:0\n",
176
+ "hf_pipeline_device_type: cuda:0\n",
177
+ "load INSTRUCTOR_Transformer\n",
178
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
179
+ " return self.fget.__get__(instance, owner)()\n",
180
+ "max_seq_length 512\n",
181
+ "Completed in 1.001s\n",
182
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
183
+ "Completed in 0.021s\n",
184
+ "initializing LLM: huggingface\n",
185
+ " hf_pipeline_device_type: cuda:0\n",
186
+ " load_quantized_model: None\n",
187
+ " torch_dtype: torch.bfloat16\n",
188
+ " n_threds: 4\n",
189
+ " loading model: microsoft/Orca-2-13b\n",
190
+ " HF auth token: None\n",
191
+ " repetition_penalty: 1.1\n",
192
+ "Loading checkpoint shards: 100%|██████████████████| 6/6 [00:16<00:00, 2.75s/it]\n",
193
+ "initialization complete\n",
194
+ "Completed in 63.590s\n",
195
+ "\n",
196
+ "Question: What's PCI DSS?\n",
197
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
198
+ "PCI DSS is a set of requirements designed to protect payment account data. It provides a baseline of technical and operational requirements for organizations that handle payment card transactions.\n",
199
+ "\n",
200
+ "\n",
201
+ "\n",
202
+ "<on_llm_end>\n",
203
+ "\n",
204
+ "\n",
205
+ "Completed in 33.852s\n",
206
+ "\n",
207
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
208
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It provides a baseline of technical and operational requirements for organizations that handle payment card transactions.')]}\n",
209
+ "¿Puedes resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS?\n",
210
+ "\n",
211
+ "\n",
212
+ "\n",
213
+ "<on_llm_end>\n",
214
+ "\n",
215
+ "\n",
216
+ "Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones menores y ediciones para aclarar y mejorar el formato. Además, hay actualizaciones para adaptarse a las nuevas exigencias y mejoras en la seguridad.\n",
217
+ "\n",
218
+ "\n",
219
+ "\n",
220
+ "<on_llm_end>\n",
221
+ "\n",
222
+ "\n",
223
+ "Completed in 78.279s\n",
224
+ "\n",
225
+ "Question: new requirements for vulnerability assessments\n",
226
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It provides a baseline of technical and operational requirements for organizations that handle payment card transactions.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones menores y ediciones para aclarar y mejorar el formato. Además, hay actualizaciones para adaptarse a las nuevas exigencias y mejoras en la seguridad.')]}\n",
227
+ "¿Cuáles son las nuevas exigencias para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS?\n",
228
+ "\n",
229
+ "\n",
230
+ "\n",
231
+ "<on_llm_end>\n",
232
+ "\n",
233
+ "\n",
234
+ "Las nuevas exigencias para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS incluyen realizar escaneos de vulnerabilidad externa después de cualquier cambio significativo y resolver las vulnerabilidades que sean de nivel 4.0 o superior según el CVSS. También es necesario realizar pruebas de penetración externa e interna regularmente y corregir las vulnerabilidades y debilidades de seguridad que se encuentren. Además, se deben instalar parches de seguridad y actualizaciones de sistemas en un plazo no mayor a un mes para las críticas o altas y en un plazo no mayor a tres meses para el resto.\n",
235
+ "\n",
236
+ "\n",
237
+ "\n",
238
+ "<on_llm_end>\n",
239
+ "\n",
240
+ "\n",
241
+ "Completed in 102.950s\n",
242
+ "\n",
243
+ "Question: more on penetration testing\n",
244
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It provides a baseline of technical and operational requirements for organizations that handle payment card transactions.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como correcciones menores y ediciones para aclarar y mejorar el formato. Además, hay actualizaciones para adaptarse a las nuevas exigencias y mejoras en la seguridad.'), ('new requirements for vulnerability assessments', 'Las nuevas exigencias para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS incluyen realizar escaneos de vulnerabilidad externa después de cualquier cambio significativo y resolver las vulnerabilidades que sean de nivel 4.0 o superior según el CVSS. También es necesario realizar pruebas de penetración externa e interna regularmente y corregir las vulnerabilidades y debilidades de seguridad que se encuentren. Además, se deben instalar parches de seguridad y actualizaciones de sistemas en un plazo no mayor a un mes para las críticas o altas y en un plazo no mayor a tres meses para el resto.')]}\n",
245
+ "¿Puedo obtener más información sobre las pruebas de penetración en PCI DSS?\n",
246
+ "\n",
247
+ "\n",
248
+ "\n",
249
+ "<on_llm_end>\n",
250
+ "\n",
251
+ "\n",
252
+ "Yes, you can get more information about penetration tests in PCI DSS from the provided context. Look for the sections related to 11.4.3 External Penetration Testing and 11.4.4 Exploitable Vulnerabilities and Security Weaknesses Found During Penetration Testing.\n",
253
+ "\n",
254
+ "\n",
255
+ "\n",
256
+ "<on_llm_end>\n",
257
+ "\n",
258
+ "\n",
259
+ "Completed in 57.811s\n",
260
+ "Total time used: 272.891 s\n",
261
+ "Number of tokens generated: 478\n",
262
+ "Average generation speed: 1.752 tokens/s\n",
263
+ "CPU times: user 2.79 s, sys: 824 ms, total: 3.61 s\n",
264
+ "Wall time: 5min 42s\n"
265
+ ]
266
+ }
267
+ ],
268
+ "source": [
269
+ "%%time\n",
270
+ "\n",
271
+ "os.environ[\"HF_RP\"] = \"1.10\"\n",
272
+ "!python qa_chain_test.py"
273
+ ]
274
+ },
275
+ {
276
+ "cell_type": "code",
277
+ "execution_count": 5,
278
+ "id": "db48dcc4",
279
+ "metadata": {},
280
+ "outputs": [
281
+ {
282
+ "name": "stdout",
283
+ "output_type": "stream",
284
+ "text": [
285
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
286
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
287
+ "MPS is NOT available\n",
288
+ "CUDA is available\n",
289
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
290
+ "CUDA is available, we have found 1 GPU(s)\n",
291
+ "NVIDIA GeForce RTX 4090\n",
292
+ "CUDA version: 12.1\n",
293
+ "hf_embeddings_device_type: cuda:0\n",
294
+ "hf_pipeline_device_type: cuda:0\n",
295
+ "load INSTRUCTOR_Transformer\n",
296
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
297
+ " return self.fget.__get__(instance, owner)()\n",
298
+ "max_seq_length 512\n",
299
+ "Completed in 1.066s\n",
300
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
301
+ "Completed in 0.024s\n",
302
+ "initializing LLM: huggingface\n",
303
+ " hf_pipeline_device_type: cuda:0\n",
304
+ " load_quantized_model: None\n",
305
+ " torch_dtype: torch.bfloat16\n",
306
+ " n_threds: 4\n",
307
+ " loading model: microsoft/Orca-2-13b\n",
308
+ " HF auth token: None\n",
309
+ " repetition_penalty: 1.15\n",
310
+ "Loading checkpoint shards: 100%|██████████████████| 6/6 [00:19<00:00, 3.26s/it]\n",
311
+ "initialization complete\n",
312
+ "Completed in 28.543s\n",
313
+ "\n",
314
+ "Question: What's PCI DSS?\n",
315
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
316
+ "PCI DSS is a set of requirements designed to protect payment account data. It includes guidelines for building and maintaining secure networks and systems, protecting account data, managing vulnerabilities, implementing strong access control measures, and more.\n",
317
+ "\n",
318
+ "\n",
319
+ "\n",
320
+ "<on_llm_end>\n",
321
+ "\n",
322
+ "\n",
323
+ "Completed in 40.285s\n",
324
+ "\n",
325
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
326
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It includes guidelines for building and maintaining secure networks and systems, protecting account data, managing vulnerabilities, implementing strong access control measures, and more.')]}\n",
327
+ "¿Puedes resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS?\n",
328
+ "\n",
329
+ "\n",
330
+ "\n",
331
+ "<on_llm_end>\n",
332
+ "\n",
333
+ "\n",
334
+ "Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como actualizaciones para alinearse con las versiones 3.2.1 y 4.0. También hay correcciones menores y ediciones para mejorar la claridad y el formato del documento. Algunos ejemplos específicos de cambios incluyen la eliminación de \"In Place with Remediation\" como una opción de informe y ajustes en las requisitos 3.6.3 y 6.3.3.\n",
335
+ "\n",
336
+ "\n",
337
+ "\n",
338
+ "<on_llm_end>\n",
339
+ "\n",
340
+ "\n",
341
+ "Completed in 106.276s\n",
342
+ "\n",
343
+ "Question: new requirements for vulnerability assessments\n",
344
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It includes guidelines for building and maintaining secure networks and systems, protecting account data, managing vulnerabilities, implementing strong access control measures, and more.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como actualizaciones para alinearse con las versiones 3.2.1 y 4.0. También hay correcciones menores y ediciones para mejorar la claridad y el formato del documento. Algunos ejemplos específicos de cambios incluyen la eliminación de \"In Place with Remediation\" como una opción de informe y ajustes en las requisitos 3.6.3 y 6.3.3.')]}\n",
345
+ "¿Cuáles son las nuevas recomendaciones para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS?\n",
346
+ "\n",
347
+ "\n",
348
+ "\n",
349
+ "<on_llm_end>\n",
350
+ "\n",
351
+ "\n",
352
+ "Las nuevas recomendaciones para las evaluaciones de vulnerabilidades en la versión 4.\n",
353
+ "\n",
354
+ "\n",
355
+ "\n",
356
+ "<on_llm_end>\n",
357
+ "\n",
358
+ "\n",
359
+ "Completed in 38.122s\n",
360
+ "\n",
361
+ "Question: more on penetration testing\n",
362
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS is a set of requirements designed to protect payment account data. It includes guidelines for building and maintaining secure networks and systems, protecting account data, managing vulnerabilities, implementing strong access control measures, and more.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones entre las versiones 3.2 y 3.2.1, así como actualizaciones para alinearse con las versiones 3.2.1 y 4.0. También hay correcciones menores y ediciones para mejorar la claridad y el formato del documento. Algunos ejemplos específicos de cambios incluyen la eliminación de \"In Place with Remediation\" como una opción de informe y ajustes en las requisitos 3.6.3 y 6.3.3.'), ('new requirements for vulnerability assessments', 'Las nuevas recomendaciones para las evaluaciones de vulnerabilidades en la versión 4.')]}\n",
363
+ "¿Puedes dar más información sobre las pruebas de penetración en PCI DSS?\n",
364
+ "\n",
365
+ "\n",
366
+ "\n",
367
+ "<on_llm_end>\n",
368
+ "\n",
369
+ "\n",
370
+ "Sí, puedo dar más información sobre las pruebas de penetración en PCI DSS. La PCI DSS requiere que se realice un penetration testing externo al menos una vez cada doce meses y después de cualquier modificación o cambio significativo en la infraestructura o el software. El penetration testing debe ser realizado por un recurso interno calificado o un tercero de fuera de la empresa que tenga independencia orgánica. Las vulnerabilidades y debilidades de seguridad que se encuentren durante el penetration testing deben ser corregidas según los procedimientos establecidos en la Requisito 6.3.1 y se debe repetir el penetration testing para verificar las correcciones.\n",
371
+ "\n",
372
+ "\n",
373
+ "\n",
374
+ "<on_llm_end>\n",
375
+ "\n",
376
+ "\n",
377
+ "Completed in 106.927s\n",
378
+ "Total time used: 291.610 s\n",
379
+ "Number of tokens generated: 514\n",
380
+ "Average generation speed: 1.763 tokens/s\n",
381
+ "CPU times: user 2.33 s, sys: 1.12 s, total: 3.45 s\n",
382
+ "Wall time: 5min 26s\n"
383
+ ]
384
+ }
385
+ ],
386
+ "source": [
387
+ "%%time\n",
388
+ "\n",
389
+ "os.environ[\"HF_RP\"] = \"1.15\"\n",
390
+ "!python qa_chain_test.py"
391
+ ]
392
+ }
393
+ ],
394
+ "metadata": {
395
+ "kernelspec": {
396
+ "display_name": "Python 3 (ipykernel)",
397
+ "language": "python",
398
+ "name": "python3"
399
+ },
400
+ "language_info": {
401
+ "codemirror_mode": {
402
+ "name": "ipython",
403
+ "version": 3
404
+ },
405
+ "file_extension": ".py",
406
+ "mimetype": "text/x-python",
407
+ "name": "python",
408
+ "nbconvert_exporter": "python",
409
+ "pygments_lexer": "ipython3",
410
+ "version": "3.11.7"
411
+ }
412
+ },
413
+ "nbformat": 4,
414
+ "nbformat_minor": 5
415
+ }
notebook/nvidia-4090-orca-2-7b.ipynb ADDED
@@ -0,0 +1,439 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "874cd58e",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "workding dir: /home/inflaton/code/chat-with-orca-2\n"
14
+ ]
15
+ }
16
+ ],
17
+ "source": [
18
+ "import os\n",
19
+ "import sys\n",
20
+ "from pathlib import Path\n",
21
+ "\n",
22
+ "workding_dir = str(Path.cwd().parent)\n",
23
+ "os.chdir(workding_dir)\n",
24
+ "sys.path.append(workding_dir)\n",
25
+ "print(\"workding dir:\", workding_dir)"
26
+ ]
27
+ },
28
+ {
29
+ "cell_type": "code",
30
+ "execution_count": 2,
31
+ "id": "19f967ca",
32
+ "metadata": {},
33
+ "outputs": [],
34
+ "source": [
35
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"huggingface\"\n",
36
+ "os.environ[\"HUGGINGFACE_MODEL_NAME_OR_PATH\"] = \"microsoft/Orca-2-7b\""
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "code",
41
+ "execution_count": 3,
42
+ "id": "a6d96660",
43
+ "metadata": {},
44
+ "outputs": [
45
+ {
46
+ "name": "stdout",
47
+ "output_type": "stream",
48
+ "text": [
49
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
50
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
51
+ "MPS is NOT available\n",
52
+ "CUDA is available\n",
53
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
54
+ "CUDA is available, we have found 1 GPU(s)\n",
55
+ "NVIDIA GeForce RTX 4090\n",
56
+ "CUDA version: 12.1\n",
57
+ "hf_embeddings_device_type: cuda:0\n",
58
+ "hf_pipeline_device_type: cuda:0\n",
59
+ "load INSTRUCTOR_Transformer\n",
60
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
61
+ " return self.fget.__get__(instance, owner)()\n",
62
+ "max_seq_length 512\n",
63
+ "Completed in 0.428s\n",
64
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
65
+ "Completed in 0.013s\n",
66
+ "initializing LLM: huggingface\n",
67
+ " hf_pipeline_device_type: cuda:0\n",
68
+ " load_quantized_model: None\n",
69
+ " torch_dtype: torch.bfloat16\n",
70
+ " n_threds: 4\n",
71
+ " loading model: microsoft/Orca-2-7b\n",
72
+ " HF auth token: None\n",
73
+ " repetition_penalty: 1.05\n",
74
+ "Loading checkpoint shards: 100%|██████████████████| 3/3 [00:08<00:00, 2.71s/it]\n",
75
+ "initialization complete\n",
76
+ "Completed in 12.199s\n",
77
+ "\n",
78
+ "Question: What's PCI DSS?\n",
79
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
80
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.\n",
81
+ "\n",
82
+ "\n",
83
+ "\n",
84
+ "<on_llm_end>\n",
85
+ "\n",
86
+ "\n",
87
+ "Completed in 33.511s\n",
88
+ "\n",
89
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
90
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.')]}\n",
91
+ "What are the main differences between PCI DSS version 3.2.1 and version 4.0?\n",
92
+ "\n",
93
+ "\n",
94
+ "\n",
95
+ "<on_llm_end>\n",
96
+ "\n",
97
+ "\n",
98
+ "The main differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard has been updated to address new risks and vulnerabilities, as well as to reflect advances in technology and payment card industry practices. Some specific changes include updates to Requirement 6.3.3, the addition of a description for the change made to Requirement 8.3.9, and the addition of a description of the change made to Requirement 3.6.1.1. Additionally, the standard has been revised to align with the changes from PCI DSS v3.2 to PCI DSS v3.2.1 and to incorporate minor corrections and edits made for clarification and/or format purposes.\n",
99
+ "\n",
100
+ "\n",
101
+ "\n",
102
+ "<on_llm_end>\n",
103
+ "\n",
104
+ "\n",
105
+ "Completed in 4.836s\n",
106
+ "\n",
107
+ "Question: new requirements for vulnerability assessments\n",
108
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard has been updated to address new risks and vulnerabilities, as well as to reflect advances in technology and payment card industry practices. Some specific changes include updates to Requirement 6.3.3, the addition of a description for the change made to Requirement 8.3.9, and the addition of a description of the change made to Requirement 3.6.1.1. Additionally, the standard has been revised to align with the changes from PCI DSS v3.2 to PCI DSS v3.2.1 and to incorporate minor corrections and edits made for clarification and/or format purposes.')]}\n",
109
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
110
+ "\n",
111
+ "\n",
112
+ "\n",
113
+ "<on_llm_end>\n",
114
+ "\n",
115
+ "\n",
116
+ "The new requirements for vulnerability assessments in PCI DSS version 4.0 include:\n",
117
+ "\n",
118
+ "- Requirement 4.1.2, which states that there is a new requirement for roles and responsibilities related to vulnerability assessments.\n",
119
+ "- Requirement 4.2.1, which requires confirmation that certificates used for Point-to-Point (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is a best practice until March 31, 2025.\n",
120
+ "- Requirement 4.2.1.1, which introduces a new requirement to maintain an inventory of trusted keys and certificates. This is also a best practice until March 31, 2025.\n",
121
+ "\n",
122
+ "\n",
123
+ "\n",
124
+ "<on_llm_end>\n",
125
+ "\n",
126
+ "\n",
127
+ "Completed in 4.869s\n",
128
+ "\n",
129
+ "Question: more on penetration testing\n",
130
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS version 3.2.1 and version 4.0 include changes to the requirements, testing procedures, and guidance. The standard has been updated to address new risks and vulnerabilities, as well as to reflect advances in technology and payment card industry practices. Some specific changes include updates to Requirement 6.3.3, the addition of a description for the change made to Requirement 8.3.9, and the addition of a description of the change made to Requirement 3.6.1.1. Additionally, the standard has been revised to align with the changes from PCI DSS v3.2 to PCI DSS v3.2.1 and to incorporate minor corrections and edits made for clarification and/or format purposes.'), ('new requirements for vulnerability assessments', 'The new requirements for vulnerability assessments in PCI DSS version 4.0 include:\\n\\n- Requirement 4.1.2, which states that there is a new requirement for roles and responsibilities related to vulnerability assessments.\\n- Requirement 4.2.1, which requires confirmation that certificates used for Point-to-Point (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is a best practice until March 31, 2025.\\n- Requirement 4.2.1.1, which introduces a new requirement to maintain an inventory of trusted keys and certificates. This is also a best practice until March 31, 2025.')]}\n",
131
+ "What are the new requirements for penetration testing in PCI DSS version 4.0?\n",
132
+ "\n",
133
+ "\n",
134
+ "\n",
135
+ "<on_llm_end>\n",
136
+ "\n",
137
+ "\n",
138
+ "The new requirements for penetration testing in PCI DSS version 4.0 include defining a penetration testing methodology, covering the entire CDE perimeter and critical systems, testing from both inside and outside the network, testing to validate any segmentation and scope-reduction controls, and performing application-layer and network-layer penetration testing.\n",
139
+ "\n",
140
+ "\n",
141
+ "\n",
142
+ "<on_llm_end>\n",
143
+ "\n",
144
+ "\n",
145
+ "Completed in 2.903s\n",
146
+ "Total time used: 46.121 s\n",
147
+ "Number of tokens generated: 536\n",
148
+ "Average generation speed: 11.622 tokens/s\n",
149
+ "CPU times: user 561 ms, sys: 240 ms, total: 801 ms\n",
150
+ "Wall time: 1min 1s\n"
151
+ ]
152
+ }
153
+ ],
154
+ "source": [
155
+ "%%time\n",
156
+ "\n",
157
+ "os.environ[\"HF_RP\"] = \"1.05\"\n",
158
+ "!python qa_chain_test.py"
159
+ ]
160
+ },
161
+ {
162
+ "cell_type": "code",
163
+ "execution_count": 4,
164
+ "id": "8a022a7b",
165
+ "metadata": {},
166
+ "outputs": [
167
+ {
168
+ "name": "stdout",
169
+ "output_type": "stream",
170
+ "text": [
171
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
172
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
173
+ "MPS is NOT available\n",
174
+ "CUDA is available\n",
175
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
176
+ "CUDA is available, we have found 1 GPU(s)\n",
177
+ "NVIDIA GeForce RTX 4090\n",
178
+ "CUDA version: 12.1\n",
179
+ "hf_embeddings_device_type: cuda:0\n",
180
+ "hf_pipeline_device_type: cuda:0\n",
181
+ "load INSTRUCTOR_Transformer\n",
182
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
183
+ " return self.fget.__get__(instance, owner)()\n",
184
+ "max_seq_length 512\n",
185
+ "Completed in 0.503s\n",
186
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
187
+ "Completed in 0.016s\n",
188
+ "initializing LLM: huggingface\n",
189
+ " hf_pipeline_device_type: cuda:0\n",
190
+ " load_quantized_model: None\n",
191
+ " torch_dtype: torch.bfloat16\n",
192
+ " n_threds: 4\n",
193
+ " loading model: microsoft/Orca-2-7b\n",
194
+ " HF auth token: None\n",
195
+ " repetition_penalty: 1.1\n",
196
+ "Loading checkpoint shards: 100%|██████████████████| 3/3 [00:13<00:00, 4.58s/it]\n",
197
+ "initialization complete\n",
198
+ "Completed in 17.662s\n",
199
+ "\n",
200
+ "Question: What's PCI DSS?\n",
201
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
202
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.\n",
203
+ "\n",
204
+ "\n",
205
+ "\n",
206
+ "<on_llm_end>\n",
207
+ "\n",
208
+ "\n",
209
+ "Completed in 3.039s\n",
210
+ "\n",
211
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
212
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.')]}\n",
213
+ "What are the main differences between PCI DSS versions 3.2.1 and 4.0?\n",
214
+ "\n",
215
+ "\n",
216
+ "\n",
217
+ "<on_llm_end>\n",
218
+ "\n",
219
+ "\n",
220
+ "The main differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement.\n",
221
+ "\n",
222
+ "\n",
223
+ "\n",
224
+ "<on_llm_end>\n",
225
+ "\n",
226
+ "\n",
227
+ "Completed in 1.769s\n",
228
+ "\n",
229
+ "Question: new requirements for vulnerability assessments\n",
230
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement.')]}\n",
231
+ "What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\n",
232
+ "\n",
233
+ "\n",
234
+ "\n",
235
+ "<on_llm_end>\n",
236
+ "\n",
237
+ "\n",
238
+ "There are several new requirements related to vulnerability assessments in PCI DSS version 4.0. Some of them include:\n",
239
+ "\n",
240
+ "1. Requirement 4.1.2, which states that there should be clear roles and responsibilities defined for vulnerability management.\n",
241
+ "2. Requirement 4.2.1, which requires organizations to ensure that certificates used for point-to-point encryption (PAN) transmissions over open, public networks are valid and not expired or revoked. This is considered a best practice until March 31, 2025.\n",
242
+ "3. Requirement 10.4.2.1, which mandates a targeted risk analysis to determine the frequency of log reviews for all other system components.\n",
243
+ "4. Requirement 10.7.2 and 10.7.3, which require organizations to detect, alert, and address failures of critical security control systems promptly.\n",
244
+ "5. Requirement 11.3.1.1 and 11.3.1.2, which require internal vulnerability scans to be performed using authenticated scanning and to manage all applicable vulnerabilities, including those not ranked as high-risk or critical.\n",
245
+ "\n",
246
+ "\n",
247
+ "\n",
248
+ "<on_llm_end>\n",
249
+ "\n",
250
+ "\n",
251
+ "Completed in 7.887s\n",
252
+ "\n",
253
+ "Question: more on penetration testing\n",
254
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a global standard that provides a baseline of technical and operational requirements designed to protect payment data.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The main differences between PCI DSS versions 3.2.1 and 4.0 include changes to the introductory sections, general changes to the requirements, testing procedures, and guidance, and additional changes per requirement.'), ('new requirements for vulnerability assessments', 'There are several new requirements related to vulnerability assessments in PCI DSS version 4.0. Some of them include:\\n\\n1. Requirement 4.1.2, which states that there should be clear roles and responsibilities defined for vulnerability management.\\n2. Requirement 4.2.1, which requires organizations to ensure that certificates used for point-to-point encryption (PAN) transmissions over open, public networks are valid and not expired or revoked. This is considered a best practice until March 31, 2025.\\n3. Requirement 10.4.2.1, which mandates a targeted risk analysis to determine the frequency of log reviews for all other system components.\\n4. Requirement 10.7.2 and 10.7.3, which require organizations to detect, alert, and address failures of critical security control systems promptly.\\n5. Requirement 11.3.1.1 and 11.3.1.2, which require internal vulnerability scans to be performed using authenticated scanning and to manage all applicable vulnerabilities, including those not ranked as high-risk or critical.')]}\n",
255
+ "What are some key differences between penetration testing and vulnerability assessments in the context of PCI DSS?\n",
256
+ "\n",
257
+ "\n",
258
+ "\n",
259
+ "<on_llm_end>\n",
260
+ "\n",
261
+ "\n",
262
+ "Some key differences between penetration testing and vulnerability assessments in the context of PCI DSS include:\n",
263
+ "\n",
264
+ "1. Scope: Penetration testing involves simulated attacks on the network and systems to identify vulnerabilities that could be exploited, while vulnerability assessments focus on identifying and classifying existing vulnerabilities in the system.\n",
265
+ "\n",
266
+ "2. Methodology: Penetration testing uses a more aggressive approach, attempting to exploit vulnerabilities and gain access to sensitive data or systems, whereas vulnerability assessments use a more passive approach, scanning for known vulnerabilities without actually exploiting them.\n",
267
+ "\n",
268
+ "3. Frequency: Penetration testing is typically conducted annually, while vulnerability assessments may be conducted more frequently, depending on the organization's risk profile and compliance requirements.\n",
269
+ "\n",
270
+ "4. Qualified individuals: Penetration testing requires a qualified individual to perform the test, while vulnerability assessments can be performed by internal staff or external third parties, as long as they have the necessary skills and knowledge.\n",
271
+ "\n",
272
+ "\n",
273
+ "\n",
274
+ "<on_llm_end>\n",
275
+ "\n",
276
+ "\n",
277
+ "Completed in 7.499s\n",
278
+ "Total time used: 20.195 s\n",
279
+ "Number of tokens generated: 652\n",
280
+ "Average generation speed: 32.286 tokens/s\n",
281
+ "CPU times: user 380 ms, sys: 213 ms, total: 593 ms\n",
282
+ "Wall time: 41.7 s\n"
283
+ ]
284
+ }
285
+ ],
286
+ "source": [
287
+ "%%time\n",
288
+ "\n",
289
+ "os.environ[\"HF_RP\"] = \"1.10\"\n",
290
+ "!python qa_chain_test.py"
291
+ ]
292
+ },
293
+ {
294
+ "cell_type": "code",
295
+ "execution_count": 5,
296
+ "id": "db48dcc4",
297
+ "metadata": {},
298
+ "outputs": [
299
+ {
300
+ "name": "stdout",
301
+ "output_type": "stream",
302
+ "text": [
303
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
304
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
305
+ "MPS is NOT available\n",
306
+ "CUDA is available\n",
307
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
308
+ "CUDA is available, we have found 1 GPU(s)\n",
309
+ "NVIDIA GeForce RTX 4090\n",
310
+ "CUDA version: 12.1\n",
311
+ "hf_embeddings_device_type: cuda:0\n",
312
+ "hf_pipeline_device_type: cuda:0\n",
313
+ "load INSTRUCTOR_Transformer\n",
314
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
315
+ " return self.fget.__get__(instance, owner)()\n",
316
+ "max_seq_length 512\n",
317
+ "Completed in 0.456s\n",
318
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
319
+ "Completed in 0.016s\n",
320
+ "initializing LLM: huggingface\n",
321
+ " hf_pipeline_device_type: cuda:0\n",
322
+ " load_quantized_model: None\n",
323
+ " torch_dtype: torch.bfloat16\n",
324
+ " n_threds: 4\n",
325
+ " loading model: microsoft/Orca-2-7b\n",
326
+ " HF auth token: None\n",
327
+ " repetition_penalty: 1.15\n",
328
+ "Loading checkpoint shards: 100%|██████████████████| 3/3 [00:01<00:00, 1.59it/s]\n",
329
+ "initialization complete\n",
330
+ "Completed in 6.345s\n",
331
+ "\n",
332
+ "Question: What's PCI DSS?\n",
333
+ "{'question': \"What's PCI DSS?\", 'chat_history': []}\n",
334
+ "PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of rules and guidelines created to protect payment data and ensure the security of cardholder information.\n",
335
+ "\n",
336
+ "\n",
337
+ "\n",
338
+ "<on_llm_end>\n",
339
+ "\n",
340
+ "\n",
341
+ "Completed in 3.256s\n",
342
+ "\n",
343
+ "Question: Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?\n",
344
+ "{'question': 'Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of rules and guidelines created to protect payment data and ensure the security of cardholder information.')]}\n",
345
+ "How has the latest version of PCI DSS, version 4.0, differed from the previous version, 3.2.1?\n",
346
+ "\n",
347
+ "\n",
348
+ "\n",
349
+ "<on_llm_end>\n",
350
+ "\n",
351
+ "\n",
352
+ "The latest version of PCI DSS, version 4.0, differs from the previous version, 3.2.1, by including updates to align with the changes from PCI DSS v3.2.1 to PCI DSS v4.0.\n",
353
+ "\n",
354
+ "\n",
355
+ "\n",
356
+ "<on_llm_end>\n",
357
+ "\n",
358
+ "\n",
359
+ "Completed in 2.222s\n",
360
+ "\n",
361
+ "Question: new requirements for vulnerability assessments\n",
362
+ "{'question': 'new requirements for vulnerability assessments', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of rules and guidelines created to protect payment data and ensure the security of cardholder information.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The latest version of PCI DSS, version 4.0, differs from the previous version, 3.2.1, by including updates to align with the changes from PCI DSS v3.2.1 to PCI DSS v4.0.')]}\n",
363
+ "What are some new requirements for vulnerability assessments introduced in PCI DSS version 4.0?\n",
364
+ "\n",
365
+ "\n",
366
+ "\n",
367
+ "<on_llm_end>\n",
368
+ "\n",
369
+ "\n",
370
+ "Some new requirements for vulnerability assessments introduced in PCI DSS version 4.0 include:\n",
371
+ "\n",
372
+ "- Performing a targeted risk analysis to determine the frequency of log reviews for all other system components (Requirement 10.4.2.1)\n",
373
+ "- Ensuring failures of critical security control systems are detected, alerted, and addressed promptly (Requirement 10.7.2), and responded to promptly (Requirement 10.7.3)\n",
374
+ "- Documenting, assigning, and understanding roles and responsibilities for performing activities in Requirement 11 (Requirement 11.1.2)\n",
375
+ "- Managing all applicable vulnerabilities not ranked as high-risk or critical (Requirement 11.3.1.1)\n",
376
+ "- Performing internal vulnerability scans via authenticated scanning (Requirement 11.3.1.2)\n",
377
+ "\n",
378
+ "\n",
379
+ "\n",
380
+ "<on_llm_end>\n",
381
+ "\n",
382
+ "\n",
383
+ "Completed in 5.732s\n",
384
+ "\n",
385
+ "Question: more on penetration testing\n",
386
+ "{'question': 'more on penetration testing', 'chat_history': [(\"What's PCI DSS?\", 'PCI DSS stands for Payment Card Industry Data Security Standard. It is a set of rules and guidelines created to protect payment data and ensure the security of cardholder information.'), ('Can you summarize the changes made from PCI DSS version 3.2.1 to version 4.0?', 'The latest version of PCI DSS, version 4.0, differs from the previous version, 3.2.1, by including updates to align with the changes from PCI DSS v3.2.1 to PCI DSS v4.0.'), ('new requirements for vulnerability assessments', 'Some new requirements for vulnerability assessments introduced in PCI DSS version 4.0 include:\\n\\n- Performing a targeted risk analysis to determine the frequency of log reviews for all other system components (Requirement 10.4.2.1)\\n- Ensuring failures of critical security control systems are detected, alerted, and addressed promptly (Requirement 10.7.2), and responded to promptly (Requirement 10.7.3)\\n- Documenting, assigning, and understanding roles and responsibilities for performing activities in Requirement 11 (Requirement 11.1.2)\\n- Managing all applicable vulnerabilities not ranked as high-risk or critical (Requirement 11.3.1.1)\\n- Performing internal vulnerability scans via authenticated scanning (Requirement 11.3.1.2)')]}\n",
387
+ "What are some best practices for conducting effective penetration tests?\n",
388
+ "\n",
389
+ "\n",
390
+ "\n",
391
+ "<on_llm_end>\n",
392
+ "\n",
393
+ "\n",
394
+ "Some best practices for conducting effective penetration tests include performing the testing according to a defined methodology, ensuring the tester has organizational independence, validating segmentation and scope reduction controls, testing both inside and outside the network, considering the latest threats and vulnerabilities, and documenting the approach to addressing risks identified during the testing.\n",
395
+ "\n",
396
+ "\n",
397
+ "\n",
398
+ "<on_llm_end>\n",
399
+ "\n",
400
+ "\n",
401
+ "Completed in 2.461s\n",
402
+ "Total time used: 13.672 s\n",
403
+ "Number of tokens generated: 454\n",
404
+ "Average generation speed: 33.208 tokens/s\n",
405
+ "CPU times: user 322 ms, sys: 44.4 ms, total: 366 ms\n",
406
+ "Wall time: 23.7 s\n"
407
+ ]
408
+ }
409
+ ],
410
+ "source": [
411
+ "%%time\n",
412
+ "\n",
413
+ "os.environ[\"HF_RP\"] = \"1.15\"\n",
414
+ "!python qa_chain_test.py"
415
+ ]
416
+ }
417
+ ],
418
+ "metadata": {
419
+ "kernelspec": {
420
+ "display_name": "Python 3 (ipykernel)",
421
+ "language": "python",
422
+ "name": "python3"
423
+ },
424
+ "language_info": {
425
+ "codemirror_mode": {
426
+ "name": "ipython",
427
+ "version": 3
428
+ },
429
+ "file_extension": ".py",
430
+ "mimetype": "text/x-python",
431
+ "name": "python",
432
+ "nbconvert_exporter": "python",
433
+ "pygments_lexer": "ipython3",
434
+ "version": "3.11.7"
435
+ }
436
+ },
437
+ "nbformat": 4,
438
+ "nbformat_minor": 5
439
+ }
notebook/nvidia-4090-phi-2-2.7b.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
qa_chain_test.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ from timeit import default_timer as timer
4
+
5
+ from langchain.callbacks.base import BaseCallbackHandler
6
+ from langchain.schema import LLMResult
7
+
8
+ from app_modules.init import app_init
9
+ from app_modules.utils import print_llm_response
10
+
11
+ llm_loader, qa_chain = app_init()
12
+
13
+
14
+ class MyCustomHandler(BaseCallbackHandler):
15
+ def __init__(self):
16
+ self.reset()
17
+
18
+ def reset(self):
19
+ self.texts = []
20
+
21
+ def get_standalone_question(self) -> str:
22
+ return self.texts[0].strip() if len(self.texts) > 0 else None
23
+
24
+ def on_llm_end(self, response: LLMResult, **kwargs) -> None:
25
+ """Run when chain ends running."""
26
+ print("\n<on_llm_end>")
27
+ # print(response)
28
+ self.texts.append(response.generations[0][0].text)
29
+
30
+
31
+ chatting = len(sys.argv) > 1 and sys.argv[1] == "chat"
32
+ questions_file_path = os.environ.get("QUESTIONS_FILE_PATH")
33
+ chat_history_enabled = os.environ.get("CHAT_HISTORY_ENABLED") or "true"
34
+
35
+ custom_handler = MyCustomHandler()
36
+
37
+ # Chatbot loop
38
+ chat_history = []
39
+
40
+ # Open the file for reading
41
+ file = open(questions_file_path, "r")
42
+
43
+ # Read the contents of the file into a list of strings
44
+ questions = file.readlines()
45
+ for i in range(len(questions)):
46
+ questions[i] = questions[i].strip()
47
+
48
+ # Close the file
49
+ file.close()
50
+
51
+ if __name__ == "__main__":
52
+ questions.append("exit")
53
+
54
+ chat_start = timer()
55
+
56
+ while True:
57
+ if chatting:
58
+ query = input("Please enter your question: ")
59
+ else:
60
+ query = questions.pop(0)
61
+
62
+ query = query.strip()
63
+ if query.lower() == "exit":
64
+ break
65
+
66
+ print("\nQuestion: " + query)
67
+ custom_handler.reset()
68
+
69
+ start = timer()
70
+ result = qa_chain.call_chain(
71
+ {"question": query, "chat_history": chat_history},
72
+ custom_handler,
73
+ None,
74
+ True,
75
+ )
76
+ end = timer()
77
+ print(f"Completed in {end - start:.3f}s")
78
+
79
+ if chat_history_enabled == "true":
80
+ chat_history.append((query, result["answer"]))
81
+
82
+ chat_end = timer()
83
+ total_time = chat_end - chat_start
84
+ print(f"Total time used: {total_time:.3f} s")
85
+ print(f"Number of tokens generated: {llm_loader.streamer.total_tokens}")
86
+ print(
87
+ f"Average generation speed: {llm_loader.streamer.total_tokens / total_time:.3f} tokens/s"
88
+ )
requirements-mac.txt ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ accelerate==0.26.1
2
+ aiofiles==23.2.1
3
+ aiohttp==3.9.1
4
+ aiosignal==1.3.1
5
+ altair==5.2.0
6
+ annotated-types==0.6.0
7
+ anyio==4.2.0
8
+ attrs==23.2.0
9
+ black==24.1.0
10
+ certifi==2023.11.17
11
+ charset-normalizer==3.3.2
12
+ click==8.1.7
13
+ colorama==0.4.6
14
+ contourpy==1.2.0
15
+ cycler==0.12.1
16
+ dataclasses-json==0.6.3
17
+ faiss-cpu==1.7.4
18
+ fastapi==0.109.0
19
+ ffmpy==0.3.1
20
+ filelock==3.13.1
21
+ fonttools==4.47.2
22
+ frozenlist==1.4.1
23
+ fsspec==2023.12.2
24
+ gradio==4.16.0
25
+ gradio_client==0.8.1
26
+ greenlet==3.0.3
27
+ h11==0.14.0
28
+ httpcore==1.0.2
29
+ httpx==0.26.0
30
+ huggingface-hub==0.20.3
31
+ idna==3.6
32
+ importlib-resources==6.1.1
33
+ InstructorEmbedding==1.0.1
34
+ isort==5.13.2
35
+ Jinja2==3.1.3
36
+ joblib==1.3.2
37
+ jsonpatch==1.33
38
+ jsonpointer==2.4
39
+ jsonschema==4.21.1
40
+ jsonschema-specifications==2023.12.1
41
+ kiwisolver==1.4.5
42
+ langchain==0.1.4
43
+ langchain-community==0.0.16
44
+ langchain-openai==0.0.5
45
+ langchain-core==0.1.16
46
+ langsmith==0.0.83
47
+ markdown-it-py==3.0.0
48
+ MarkupSafe==2.1.4
49
+ marshmallow==3.20.2
50
+ matplotlib==3.8.2
51
+ mdurl==0.1.2
52
+ mpmath==1.3.0
53
+ multidict==6.0.4
54
+ mypy-extensions==1.0.0
55
+ networkx==3.2.1
56
+ nltk==3.8.1
57
+ numpy==1.26.3
58
+ # nvidia-cublas-cu12==12.1.3.1
59
+ # nvidia-cuda-cupti-cu12==12.1.105
60
+ # nvidia-cuda-nvrtc-cu12==12.1.105
61
+ # nvidia-cuda-runtime-cu12==12.1.105
62
+ # nvidia-cudnn-cu12==8.9.2.26
63
+ # nvidia-cufft-cu12==11.0.2.54
64
+ # nvidia-curand-cu12==10.3.2.106
65
+ # nvidia-cusolver-cu12==11.4.5.107
66
+ # nvidia-cusparse-cu12==12.1.0.106
67
+ # nvidia-nccl-cu12==2.18.1
68
+ # nvidia-nvjitlink-cu12==12.3.101
69
+ # nvidia-nvtx-cu12==12.1.105
70
+ orjson==3.9.12
71
+ packaging==23.2
72
+ pandas==2.2.0
73
+ pathspec==0.12.1
74
+ peft @ git+https://github.com/huggingface/peft.git@1c1c7fdaa6e6abaa53939b865dee1eded82ad032
75
+ pillow==10.2.0
76
+ platformdirs==4.1.0
77
+ protobuf==4.25.2
78
+ psutil==5.9.8
79
+ pydantic==2.5.3
80
+ pydantic_core==2.14.6
81
+ pydub==0.25.1
82
+ Pygments==2.17.2
83
+ pyparsing==3.1.1
84
+ python-dateutil==2.8.2
85
+ python-dotenv==1.0.1
86
+ python-multipart==0.0.6
87
+ pytz==2023.3.post1
88
+ PyYAML==6.0.1
89
+ referencing==0.32.1
90
+ regex==2023.12.25
91
+ requests==2.31.0
92
+ rich==13.7.0
93
+ rpds-py==0.17.1
94
+ ruff==0.1.14
95
+ safetensors==0.4.2
96
+ scikit-learn==1.4.0
97
+ scipy==1.12.0
98
+ semantic-version==2.10.0
99
+ sentence-transformers==2.2.2
100
+ sentencepiece==0.1.99
101
+ shellingham==1.5.4
102
+ six==1.16.0
103
+ sniffio==1.3.0
104
+ SQLAlchemy==2.0.25
105
+ starlette==0.35.1
106
+ sympy==1.12
107
+ tenacity==8.2.3
108
+ threadpoolctl==3.2.0
109
+ tokenizers==0.15.1
110
+ tomlkit==0.12.0
111
+ toolz==0.12.1
112
+ torch==2.1.2
113
+ torchvision==0.16.2
114
+ tqdm==4.66.1
115
+ transformers @ git+https://github.com/huggingface/transformers.git@de13a951b38b85195984164819f1ab05fe508677
116
+ # triton==2.1.0
117
+ typer==0.9.0
118
+ typing-inspect==0.9.0
119
+ typing_extensions==4.9.0
120
+ tzdata==2023.4
121
+ urllib3==2.1.0
122
+ uvicorn==0.27.0
123
+ websockets==11.0.3
124
+ yarl==1.9.4
125
+ einops==0.7.0
126
+ Pyarrow==15.0.0
127
+ openpyxl==3.1.2
128
+ text_generation==0.6.1
129
+ tabulate==0.9.0
requirements.txt ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ accelerate==0.26.1
2
+ aiofiles==23.2.1
3
+ aiohttp==3.9.1
4
+ aiosignal==1.3.1
5
+ altair==5.2.0
6
+ annotated-types==0.6.0
7
+ anyio==4.2.0
8
+ attrs==23.2.0
9
+ black==24.1.0
10
+ certifi==2023.11.17
11
+ charset-normalizer==3.3.2
12
+ click==8.1.7
13
+ colorama==0.4.6
14
+ contourpy==1.2.0
15
+ cycler==0.12.1
16
+ dataclasses-json==0.6.3
17
+ faiss-cpu==1.7.4
18
+ fastapi==0.109.0
19
+ ffmpy==0.3.1
20
+ filelock==3.13.1
21
+ fonttools==4.47.2
22
+ frozenlist==1.4.1
23
+ fsspec==2023.12.2
24
+ gradio==4.16.0
25
+ gradio_client==0.8.1
26
+ greenlet==3.0.3
27
+ h11==0.14.0
28
+ httpcore==1.0.2
29
+ httpx==0.26.0
30
+ huggingface-hub==0.20.3
31
+ idna==3.6
32
+ importlib-resources==6.1.1
33
+ InstructorEmbedding==1.0.1
34
+ isort==5.13.2
35
+ Jinja2==3.1.3
36
+ joblib==1.3.2
37
+ jsonpatch==1.33
38
+ jsonpointer==2.4
39
+ jsonschema==4.21.1
40
+ jsonschema-specifications==2023.12.1
41
+ kiwisolver==1.4.5
42
+ langchain==0.1.4
43
+ langchain-community==0.0.16
44
+ langchain-openai==0.0.5
45
+ langchain-core==0.1.16
46
+ langsmith==0.0.83
47
+ markdown-it-py==3.0.0
48
+ MarkupSafe==2.1.4
49
+ marshmallow==3.20.2
50
+ matplotlib==3.8.2
51
+ mdurl==0.1.2
52
+ mpmath==1.3.0
53
+ multidict==6.0.4
54
+ mypy-extensions==1.0.0
55
+ networkx==3.2.1
56
+ nltk==3.8.1
57
+ numpy==1.26.3
58
+ nvidia-cublas-cu12==12.1.3.1
59
+ nvidia-cuda-cupti-cu12==12.1.105
60
+ nvidia-cuda-nvrtc-cu12==12.1.105
61
+ nvidia-cuda-runtime-cu12==12.1.105
62
+ nvidia-cudnn-cu12==8.9.2.26
63
+ nvidia-cufft-cu12==11.0.2.54
64
+ nvidia-curand-cu12==10.3.2.106
65
+ nvidia-cusolver-cu12==11.4.5.107
66
+ nvidia-cusparse-cu12==12.1.0.106
67
+ nvidia-nccl-cu12==2.18.1
68
+ nvidia-nvjitlink-cu12==12.3.101
69
+ nvidia-nvtx-cu12==12.1.105
70
+ orjson==3.9.12
71
+ packaging==23.2
72
+ pandas==2.2.0
73
+ pathspec==0.12.1
74
+ peft @ git+https://github.com/huggingface/peft.git@1c1c7fdaa6e6abaa53939b865dee1eded82ad032
75
+ pillow==10.2.0
76
+ platformdirs==4.1.0
77
+ protobuf==4.25.2
78
+ psutil==5.9.8
79
+ pydantic==2.5.3
80
+ pydantic_core==2.14.6
81
+ pydub==0.25.1
82
+ Pygments==2.17.2
83
+ pyparsing==3.1.1
84
+ python-dateutil==2.8.2
85
+ python-dotenv==1.0.1
86
+ python-multipart==0.0.6
87
+ pytz==2023.3.post1
88
+ PyYAML==6.0.1
89
+ referencing==0.32.1
90
+ regex==2023.12.25
91
+ requests==2.31.0
92
+ rich==13.7.0
93
+ rpds-py==0.17.1
94
+ ruff==0.1.14
95
+ safetensors==0.4.2
96
+ scikit-learn==1.4.0
97
+ scipy==1.12.0
98
+ semantic-version==2.10.0
99
+ sentence-transformers==2.2.2
100
+ sentencepiece==0.1.99
101
+ shellingham==1.5.4
102
+ six==1.16.0
103
+ sniffio==1.3.0
104
+ SQLAlchemy==2.0.25
105
+ starlette==0.35.1
106
+ sympy==1.12
107
+ tenacity==8.2.3
108
+ threadpoolctl==3.2.0
109
+ tokenizers==0.15.1
110
+ tomlkit==0.12.0
111
+ toolz==0.12.1
112
+ torch==2.1.2
113
+ torchvision==0.16.2
114
+ tqdm==4.66.1
115
+ transformers @ git+https://github.com/huggingface/transformers.git@de13a951b38b85195984164819f1ab05fe508677
116
+ triton==2.1.0
117
+ typer==0.9.0
118
+ typing-inspect==0.9.0
119
+ typing_extensions==4.9.0
120
+ tzdata==2023.4
121
+ urllib3==2.1.0
122
+ uvicorn==0.27.0
123
+ websockets==11.0.3
124
+ yarl==1.9.4
125
+ einops==0.7.0
126
+ Pyarrow==15.0.0
127
+ openpyxl==3.1.2
128
+ text_generation==0.6.1
129
+ tabulate==0.9.0
results/1_process-raw-data.ipynb ADDED
@@ -0,0 +1,1573 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "workding dir: /home/inflaton/code/chat-with-orca-2\n"
13
+ ]
14
+ }
15
+ ],
16
+ "source": [
17
+ "import os\n",
18
+ "import sys\n",
19
+ "from pathlib import Path\n",
20
+ "\n",
21
+ "workding_dir = str(Path.cwd().parent)\n",
22
+ "os.chdir(workding_dir)\n",
23
+ "sys.path.append(workding_dir)\n",
24
+ "print(\"workding dir:\", workding_dir)"
25
+ ]
26
+ },
27
+ {
28
+ "cell_type": "code",
29
+ "execution_count": 2,
30
+ "metadata": {},
31
+ "outputs": [
32
+ {
33
+ "name": "stderr",
34
+ "output_type": "stream",
35
+ "text": [
36
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
37
+ " from .autonotebook import tqdm as notebook_tqdm\n"
38
+ ]
39
+ },
40
+ {
41
+ "name": "stdout",
42
+ "output_type": "stream",
43
+ "text": [
44
+ "loading env vars from: /home/inflaton/code/chat-with-orca-2/.env\n",
45
+ "Running on: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
46
+ "MPS is NOT available\n",
47
+ "CUDA is available\n",
48
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
49
+ "CUDA is available, we have found 1 GPU(s)\n",
50
+ "NVIDIA GeForce RTX 4090\n",
51
+ "CUDA version: 12.1\n",
52
+ "hf_embeddings_device_type: cuda:0\n",
53
+ "hf_pipeline_device_type: cuda:0\n",
54
+ "load INSTRUCTOR_Transformer\n"
55
+ ]
56
+ },
57
+ {
58
+ "name": "stderr",
59
+ "output_type": "stream",
60
+ "text": [
61
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
62
+ " return self.fget.__get__(instance, owner)()\n"
63
+ ]
64
+ },
65
+ {
66
+ "name": "stdout",
67
+ "output_type": "stream",
68
+ "text": [
69
+ "max_seq_length 512\n",
70
+ "Completed in 0.464s\n",
71
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
72
+ "Completed in 0.013s\n",
73
+ "initializing LLM: openai\n",
74
+ " hf_pipeline_device_type: cuda:0\n",
75
+ " load_quantized_model: None\n",
76
+ " torch_dtype: torch.bfloat16\n",
77
+ " n_threds: 4\n",
78
+ " using model: gpt-3.5-turbo\n",
79
+ "initialization complete\n",
80
+ "Completed in 0.024s\n",
81
+ "CPU times: user 5.59 s, sys: 5.55 s, total: 11.1 s\n",
82
+ "Wall time: 3.47 s\n"
83
+ ]
84
+ }
85
+ ],
86
+ "source": [
87
+ "%%time\n",
88
+ "\n",
89
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"openai\"\n",
90
+ "from eval_models import *"
91
+ ]
92
+ },
93
+ {
94
+ "cell_type": "code",
95
+ "execution_count": 3,
96
+ "metadata": {},
97
+ "outputs": [
98
+ {
99
+ "name": "stdout",
100
+ "output_type": "stream",
101
+ "text": [
102
+ "loading: ./notebook/nvidia-4090-orca-2-7b.ipynb\n",
103
+ "processing repetition_penalty: 1.05\n",
104
+ "processing repetition_penalty: 1.10\n",
105
+ "processing repetition_penalty: 1.15\n"
106
+ ]
107
+ },
108
+ {
109
+ "name": "stderr",
110
+ "output_type": "stream",
111
+ "text": [
112
+ "Evaluating: 100%|██████████| 8/8 [00:52<00:00, 6.53s/it]\n"
113
+ ]
114
+ },
115
+ {
116
+ "name": "stdout",
117
+ "output_type": "stream",
118
+ "text": [
119
+ "\n",
120
+ "\n",
121
+ "# Ragas scores: {'faithfulness': 0.8304, 'answer_relevancy': 0.9783, 'overall_score': 0.8983}\n",
122
+ "\n"
123
+ ]
124
+ },
125
+ {
126
+ "name": "stderr",
127
+ "output_type": "stream",
128
+ "text": [
129
+ "Evaluating: 100%|██████████| 8/8 [00:31<00:00, 3.97s/it]\n"
130
+ ]
131
+ },
132
+ {
133
+ "name": "stdout",
134
+ "output_type": "stream",
135
+ "text": [
136
+ "\n",
137
+ "\n",
138
+ "# Ragas scores: {'faithfulness': 0.7500, 'answer_relevancy': 0.9748, 'overall_score': 0.8478}\n",
139
+ "\n"
140
+ ]
141
+ },
142
+ {
143
+ "name": "stderr",
144
+ "output_type": "stream",
145
+ "text": [
146
+ "Evaluating: 100%|██████████| 8/8 [00:29<00:00, 3.65s/it]\n"
147
+ ]
148
+ },
149
+ {
150
+ "name": "stdout",
151
+ "output_type": "stream",
152
+ "text": [
153
+ "\n",
154
+ "\n",
155
+ "# Ragas scores: {'faithfulness': 1.0000, 'answer_relevancy': 0.9733, 'overall_score': 0.9865}\n",
156
+ "\n",
157
+ "loading: ./notebook/nvidia-4090-llama-2-7b.ipynb\n",
158
+ "processing repetition_penalty: 1.05\n",
159
+ "processing repetition_penalty: 1.10\n",
160
+ "processing repetition_penalty: 1.15\n"
161
+ ]
162
+ },
163
+ {
164
+ "name": "stderr",
165
+ "output_type": "stream",
166
+ "text": [
167
+ "Evaluating: 100%|██████████| 8/8 [00:35<00:00, 4.39s/it]\n"
168
+ ]
169
+ },
170
+ {
171
+ "name": "stdout",
172
+ "output_type": "stream",
173
+ "text": [
174
+ "\n",
175
+ "\n",
176
+ "# Ragas scores: {'faithfulness': 0.8750, 'answer_relevancy': 0.7151, 'overall_score': 0.7870}\n",
177
+ "\n"
178
+ ]
179
+ },
180
+ {
181
+ "name": "stderr",
182
+ "output_type": "stream",
183
+ "text": [
184
+ "Evaluating: 100%|██████████| 8/8 [00:40<00:00, 5.02s/it]\n"
185
+ ]
186
+ },
187
+ {
188
+ "name": "stdout",
189
+ "output_type": "stream",
190
+ "text": [
191
+ "\n",
192
+ "\n",
193
+ "# Ragas scores: {'faithfulness': 0.8796, 'answer_relevancy': 0.7313, 'overall_score': 0.7986}\n",
194
+ "\n"
195
+ ]
196
+ },
197
+ {
198
+ "name": "stderr",
199
+ "output_type": "stream",
200
+ "text": [
201
+ "Evaluating: 100%|██████████| 8/8 [00:53<00:00, 6.63s/it]\n"
202
+ ]
203
+ },
204
+ {
205
+ "name": "stdout",
206
+ "output_type": "stream",
207
+ "text": [
208
+ "\n",
209
+ "\n",
210
+ "# Ragas scores: {'faithfulness': 1.0000, 'answer_relevancy': 0.7112, 'overall_score': 0.8312}\n",
211
+ "\n",
212
+ "loading: ./notebook/nvidia-4090-orca-2-13b.ipynb\n",
213
+ "processing repetition_penalty: 1.05\n",
214
+ "processing repetition_penalty: 1.10\n",
215
+ "processing repetition_penalty: 1.15\n"
216
+ ]
217
+ },
218
+ {
219
+ "name": "stderr",
220
+ "output_type": "stream",
221
+ "text": [
222
+ "Evaluating: 100%|██████████| 8/8 [00:44<00:00, 5.54s/it]\n"
223
+ ]
224
+ },
225
+ {
226
+ "name": "stdout",
227
+ "output_type": "stream",
228
+ "text": [
229
+ "\n",
230
+ "\n",
231
+ "# Ragas scores: {'faithfulness': 1.0000, 'answer_relevancy': 0.9876, 'overall_score': 0.9938}\n",
232
+ "\n"
233
+ ]
234
+ },
235
+ {
236
+ "name": "stderr",
237
+ "output_type": "stream",
238
+ "text": [
239
+ "Evaluating: 100%|██████████| 8/8 [00:47<00:00, 5.99s/it]\n"
240
+ ]
241
+ },
242
+ {
243
+ "name": "stdout",
244
+ "output_type": "stream",
245
+ "text": [
246
+ "\n",
247
+ "\n",
248
+ "# Ragas scores: {'faithfulness': 1.0000, 'answer_relevancy': 0.9608, 'overall_score': 0.9800}\n",
249
+ "\n"
250
+ ]
251
+ },
252
+ {
253
+ "name": "stderr",
254
+ "output_type": "stream",
255
+ "text": [
256
+ "Evaluating: 100%|██████████| 8/8 [02:41<00:00, 20.19s/it]\n"
257
+ ]
258
+ },
259
+ {
260
+ "name": "stdout",
261
+ "output_type": "stream",
262
+ "text": [
263
+ "\n",
264
+ "\n",
265
+ "# Ragas scores: {'faithfulness': 0.9500, 'answer_relevancy': 0.9611, 'overall_score': 0.9555}\n",
266
+ "\n",
267
+ "loading: ./notebook/nvidia-4090-llama-2-13b.ipynb\n",
268
+ "processing repetition_penalty: 1.05\n",
269
+ "processing repetition_penalty: 1.10\n",
270
+ "processing repetition_penalty: 1.15\n"
271
+ ]
272
+ },
273
+ {
274
+ "name": "stderr",
275
+ "output_type": "stream",
276
+ "text": [
277
+ "Evaluating: 100%|██████████| 8/8 [00:33<00:00, 4.20s/it]\n"
278
+ ]
279
+ },
280
+ {
281
+ "name": "stdout",
282
+ "output_type": "stream",
283
+ "text": [
284
+ "\n",
285
+ "\n",
286
+ "# Ragas scores: {'faithfulness': 0.9000, 'answer_relevancy': 0.9624, 'overall_score': 0.9302}\n",
287
+ "\n"
288
+ ]
289
+ },
290
+ {
291
+ "name": "stderr",
292
+ "output_type": "stream",
293
+ "text": [
294
+ "Evaluating: 100%|██████████| 8/8 [00:41<00:00, 5.17s/it]\n"
295
+ ]
296
+ },
297
+ {
298
+ "name": "stdout",
299
+ "output_type": "stream",
300
+ "text": [
301
+ "\n",
302
+ "\n",
303
+ "# Ragas scores: {'faithfulness': 0.8750, 'answer_relevancy': 0.9673, 'overall_score': 0.9188}\n",
304
+ "\n"
305
+ ]
306
+ },
307
+ {
308
+ "name": "stderr",
309
+ "output_type": "stream",
310
+ "text": [
311
+ "Evaluating: 100%|██████████| 8/8 [00:50<00:00, 6.26s/it]\n"
312
+ ]
313
+ },
314
+ {
315
+ "name": "stdout",
316
+ "output_type": "stream",
317
+ "text": [
318
+ "\n",
319
+ "\n",
320
+ "# Ragas scores: {'faithfulness': 0.9444, 'answer_relevancy': 0.9646, 'overall_score': 0.9544}\n",
321
+ "\n",
322
+ "loading: ./notebook/nvidia-4090-openai.ipynb\n",
323
+ "processing repetition_penalty: 1.05\n",
324
+ "processing repetition_penalty: 1.10\n",
325
+ "processing repetition_penalty: 1.15\n"
326
+ ]
327
+ },
328
+ {
329
+ "name": "stderr",
330
+ "output_type": "stream",
331
+ "text": [
332
+ "Evaluating: 100%|██████████| 8/8 [02:41<00:00, 20.17s/it]\n"
333
+ ]
334
+ },
335
+ {
336
+ "name": "stdout",
337
+ "output_type": "stream",
338
+ "text": [
339
+ "\n",
340
+ "\n",
341
+ "# Ragas scores: {'faithfulness': 0.9583, 'answer_relevancy': 0.4836, 'overall_score': 0.6428}\n",
342
+ "\n"
343
+ ]
344
+ },
345
+ {
346
+ "name": "stderr",
347
+ "output_type": "stream",
348
+ "text": [
349
+ "Evaluating: 100%|██████████| 8/8 [00:36<00:00, 4.54s/it]\n"
350
+ ]
351
+ },
352
+ {
353
+ "name": "stdout",
354
+ "output_type": "stream",
355
+ "text": [
356
+ "\n",
357
+ "\n",
358
+ "# Ragas scores: {'faithfulness': 0.8373, 'answer_relevancy': 0.9527, 'overall_score': 0.8913}\n",
359
+ "\n"
360
+ ]
361
+ },
362
+ {
363
+ "name": "stderr",
364
+ "output_type": "stream",
365
+ "text": [
366
+ "Evaluating: 100%|██████████| 8/8 [03:09<00:00, 23.67s/it]\n"
367
+ ]
368
+ },
369
+ {
370
+ "name": "stdout",
371
+ "output_type": "stream",
372
+ "text": [
373
+ "\n",
374
+ "\n",
375
+ "# Ragas scores: {'faithfulness': 1.0000, 'answer_relevancy': 0.7019, 'overall_score': 0.8248}\n",
376
+ "\n",
377
+ "CPU times: user 5.91 s, sys: 930 ms, total: 6.84 s\n",
378
+ "Wall time: 17min 18s\n"
379
+ ]
380
+ }
381
+ ],
382
+ "source": [
383
+ "%%time\n",
384
+ "\n",
385
+ "model_names = [\"orca-2-7b\", \"llama-2-7b\", \"orca-2-13b\", \"llama-2-13b\", \"openai\"]\n",
386
+ "\n",
387
+ "perf_pd, raw_pd = evaluate_models(model_names)"
388
+ ]
389
+ },
390
+ {
391
+ "cell_type": "code",
392
+ "execution_count": 4,
393
+ "metadata": {},
394
+ "outputs": [
395
+ {
396
+ "data": {
397
+ "text/html": [
398
+ "<div>\n",
399
+ "<style scoped>\n",
400
+ " .dataframe tbody tr th:only-of-type {\n",
401
+ " vertical-align: middle;\n",
402
+ " }\n",
403
+ "\n",
404
+ " .dataframe tbody tr th {\n",
405
+ " vertical-align: top;\n",
406
+ " }\n",
407
+ "\n",
408
+ " .dataframe thead th {\n",
409
+ " text-align: right;\n",
410
+ " }\n",
411
+ "</style>\n",
412
+ "<table border=\"1\" class=\"dataframe\">\n",
413
+ " <thead>\n",
414
+ " <tr style=\"text-align: right;\">\n",
415
+ " <th></th>\n",
416
+ " <th>model_name</th>\n",
417
+ " <th>repetition_penalty</th>\n",
418
+ " <th>faithfulness</th>\n",
419
+ " <th>answer_relevancy</th>\n",
420
+ " <th>overall_score</th>\n",
421
+ " <th>total_time_used</th>\n",
422
+ " <th>num_tokens_generated</th>\n",
423
+ " <th>token_per_second</th>\n",
424
+ " </tr>\n",
425
+ " </thead>\n",
426
+ " <tbody>\n",
427
+ " <tr>\n",
428
+ " <th>0</th>\n",
429
+ " <td>orca-2-7b</td>\n",
430
+ " <td>1.05</td>\n",
431
+ " <td>0.830357</td>\n",
432
+ " <td>0.978324</td>\n",
433
+ " <td>0.898288</td>\n",
434
+ " <td>46.121</td>\n",
435
+ " <td>536</td>\n",
436
+ " <td>11.622</td>\n",
437
+ " </tr>\n",
438
+ " <tr>\n",
439
+ " <th>1</th>\n",
440
+ " <td>orca-2-7b</td>\n",
441
+ " <td>1.10</td>\n",
442
+ " <td>0.750000</td>\n",
443
+ " <td>0.974817</td>\n",
444
+ " <td>0.847757</td>\n",
445
+ " <td>20.195</td>\n",
446
+ " <td>652</td>\n",
447
+ " <td>32.286</td>\n",
448
+ " </tr>\n",
449
+ " <tr>\n",
450
+ " <th>2</th>\n",
451
+ " <td>orca-2-7b</td>\n",
452
+ " <td>1.15</td>\n",
453
+ " <td>1.000000</td>\n",
454
+ " <td>0.973278</td>\n",
455
+ " <td>0.986458</td>\n",
456
+ " <td>13.672</td>\n",
457
+ " <td>454</td>\n",
458
+ " <td>33.208</td>\n",
459
+ " </tr>\n",
460
+ " <tr>\n",
461
+ " <th>3</th>\n",
462
+ " <td>llama-2-7b</td>\n",
463
+ " <td>1.05</td>\n",
464
+ " <td>0.875000</td>\n",
465
+ " <td>0.715099</td>\n",
466
+ " <td>0.787010</td>\n",
467
+ " <td>19.468</td>\n",
468
+ " <td>679</td>\n",
469
+ " <td>34.878</td>\n",
470
+ " </tr>\n",
471
+ " <tr>\n",
472
+ " <th>4</th>\n",
473
+ " <td>llama-2-7b</td>\n",
474
+ " <td>1.10</td>\n",
475
+ " <td>0.879630</td>\n",
476
+ " <td>0.731304</td>\n",
477
+ " <td>0.798638</td>\n",
478
+ " <td>21.670</td>\n",
479
+ " <td>759</td>\n",
480
+ " <td>35.026</td>\n",
481
+ " </tr>\n",
482
+ " <tr>\n",
483
+ " <th>5</th>\n",
484
+ " <td>llama-2-7b</td>\n",
485
+ " <td>1.15</td>\n",
486
+ " <td>1.000000</td>\n",
487
+ " <td>0.711172</td>\n",
488
+ " <td>0.831210</td>\n",
489
+ " <td>22.604</td>\n",
490
+ " <td>803</td>\n",
491
+ " <td>35.524</td>\n",
492
+ " </tr>\n",
493
+ " <tr>\n",
494
+ " <th>6</th>\n",
495
+ " <td>orca-2-13b</td>\n",
496
+ " <td>1.05</td>\n",
497
+ " <td>1.000000</td>\n",
498
+ " <td>0.987592</td>\n",
499
+ " <td>0.993757</td>\n",
500
+ " <td>397.548</td>\n",
501
+ " <td>641</td>\n",
502
+ " <td>1.612</td>\n",
503
+ " </tr>\n",
504
+ " <tr>\n",
505
+ " <th>7</th>\n",
506
+ " <td>orca-2-13b</td>\n",
507
+ " <td>1.10</td>\n",
508
+ " <td>1.000000</td>\n",
509
+ " <td>0.960806</td>\n",
510
+ " <td>0.980011</td>\n",
511
+ " <td>272.891</td>\n",
512
+ " <td>478</td>\n",
513
+ " <td>1.752</td>\n",
514
+ " </tr>\n",
515
+ " <tr>\n",
516
+ " <th>8</th>\n",
517
+ " <td>orca-2-13b</td>\n",
518
+ " <td>1.15</td>\n",
519
+ " <td>0.950000</td>\n",
520
+ " <td>0.961115</td>\n",
521
+ " <td>0.955525</td>\n",
522
+ " <td>291.610</td>\n",
523
+ " <td>514</td>\n",
524
+ " <td>1.763</td>\n",
525
+ " </tr>\n",
526
+ " <tr>\n",
527
+ " <th>9</th>\n",
528
+ " <td>llama-2-13b</td>\n",
529
+ " <td>1.05</td>\n",
530
+ " <td>0.900000</td>\n",
531
+ " <td>0.962428</td>\n",
532
+ " <td>0.930168</td>\n",
533
+ " <td>369.084</td>\n",
534
+ " <td>677</td>\n",
535
+ " <td>1.834</td>\n",
536
+ " </tr>\n",
537
+ " <tr>\n",
538
+ " <th>10</th>\n",
539
+ " <td>llama-2-13b</td>\n",
540
+ " <td>1.10</td>\n",
541
+ " <td>0.875000</td>\n",
542
+ " <td>0.967267</td>\n",
543
+ " <td>0.918823</td>\n",
544
+ " <td>505.816</td>\n",
545
+ " <td>881</td>\n",
546
+ " <td>1.742</td>\n",
547
+ " </tr>\n",
548
+ " <tr>\n",
549
+ " <th>11</th>\n",
550
+ " <td>llama-2-13b</td>\n",
551
+ " <td>1.15</td>\n",
552
+ " <td>0.944444</td>\n",
553
+ " <td>0.964647</td>\n",
554
+ " <td>0.954439</td>\n",
555
+ " <td>435.429</td>\n",
556
+ " <td>777</td>\n",
557
+ " <td>1.784</td>\n",
558
+ " </tr>\n",
559
+ " <tr>\n",
560
+ " <th>12</th>\n",
561
+ " <td>gpt-3.5-turbo</td>\n",
562
+ " <td></td>\n",
563
+ " <td>0.958333</td>\n",
564
+ " <td>0.483574</td>\n",
565
+ " <td>0.642795</td>\n",
566
+ " <td>13.232</td>\n",
567
+ " <td>425</td>\n",
568
+ " <td>32.119</td>\n",
569
+ " </tr>\n",
570
+ " <tr>\n",
571
+ " <th>13</th>\n",
572
+ " <td>gpt-3.5-turbo-instruct</td>\n",
573
+ " <td></td>\n",
574
+ " <td>0.837302</td>\n",
575
+ " <td>0.952711</td>\n",
576
+ " <td>0.891286</td>\n",
577
+ " <td>10.360</td>\n",
578
+ " <td>411</td>\n",
579
+ " <td>39.673</td>\n",
580
+ " </tr>\n",
581
+ " <tr>\n",
582
+ " <th>14</th>\n",
583
+ " <td>gpt-4</td>\n",
584
+ " <td></td>\n",
585
+ " <td>1.000000</td>\n",
586
+ " <td>0.701869</td>\n",
587
+ " <td>0.824822</td>\n",
588
+ " <td>42.257</td>\n",
589
+ " <td>670</td>\n",
590
+ " <td>15.855</td>\n",
591
+ " </tr>\n",
592
+ " </tbody>\n",
593
+ "</table>\n",
594
+ "</div>"
595
+ ],
596
+ "text/plain": [
597
+ " model_name repetition_penalty faithfulness answer_relevancy \\\n",
598
+ "0 orca-2-7b 1.05 0.830357 0.978324 \n",
599
+ "1 orca-2-7b 1.10 0.750000 0.974817 \n",
600
+ "2 orca-2-7b 1.15 1.000000 0.973278 \n",
601
+ "3 llama-2-7b 1.05 0.875000 0.715099 \n",
602
+ "4 llama-2-7b 1.10 0.879630 0.731304 \n",
603
+ "5 llama-2-7b 1.15 1.000000 0.711172 \n",
604
+ "6 orca-2-13b 1.05 1.000000 0.987592 \n",
605
+ "7 orca-2-13b 1.10 1.000000 0.960806 \n",
606
+ "8 orca-2-13b 1.15 0.950000 0.961115 \n",
607
+ "9 llama-2-13b 1.05 0.900000 0.962428 \n",
608
+ "10 llama-2-13b 1.10 0.875000 0.967267 \n",
609
+ "11 llama-2-13b 1.15 0.944444 0.964647 \n",
610
+ "12 gpt-3.5-turbo 0.958333 0.483574 \n",
611
+ "13 gpt-3.5-turbo-instruct 0.837302 0.952711 \n",
612
+ "14 gpt-4 1.000000 0.701869 \n",
613
+ "\n",
614
+ " overall_score total_time_used num_tokens_generated token_per_second \n",
615
+ "0 0.898288 46.121 536 11.622 \n",
616
+ "1 0.847757 20.195 652 32.286 \n",
617
+ "2 0.986458 13.672 454 33.208 \n",
618
+ "3 0.787010 19.468 679 34.878 \n",
619
+ "4 0.798638 21.670 759 35.026 \n",
620
+ "5 0.831210 22.604 803 35.524 \n",
621
+ "6 0.993757 397.548 641 1.612 \n",
622
+ "7 0.980011 272.891 478 1.752 \n",
623
+ "8 0.955525 291.610 514 1.763 \n",
624
+ "9 0.930168 369.084 677 1.834 \n",
625
+ "10 0.918823 505.816 881 1.742 \n",
626
+ "11 0.954439 435.429 777 1.784 \n",
627
+ "12 0.642795 13.232 425 32.119 \n",
628
+ "13 0.891286 10.360 411 39.673 \n",
629
+ "14 0.824822 42.257 670 15.855 "
630
+ ]
631
+ },
632
+ "execution_count": 4,
633
+ "metadata": {},
634
+ "output_type": "execute_result"
635
+ }
636
+ ],
637
+ "source": [
638
+ "perf_pd"
639
+ ]
640
+ },
641
+ {
642
+ "cell_type": "code",
643
+ "execution_count": 5,
644
+ "metadata": {},
645
+ "outputs": [
646
+ {
647
+ "data": {
648
+ "text/html": [
649
+ "<div>\n",
650
+ "<style scoped>\n",
651
+ " .dataframe tbody tr th:only-of-type {\n",
652
+ " vertical-align: middle;\n",
653
+ " }\n",
654
+ "\n",
655
+ " .dataframe tbody tr th {\n",
656
+ " vertical-align: top;\n",
657
+ " }\n",
658
+ "\n",
659
+ " .dataframe thead th {\n",
660
+ " text-align: right;\n",
661
+ " }\n",
662
+ "</style>\n",
663
+ "<table border=\"1\" class=\"dataframe\">\n",
664
+ " <thead>\n",
665
+ " <tr style=\"text-align: right;\">\n",
666
+ " <th></th>\n",
667
+ " <th>model_name</th>\n",
668
+ " <th>repetition_penalty</th>\n",
669
+ " <th>user_question</th>\n",
670
+ " <th>standalone_question</th>\n",
671
+ " <th>contexts</th>\n",
672
+ " <th>answer</th>\n",
673
+ " </tr>\n",
674
+ " </thead>\n",
675
+ " <tbody>\n",
676
+ " <tr>\n",
677
+ " <th>0</th>\n",
678
+ " <td>orca-2-7b</td>\n",
679
+ " <td>1.05</td>\n",
680
+ " <td>What's PCI DSS?</td>\n",
681
+ " <td></td>\n",
682
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
683
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
684
+ " </tr>\n",
685
+ " <tr>\n",
686
+ " <th>1</th>\n",
687
+ " <td>orca-2-7b</td>\n",
688
+ " <td>1.05</td>\n",
689
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
690
+ " <td>What are the main differences between PCI DSS ...</td>\n",
691
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
692
+ " <td>The main differences between PCI DSS version 3...</td>\n",
693
+ " </tr>\n",
694
+ " <tr>\n",
695
+ " <th>2</th>\n",
696
+ " <td>orca-2-7b</td>\n",
697
+ " <td>1.05</td>\n",
698
+ " <td>new requirements for vulnerability assessments</td>\n",
699
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
700
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
701
+ " <td>The new requirements for vulnerability assessm...</td>\n",
702
+ " </tr>\n",
703
+ " <tr>\n",
704
+ " <th>3</th>\n",
705
+ " <td>orca-2-7b</td>\n",
706
+ " <td>1.05</td>\n",
707
+ " <td>more on penetration testing</td>\n",
708
+ " <td>What are the new requirements for penetration ...</td>\n",
709
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
710
+ " <td>The new requirements for penetration testing i...</td>\n",
711
+ " </tr>\n",
712
+ " <tr>\n",
713
+ " <th>4</th>\n",
714
+ " <td>orca-2-7b</td>\n",
715
+ " <td>1.10</td>\n",
716
+ " <td>What's PCI DSS?</td>\n",
717
+ " <td></td>\n",
718
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
719
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
720
+ " </tr>\n",
721
+ " <tr>\n",
722
+ " <th>5</th>\n",
723
+ " <td>orca-2-7b</td>\n",
724
+ " <td>1.10</td>\n",
725
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
726
+ " <td>What are the main differences between PCI DSS ...</td>\n",
727
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
728
+ " <td>The main differences between PCI DSS versions ...</td>\n",
729
+ " </tr>\n",
730
+ " <tr>\n",
731
+ " <th>6</th>\n",
732
+ " <td>orca-2-7b</td>\n",
733
+ " <td>1.10</td>\n",
734
+ " <td>new requirements for vulnerability assessments</td>\n",
735
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
736
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
737
+ " <td>There are several new requirements related to ...</td>\n",
738
+ " </tr>\n",
739
+ " <tr>\n",
740
+ " <th>7</th>\n",
741
+ " <td>orca-2-7b</td>\n",
742
+ " <td>1.10</td>\n",
743
+ " <td>more on penetration testing</td>\n",
744
+ " <td>What are some key differences between penetrat...</td>\n",
745
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
746
+ " <td>Some key differences between penetration testi...</td>\n",
747
+ " </tr>\n",
748
+ " <tr>\n",
749
+ " <th>8</th>\n",
750
+ " <td>orca-2-7b</td>\n",
751
+ " <td>1.15</td>\n",
752
+ " <td>What's PCI DSS?</td>\n",
753
+ " <td></td>\n",
754
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
755
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
756
+ " </tr>\n",
757
+ " <tr>\n",
758
+ " <th>9</th>\n",
759
+ " <td>orca-2-7b</td>\n",
760
+ " <td>1.15</td>\n",
761
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
762
+ " <td>How has the latest version of PCI DSS, version...</td>\n",
763
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
764
+ " <td>The latest version of PCI DSS, version 4.0, di...</td>\n",
765
+ " </tr>\n",
766
+ " <tr>\n",
767
+ " <th>10</th>\n",
768
+ " <td>orca-2-7b</td>\n",
769
+ " <td>1.15</td>\n",
770
+ " <td>new requirements for vulnerability assessments</td>\n",
771
+ " <td>What are some new requirements for vulnerabili...</td>\n",
772
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
773
+ " <td>Some new requirements for vulnerability assess...</td>\n",
774
+ " </tr>\n",
775
+ " <tr>\n",
776
+ " <th>11</th>\n",
777
+ " <td>orca-2-7b</td>\n",
778
+ " <td>1.15</td>\n",
779
+ " <td>more on penetration testing</td>\n",
780
+ " <td>What are some best practices for conducting ef...</td>\n",
781
+ " <td>[methodology examined for this testing \\nproc...</td>\n",
782
+ " <td>Some best practices for conducting effective p...</td>\n",
783
+ " </tr>\n",
784
+ " <tr>\n",
785
+ " <th>12</th>\n",
786
+ " <td>llama-2-7b</td>\n",
787
+ " <td>1.05</td>\n",
788
+ " <td>What's PCI DSS?</td>\n",
789
+ " <td></td>\n",
790
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
791
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
792
+ " </tr>\n",
793
+ " <tr>\n",
794
+ " <th>13</th>\n",
795
+ " <td>llama-2-7b</td>\n",
796
+ " <td>1.05</td>\n",
797
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
798
+ " <td>What are the key changes made in PCI DSS versi...</td>\n",
799
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
800
+ " <td>Based on the provided document, the key chang...</td>\n",
801
+ " </tr>\n",
802
+ " <tr>\n",
803
+ " <th>14</th>\n",
804
+ " <td>llama-2-7b</td>\n",
805
+ " <td>1.05</td>\n",
806
+ " <td>new requirements for vulnerability assessments</td>\n",
807
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
808
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
809
+ " <td>According to the provided summary of changes,...</td>\n",
810
+ " </tr>\n",
811
+ " <tr>\n",
812
+ " <th>15</th>\n",
813
+ " <td>llama-2-7b</td>\n",
814
+ " <td>1.05</td>\n",
815
+ " <td>more on penetration testing</td>\n",
816
+ " <td>What are the new requirements for penetration ...</td>\n",
817
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
818
+ " <td>The new requirement for penetration testing i...</td>\n",
819
+ " </tr>\n",
820
+ " <tr>\n",
821
+ " <th>16</th>\n",
822
+ " <td>llama-2-7b</td>\n",
823
+ " <td>1.10</td>\n",
824
+ " <td>What's PCI DSS?</td>\n",
825
+ " <td></td>\n",
826
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
827
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
828
+ " </tr>\n",
829
+ " <tr>\n",
830
+ " <th>17</th>\n",
831
+ " <td>llama-2-7b</td>\n",
832
+ " <td>1.10</td>\n",
833
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
834
+ " <td>What are the key changes made in PCI DSS versi...</td>\n",
835
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
836
+ " <td>The key changes made in PCI DSS version 4.0 co...</td>\n",
837
+ " </tr>\n",
838
+ " <tr>\n",
839
+ " <th>18</th>\n",
840
+ " <td>llama-2-7b</td>\n",
841
+ " <td>1.10</td>\n",
842
+ " <td>new requirements for vulnerability assessments</td>\n",
843
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
844
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
845
+ " <td>The new requirement for vulnerability assessme...</td>\n",
846
+ " </tr>\n",
847
+ " <tr>\n",
848
+ " <th>19</th>\n",
849
+ " <td>llama-2-7b</td>\n",
850
+ " <td>1.10</td>\n",
851
+ " <td>more on penetration testing</td>\n",
852
+ " <td>What are the new requirements for penetration ...</td>\n",
853
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
854
+ " <td>The new requirements for penetration testing i...</td>\n",
855
+ " </tr>\n",
856
+ " <tr>\n",
857
+ " <th>20</th>\n",
858
+ " <td>llama-2-7b</td>\n",
859
+ " <td>1.15</td>\n",
860
+ " <td>What's PCI DSS?</td>\n",
861
+ " <td></td>\n",
862
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
863
+ " <td>According to the given quick reference guide, ...</td>\n",
864
+ " </tr>\n",
865
+ " <tr>\n",
866
+ " <th>21</th>\n",
867
+ " <td>llama-2-7b</td>\n",
868
+ " <td>1.15</td>\n",
869
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
870
+ " <td>What are the key changes between PCI DSS versi...</td>\n",
871
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
872
+ " <td>The document highlights several significant mo...</td>\n",
873
+ " </tr>\n",
874
+ " <tr>\n",
875
+ " <th>22</th>\n",
876
+ " <td>llama-2-7b</td>\n",
877
+ " <td>1.15</td>\n",
878
+ " <td>new requirements for vulnerability assessments</td>\n",
879
+ " <td>What are some of the new requirements for vuln...</td>\n",
880
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
881
+ " <td>According to the provided documents, one of th...</td>\n",
882
+ " </tr>\n",
883
+ " <tr>\n",
884
+ " <th>23</th>\n",
885
+ " <td>llama-2-7b</td>\n",
886
+ " <td>1.15</td>\n",
887
+ " <td>more on penetration testing</td>\n",
888
+ " <td>Could you explain what penetration testing ent...</td>\n",
889
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
890
+ " <td>Sure! Penetration testing is a crucial compone...</td>\n",
891
+ " </tr>\n",
892
+ " <tr>\n",
893
+ " <th>24</th>\n",
894
+ " <td>orca-2-13b</td>\n",
895
+ " <td>1.05</td>\n",
896
+ " <td>What's PCI DSS?</td>\n",
897
+ " <td></td>\n",
898
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
899
+ " <td>PCI DSS is a global standard that provides a b...</td>\n",
900
+ " </tr>\n",
901
+ " <tr>\n",
902
+ " <th>25</th>\n",
903
+ " <td>orca-2-13b</td>\n",
904
+ " <td>1.05</td>\n",
905
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
906
+ " <td>¿Puedes resumir los cambios realizados desde l...</td>\n",
907
+ " <td>[April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi...</td>\n",
908
+ " <td>Sí, puedo resumir los cambios realizados desde...</td>\n",
909
+ " </tr>\n",
910
+ " <tr>\n",
911
+ " <th>26</th>\n",
912
+ " <td>orca-2-13b</td>\n",
913
+ " <td>1.05</td>\n",
914
+ " <td>new requirements for vulnerability assessments</td>\n",
915
+ " <td>¿Cuáles son las nuevas requisitos para las eva...</td>\n",
916
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
917
+ " <td>Las nuevas requisitos para las evaluaciones de...</td>\n",
918
+ " </tr>\n",
919
+ " <tr>\n",
920
+ " <th>27</th>\n",
921
+ " <td>orca-2-13b</td>\n",
922
+ " <td>1.05</td>\n",
923
+ " <td>more on penetration testing</td>\n",
924
+ " <td>¿Puedes dar más detalles sobre las prácticas d...</td>\n",
925
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
926
+ " <td>Sí, puedo dar más detalles sobre las prácticas...</td>\n",
927
+ " </tr>\n",
928
+ " <tr>\n",
929
+ " <th>28</th>\n",
930
+ " <td>orca-2-13b</td>\n",
931
+ " <td>1.10</td>\n",
932
+ " <td>What's PCI DSS?</td>\n",
933
+ " <td></td>\n",
934
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
935
+ " <td>PCI DSS is a set of requirements designed to p...</td>\n",
936
+ " </tr>\n",
937
+ " <tr>\n",
938
+ " <th>29</th>\n",
939
+ " <td>orca-2-13b</td>\n",
940
+ " <td>1.10</td>\n",
941
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
942
+ " <td>¿Puedes resumir los cambios realizados desde l...</td>\n",
943
+ " <td>[April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi...</td>\n",
944
+ " <td>Sí, puedo resumir los cambios realizados desde...</td>\n",
945
+ " </tr>\n",
946
+ " <tr>\n",
947
+ " <th>30</th>\n",
948
+ " <td>orca-2-13b</td>\n",
949
+ " <td>1.10</td>\n",
950
+ " <td>new requirements for vulnerability assessments</td>\n",
951
+ " <td>¿Cuáles son las nuevas exigencias para las eva...</td>\n",
952
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
953
+ " <td>Las nuevas exigencias para las evaluaciones de...</td>\n",
954
+ " </tr>\n",
955
+ " <tr>\n",
956
+ " <th>31</th>\n",
957
+ " <td>orca-2-13b</td>\n",
958
+ " <td>1.10</td>\n",
959
+ " <td>more on penetration testing</td>\n",
960
+ " <td>¿Puedo obtener más información sobre las prueb...</td>\n",
961
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
962
+ " <td>Yes, you can get more information about penetr...</td>\n",
963
+ " </tr>\n",
964
+ " <tr>\n",
965
+ " <th>32</th>\n",
966
+ " <td>orca-2-13b</td>\n",
967
+ " <td>1.15</td>\n",
968
+ " <td>What's PCI DSS?</td>\n",
969
+ " <td></td>\n",
970
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
971
+ " <td>PCI DSS is a set of requirements designed to p...</td>\n",
972
+ " </tr>\n",
973
+ " <tr>\n",
974
+ " <th>33</th>\n",
975
+ " <td>orca-2-13b</td>\n",
976
+ " <td>1.15</td>\n",
977
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
978
+ " <td>¿Puedes resumir los cambios realizados desde l...</td>\n",
979
+ " <td>[April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi...</td>\n",
980
+ " <td>Sí, puedo resumir los cambios realizados desde...</td>\n",
981
+ " </tr>\n",
982
+ " <tr>\n",
983
+ " <th>34</th>\n",
984
+ " <td>orca-2-13b</td>\n",
985
+ " <td>1.15</td>\n",
986
+ " <td>new requirements for vulnerability assessments</td>\n",
987
+ " <td>¿Cuáles son las nuevas recomendaciones para la...</td>\n",
988
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
989
+ " <td>Las nuevas recomendaciones para las evaluacion...</td>\n",
990
+ " </tr>\n",
991
+ " <tr>\n",
992
+ " <th>35</th>\n",
993
+ " <td>orca-2-13b</td>\n",
994
+ " <td>1.15</td>\n",
995
+ " <td>more on penetration testing</td>\n",
996
+ " <td>¿Puedes dar más información sobre las pruebas ...</td>\n",
997
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
998
+ " <td>Sí, puedo dar más información sobre las prueba...</td>\n",
999
+ " </tr>\n",
1000
+ " <tr>\n",
1001
+ " <th>36</th>\n",
1002
+ " <td>llama-2-13b</td>\n",
1003
+ " <td>1.05</td>\n",
1004
+ " <td>What's PCI DSS?</td>\n",
1005
+ " <td></td>\n",
1006
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
1007
+ " <td>PCI DSS is the Payment Card Industry Data Secu...</td>\n",
1008
+ " </tr>\n",
1009
+ " <tr>\n",
1010
+ " <th>37</th>\n",
1011
+ " <td>llama-2-13b</td>\n",
1012
+ " <td>1.05</td>\n",
1013
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
1014
+ " <td>What are the key changes between PCI DSS versi...</td>\n",
1015
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1016
+ " <td>What are the key changes between PCI DSS vers...</td>\n",
1017
+ " </tr>\n",
1018
+ " <tr>\n",
1019
+ " <th>38</th>\n",
1020
+ " <td>llama-2-13b</td>\n",
1021
+ " <td>1.05</td>\n",
1022
+ " <td>new requirements for vulnerability assessments</td>\n",
1023
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
1024
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1025
+ " <td>According to the provided document, there are ...</td>\n",
1026
+ " </tr>\n",
1027
+ " <tr>\n",
1028
+ " <th>39</th>\n",
1029
+ " <td>llama-2-13b</td>\n",
1030
+ " <td>1.05</td>\n",
1031
+ " <td>more on penetration testing</td>\n",
1032
+ " <td>What are the new requirements for penetration ...</td>\n",
1033
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
1034
+ " <td>Based on the provided information, the new re...</td>\n",
1035
+ " </tr>\n",
1036
+ " <tr>\n",
1037
+ " <th>40</th>\n",
1038
+ " <td>llama-2-13b</td>\n",
1039
+ " <td>1.10</td>\n",
1040
+ " <td>What's PCI DSS?</td>\n",
1041
+ " <td></td>\n",
1042
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
1043
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
1044
+ " </tr>\n",
1045
+ " <tr>\n",
1046
+ " <th>41</th>\n",
1047
+ " <td>llama-2-13b</td>\n",
1048
+ " <td>1.10</td>\n",
1049
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
1050
+ " <td>What are the key changes between PCI DSS versi...</td>\n",
1051
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1052
+ " <td>Based on the provided document, here are the ...</td>\n",
1053
+ " </tr>\n",
1054
+ " <tr>\n",
1055
+ " <th>42</th>\n",
1056
+ " <td>llama-2-13b</td>\n",
1057
+ " <td>1.10</td>\n",
1058
+ " <td>new requirements for vulnerability assessments</td>\n",
1059
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
1060
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1061
+ " <td>According to the provided document, there are...</td>\n",
1062
+ " </tr>\n",
1063
+ " <tr>\n",
1064
+ " <th>43</th>\n",
1065
+ " <td>llama-2-13b</td>\n",
1066
+ " <td>1.10</td>\n",
1067
+ " <td>more on penetration testing</td>\n",
1068
+ " <td>What are the new requirements for penetration ...</td>\n",
1069
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
1070
+ " <td>Based on the provided information, there are ...</td>\n",
1071
+ " </tr>\n",
1072
+ " <tr>\n",
1073
+ " <th>44</th>\n",
1074
+ " <td>llama-2-13b</td>\n",
1075
+ " <td>1.15</td>\n",
1076
+ " <td>What's PCI DSS?</td>\n",
1077
+ " <td></td>\n",
1078
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
1079
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
1080
+ " </tr>\n",
1081
+ " <tr>\n",
1082
+ " <th>45</th>\n",
1083
+ " <td>llama-2-13b</td>\n",
1084
+ " <td>1.15</td>\n",
1085
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
1086
+ " <td>What are the key changes between PCI DSS versi...</td>\n",
1087
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1088
+ " <td>Based on the provided document, here are some...</td>\n",
1089
+ " </tr>\n",
1090
+ " <tr>\n",
1091
+ " <th>46</th>\n",
1092
+ " <td>llama-2-13b</td>\n",
1093
+ " <td>1.15</td>\n",
1094
+ " <td>new requirements for vulnerability assessments</td>\n",
1095
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
1096
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1097
+ " <td>According to the provided document, there are...</td>\n",
1098
+ " </tr>\n",
1099
+ " <tr>\n",
1100
+ " <th>47</th>\n",
1101
+ " <td>llama-2-13b</td>\n",
1102
+ " <td>1.15</td>\n",
1103
+ " <td>more on penetration testing</td>\n",
1104
+ " <td>What are the new requirements for penetration ...</td>\n",
1105
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
1106
+ " <td>Based on the provided information, there are ...</td>\n",
1107
+ " </tr>\n",
1108
+ " <tr>\n",
1109
+ " <th>48</th>\n",
1110
+ " <td>gpt-3.5-turbo</td>\n",
1111
+ " <td></td>\n",
1112
+ " <td>What's PCI DSS?</td>\n",
1113
+ " <td></td>\n",
1114
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
1115
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
1116
+ " </tr>\n",
1117
+ " <tr>\n",
1118
+ " <th>49</th>\n",
1119
+ " <td>gpt-3.5-turbo</td>\n",
1120
+ " <td></td>\n",
1121
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
1122
+ " <td>What are the differences between PCI DSS versi...</td>\n",
1123
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1124
+ " <td>The document provided does not specify the spe...</td>\n",
1125
+ " </tr>\n",
1126
+ " <tr>\n",
1127
+ " <th>50</th>\n",
1128
+ " <td>gpt-3.5-turbo</td>\n",
1129
+ " <td></td>\n",
1130
+ " <td>new requirements for vulnerability assessments</td>\n",
1131
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
1132
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1133
+ " <td>In PCI DSS version 4.0, there are several new ...</td>\n",
1134
+ " </tr>\n",
1135
+ " <tr>\n",
1136
+ " <th>51</th>\n",
1137
+ " <td>gpt-3.5-turbo</td>\n",
1138
+ " <td></td>\n",
1139
+ " <td>more on penetration testing</td>\n",
1140
+ " <td>Can you provide more information about the cha...</td>\n",
1141
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1142
+ " <td>I'm sorry, but I don't have access to the spec...</td>\n",
1143
+ " </tr>\n",
1144
+ " <tr>\n",
1145
+ " <th>52</th>\n",
1146
+ " <td>gpt-3.5-turbo-instruct</td>\n",
1147
+ " <td></td>\n",
1148
+ " <td>What's PCI DSS?</td>\n",
1149
+ " <td></td>\n",
1150
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
1151
+ " <td>The PCI Data Security Standard (PCI DSS) is a...</td>\n",
1152
+ " </tr>\n",
1153
+ " <tr>\n",
1154
+ " <th>53</th>\n",
1155
+ " <td>gpt-3.5-turbo-instruct</td>\n",
1156
+ " <td></td>\n",
1157
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
1158
+ " <td>What changes were made from PCI DSS version 3...</td>\n",
1159
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1160
+ " <td>The changes made from PCI DSS version 3.2.1 t...</td>\n",
1161
+ " </tr>\n",
1162
+ " <tr>\n",
1163
+ " <th>54</th>\n",
1164
+ " <td>gpt-3.5-turbo-instruct</td>\n",
1165
+ " <td></td>\n",
1166
+ " <td>new requirements for vulnerability assessments</td>\n",
1167
+ " <td>What are the new requirements for vulnerabili...</td>\n",
1168
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1169
+ " <td>The new requirements for vulnerability assess...</td>\n",
1170
+ " </tr>\n",
1171
+ " <tr>\n",
1172
+ " <th>55</th>\n",
1173
+ " <td>gpt-3.5-turbo-instruct</td>\n",
1174
+ " <td></td>\n",
1175
+ " <td>more on penetration testing</td>\n",
1176
+ " <td>Can you provide more information about the ne...</td>\n",
1177
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
1178
+ " <td>The new requirements for penetration testing ...</td>\n",
1179
+ " </tr>\n",
1180
+ " <tr>\n",
1181
+ " <th>56</th>\n",
1182
+ " <td>gpt-4</td>\n",
1183
+ " <td></td>\n",
1184
+ " <td>What's PCI DSS?</td>\n",
1185
+ " <td></td>\n",
1186
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
1187
+ " <td>The PCI Data Security Standard (PCI DSS) is a ...</td>\n",
1188
+ " </tr>\n",
1189
+ " <tr>\n",
1190
+ " <th>57</th>\n",
1191
+ " <td>gpt-4</td>\n",
1192
+ " <td></td>\n",
1193
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
1194
+ " <td>Can you provide a summary of the changes that ...</td>\n",
1195
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1196
+ " <td>I'm sorry, but the provided context does not i...</td>\n",
1197
+ " </tr>\n",
1198
+ " <tr>\n",
1199
+ " <th>58</th>\n",
1200
+ " <td>gpt-4</td>\n",
1201
+ " <td></td>\n",
1202
+ " <td>new requirements for vulnerability assessments</td>\n",
1203
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
1204
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
1205
+ " <td>The new requirements for vulnerability assessm...</td>\n",
1206
+ " </tr>\n",
1207
+ " <tr>\n",
1208
+ " <th>59</th>\n",
1209
+ " <td>gpt-4</td>\n",
1210
+ " <td></td>\n",
1211
+ " <td>more on penetration testing</td>\n",
1212
+ " <td>Can you provide more information on penetratio...</td>\n",
1213
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
1214
+ " <td>Penetration testing in the context of PCI DSS ...</td>\n",
1215
+ " </tr>\n",
1216
+ " </tbody>\n",
1217
+ "</table>\n",
1218
+ "</div>"
1219
+ ],
1220
+ "text/plain": [
1221
+ " model_name repetition_penalty \\\n",
1222
+ "0 orca-2-7b 1.05 \n",
1223
+ "1 orca-2-7b 1.05 \n",
1224
+ "2 orca-2-7b 1.05 \n",
1225
+ "3 orca-2-7b 1.05 \n",
1226
+ "4 orca-2-7b 1.10 \n",
1227
+ "5 orca-2-7b 1.10 \n",
1228
+ "6 orca-2-7b 1.10 \n",
1229
+ "7 orca-2-7b 1.10 \n",
1230
+ "8 orca-2-7b 1.15 \n",
1231
+ "9 orca-2-7b 1.15 \n",
1232
+ "10 orca-2-7b 1.15 \n",
1233
+ "11 orca-2-7b 1.15 \n",
1234
+ "12 llama-2-7b 1.05 \n",
1235
+ "13 llama-2-7b 1.05 \n",
1236
+ "14 llama-2-7b 1.05 \n",
1237
+ "15 llama-2-7b 1.05 \n",
1238
+ "16 llama-2-7b 1.10 \n",
1239
+ "17 llama-2-7b 1.10 \n",
1240
+ "18 llama-2-7b 1.10 \n",
1241
+ "19 llama-2-7b 1.10 \n",
1242
+ "20 llama-2-7b 1.15 \n",
1243
+ "21 llama-2-7b 1.15 \n",
1244
+ "22 llama-2-7b 1.15 \n",
1245
+ "23 llama-2-7b 1.15 \n",
1246
+ "24 orca-2-13b 1.05 \n",
1247
+ "25 orca-2-13b 1.05 \n",
1248
+ "26 orca-2-13b 1.05 \n",
1249
+ "27 orca-2-13b 1.05 \n",
1250
+ "28 orca-2-13b 1.10 \n",
1251
+ "29 orca-2-13b 1.10 \n",
1252
+ "30 orca-2-13b 1.10 \n",
1253
+ "31 orca-2-13b 1.10 \n",
1254
+ "32 orca-2-13b 1.15 \n",
1255
+ "33 orca-2-13b 1.15 \n",
1256
+ "34 orca-2-13b 1.15 \n",
1257
+ "35 orca-2-13b 1.15 \n",
1258
+ "36 llama-2-13b 1.05 \n",
1259
+ "37 llama-2-13b 1.05 \n",
1260
+ "38 llama-2-13b 1.05 \n",
1261
+ "39 llama-2-13b 1.05 \n",
1262
+ "40 llama-2-13b 1.10 \n",
1263
+ "41 llama-2-13b 1.10 \n",
1264
+ "42 llama-2-13b 1.10 \n",
1265
+ "43 llama-2-13b 1.10 \n",
1266
+ "44 llama-2-13b 1.15 \n",
1267
+ "45 llama-2-13b 1.15 \n",
1268
+ "46 llama-2-13b 1.15 \n",
1269
+ "47 llama-2-13b 1.15 \n",
1270
+ "48 gpt-3.5-turbo \n",
1271
+ "49 gpt-3.5-turbo \n",
1272
+ "50 gpt-3.5-turbo \n",
1273
+ "51 gpt-3.5-turbo \n",
1274
+ "52 gpt-3.5-turbo-instruct \n",
1275
+ "53 gpt-3.5-turbo-instruct \n",
1276
+ "54 gpt-3.5-turbo-instruct \n",
1277
+ "55 gpt-3.5-turbo-instruct \n",
1278
+ "56 gpt-4 \n",
1279
+ "57 gpt-4 \n",
1280
+ "58 gpt-4 \n",
1281
+ "59 gpt-4 \n",
1282
+ "\n",
1283
+ " user_question \\\n",
1284
+ "0 What's PCI DSS? \n",
1285
+ "1 Can you summarize the changes made from PCI DS... \n",
1286
+ "2 new requirements for vulnerability assessments \n",
1287
+ "3 more on penetration testing \n",
1288
+ "4 What's PCI DSS? \n",
1289
+ "5 Can you summarize the changes made from PCI DS... \n",
1290
+ "6 new requirements for vulnerability assessments \n",
1291
+ "7 more on penetration testing \n",
1292
+ "8 What's PCI DSS? \n",
1293
+ "9 Can you summarize the changes made from PCI DS... \n",
1294
+ "10 new requirements for vulnerability assessments \n",
1295
+ "11 more on penetration testing \n",
1296
+ "12 What's PCI DSS? \n",
1297
+ "13 Can you summarize the changes made from PCI DS... \n",
1298
+ "14 new requirements for vulnerability assessments \n",
1299
+ "15 more on penetration testing \n",
1300
+ "16 What's PCI DSS? \n",
1301
+ "17 Can you summarize the changes made from PCI DS... \n",
1302
+ "18 new requirements for vulnerability assessments \n",
1303
+ "19 more on penetration testing \n",
1304
+ "20 What's PCI DSS? \n",
1305
+ "21 Can you summarize the changes made from PCI DS... \n",
1306
+ "22 new requirements for vulnerability assessments \n",
1307
+ "23 more on penetration testing \n",
1308
+ "24 What's PCI DSS? \n",
1309
+ "25 Can you summarize the changes made from PCI DS... \n",
1310
+ "26 new requirements for vulnerability assessments \n",
1311
+ "27 more on penetration testing \n",
1312
+ "28 What's PCI DSS? \n",
1313
+ "29 Can you summarize the changes made from PCI DS... \n",
1314
+ "30 new requirements for vulnerability assessments \n",
1315
+ "31 more on penetration testing \n",
1316
+ "32 What's PCI DSS? \n",
1317
+ "33 Can you summarize the changes made from PCI DS... \n",
1318
+ "34 new requirements for vulnerability assessments \n",
1319
+ "35 more on penetration testing \n",
1320
+ "36 What's PCI DSS? \n",
1321
+ "37 Can you summarize the changes made from PCI DS... \n",
1322
+ "38 new requirements for vulnerability assessments \n",
1323
+ "39 more on penetration testing \n",
1324
+ "40 What's PCI DSS? \n",
1325
+ "41 Can you summarize the changes made from PCI DS... \n",
1326
+ "42 new requirements for vulnerability assessments \n",
1327
+ "43 more on penetration testing \n",
1328
+ "44 What's PCI DSS? \n",
1329
+ "45 Can you summarize the changes made from PCI DS... \n",
1330
+ "46 new requirements for vulnerability assessments \n",
1331
+ "47 more on penetration testing \n",
1332
+ "48 What's PCI DSS? \n",
1333
+ "49 Can you summarize the changes made from PCI DS... \n",
1334
+ "50 new requirements for vulnerability assessments \n",
1335
+ "51 more on penetration testing \n",
1336
+ "52 What's PCI DSS? \n",
1337
+ "53 Can you summarize the changes made from PCI DS... \n",
1338
+ "54 new requirements for vulnerability assessments \n",
1339
+ "55 more on penetration testing \n",
1340
+ "56 What's PCI DSS? \n",
1341
+ "57 Can you summarize the changes made from PCI DS... \n",
1342
+ "58 new requirements for vulnerability assessments \n",
1343
+ "59 more on penetration testing \n",
1344
+ "\n",
1345
+ " standalone_question \\\n",
1346
+ "0 \n",
1347
+ "1 What are the main differences between PCI DSS ... \n",
1348
+ "2 What are the new requirements for vulnerabilit... \n",
1349
+ "3 What are the new requirements for penetration ... \n",
1350
+ "4 \n",
1351
+ "5 What are the main differences between PCI DSS ... \n",
1352
+ "6 What are the new requirements for vulnerabilit... \n",
1353
+ "7 What are some key differences between penetrat... \n",
1354
+ "8 \n",
1355
+ "9 How has the latest version of PCI DSS, version... \n",
1356
+ "10 What are some new requirements for vulnerabili... \n",
1357
+ "11 What are some best practices for conducting ef... \n",
1358
+ "12 \n",
1359
+ "13 What are the key changes made in PCI DSS versi... \n",
1360
+ "14 What are the new requirements for vulnerabilit... \n",
1361
+ "15 What are the new requirements for penetration ... \n",
1362
+ "16 \n",
1363
+ "17 What are the key changes made in PCI DSS versi... \n",
1364
+ "18 What are the new requirements for vulnerabilit... \n",
1365
+ "19 What are the new requirements for penetration ... \n",
1366
+ "20 \n",
1367
+ "21 What are the key changes between PCI DSS versi... \n",
1368
+ "22 What are some of the new requirements for vuln... \n",
1369
+ "23 Could you explain what penetration testing ent... \n",
1370
+ "24 \n",
1371
+ "25 ¿Puedes resumir los cambios realizados desde l... \n",
1372
+ "26 ¿Cuáles son las nuevas requisitos para las eva... \n",
1373
+ "27 ¿Puedes dar más detalles sobre las prácticas d... \n",
1374
+ "28 \n",
1375
+ "29 ¿Puedes resumir los cambios realizados desde l... \n",
1376
+ "30 ¿Cuáles son las nuevas exigencias para las eva... \n",
1377
+ "31 ¿Puedo obtener más información sobre las prueb... \n",
1378
+ "32 \n",
1379
+ "33 ¿Puedes resumir los cambios realizados desde l... \n",
1380
+ "34 ¿Cuáles son las nuevas recomendaciones para la... \n",
1381
+ "35 ¿Puedes dar más información sobre las pruebas ... \n",
1382
+ "36 \n",
1383
+ "37 What are the key changes between PCI DSS versi... \n",
1384
+ "38 What are the new requirements for vulnerabilit... \n",
1385
+ "39 What are the new requirements for penetration ... \n",
1386
+ "40 \n",
1387
+ "41 What are the key changes between PCI DSS versi... \n",
1388
+ "42 What are the new requirements for vulnerabilit... \n",
1389
+ "43 What are the new requirements for penetration ... \n",
1390
+ "44 \n",
1391
+ "45 What are the key changes between PCI DSS versi... \n",
1392
+ "46 What are the new requirements for vulnerabilit... \n",
1393
+ "47 What are the new requirements for penetration ... \n",
1394
+ "48 \n",
1395
+ "49 What are the differences between PCI DSS versi... \n",
1396
+ "50 What are the new requirements for vulnerabilit... \n",
1397
+ "51 Can you provide more information about the cha... \n",
1398
+ "52 \n",
1399
+ "53 What changes were made from PCI DSS version 3... \n",
1400
+ "54 What are the new requirements for vulnerabili... \n",
1401
+ "55 Can you provide more information about the ne... \n",
1402
+ "56 \n",
1403
+ "57 Can you provide a summary of the changes that ... \n",
1404
+ "58 What are the new requirements for vulnerabilit... \n",
1405
+ "59 Can you provide more information on penetratio... \n",
1406
+ "\n",
1407
+ " contexts \\\n",
1408
+ "0 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1409
+ "1 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1410
+ "2 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1411
+ "3 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1412
+ "4 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1413
+ "5 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1414
+ "6 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1415
+ "7 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1416
+ "8 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1417
+ "9 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1418
+ "10 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1419
+ "11 [methodology examined for this testing \\nproc... \n",
1420
+ "12 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1421
+ "13 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1422
+ "14 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1423
+ "15 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1424
+ "16 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1425
+ "17 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1426
+ "18 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1427
+ "19 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1428
+ "20 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1429
+ "21 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1430
+ "22 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1431
+ "23 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1432
+ "24 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1433
+ "25 [April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi... \n",
1434
+ "26 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1435
+ "27 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1436
+ "28 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1437
+ "29 [April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi... \n",
1438
+ "30 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1439
+ "31 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1440
+ "32 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1441
+ "33 [April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi... \n",
1442
+ "34 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1443
+ "35 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1444
+ "36 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1445
+ "37 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1446
+ "38 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1447
+ "39 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1448
+ "40 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1449
+ "41 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1450
+ "42 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1451
+ "43 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1452
+ "44 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1453
+ "45 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1454
+ "46 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1455
+ "47 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1456
+ "48 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1457
+ "49 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1458
+ "50 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1459
+ "51 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1460
+ "52 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1461
+ "53 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1462
+ "54 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1463
+ "55 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1464
+ "56 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1465
+ "57 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1466
+ "58 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1467
+ "59 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1468
+ "\n",
1469
+ " answer \n",
1470
+ "0 PCI DSS stands for Payment Card Industry Data ... \n",
1471
+ "1 The main differences between PCI DSS version 3... \n",
1472
+ "2 The new requirements for vulnerability assessm... \n",
1473
+ "3 The new requirements for penetration testing i... \n",
1474
+ "4 PCI DSS stands for Payment Card Industry Data ... \n",
1475
+ "5 The main differences between PCI DSS versions ... \n",
1476
+ "6 There are several new requirements related to ... \n",
1477
+ "7 Some key differences between penetration testi... \n",
1478
+ "8 PCI DSS stands for Payment Card Industry Data ... \n",
1479
+ "9 The latest version of PCI DSS, version 4.0, di... \n",
1480
+ "10 Some new requirements for vulnerability assess... \n",
1481
+ "11 Some best practices for conducting effective p... \n",
1482
+ "12 PCI DSS stands for Payment Card Industry Data ... \n",
1483
+ "13 Based on the provided document, the key chang... \n",
1484
+ "14 According to the provided summary of changes,... \n",
1485
+ "15 The new requirement for penetration testing i... \n",
1486
+ "16 PCI DSS stands for Payment Card Industry Data ... \n",
1487
+ "17 The key changes made in PCI DSS version 4.0 co... \n",
1488
+ "18 The new requirement for vulnerability assessme... \n",
1489
+ "19 The new requirements for penetration testing i... \n",
1490
+ "20 According to the given quick reference guide, ... \n",
1491
+ "21 The document highlights several significant mo... \n",
1492
+ "22 According to the provided documents, one of th... \n",
1493
+ "23 Sure! Penetration testing is a crucial compone... \n",
1494
+ "24 PCI DSS is a global standard that provides a b... \n",
1495
+ "25 Sí, puedo resumir los cambios realizados desde... \n",
1496
+ "26 Las nuevas requisitos para las evaluaciones de... \n",
1497
+ "27 Sí, puedo dar más detalles sobre las prácticas... \n",
1498
+ "28 PCI DSS is a set of requirements designed to p... \n",
1499
+ "29 Sí, puedo resumir los cambios realizados desde... \n",
1500
+ "30 Las nuevas exigencias para las evaluaciones de... \n",
1501
+ "31 Yes, you can get more information about penetr... \n",
1502
+ "32 PCI DSS is a set of requirements designed to p... \n",
1503
+ "33 Sí, puedo resumir los cambios realizados desde... \n",
1504
+ "34 Las nuevas recomendaciones para las evaluacion... \n",
1505
+ "35 Sí, puedo dar más información sobre las prueba... \n",
1506
+ "36 PCI DSS is the Payment Card Industry Data Secu... \n",
1507
+ "37 What are the key changes between PCI DSS vers... \n",
1508
+ "38 According to the provided document, there are ... \n",
1509
+ "39 Based on the provided information, the new re... \n",
1510
+ "40 PCI DSS stands for Payment Card Industry Data ... \n",
1511
+ "41 Based on the provided document, here are the ... \n",
1512
+ "42 According to the provided document, there are... \n",
1513
+ "43 Based on the provided information, there are ... \n",
1514
+ "44 PCI DSS stands for Payment Card Industry Data ... \n",
1515
+ "45 Based on the provided document, here are some... \n",
1516
+ "46 According to the provided document, there are... \n",
1517
+ "47 Based on the provided information, there are ... \n",
1518
+ "48 PCI DSS stands for Payment Card Industry Data ... \n",
1519
+ "49 The document provided does not specify the spe... \n",
1520
+ "50 In PCI DSS version 4.0, there are several new ... \n",
1521
+ "51 I'm sorry, but I don't have access to the spec... \n",
1522
+ "52 The PCI Data Security Standard (PCI DSS) is a... \n",
1523
+ "53 The changes made from PCI DSS version 3.2.1 t... \n",
1524
+ "54 The new requirements for vulnerability assess... \n",
1525
+ "55 The new requirements for penetration testing ... \n",
1526
+ "56 The PCI Data Security Standard (PCI DSS) is a ... \n",
1527
+ "57 I'm sorry, but the provided context does not i... \n",
1528
+ "58 The new requirements for vulnerability assessm... \n",
1529
+ "59 Penetration testing in the context of PCI DSS ... "
1530
+ ]
1531
+ },
1532
+ "execution_count": 5,
1533
+ "metadata": {},
1534
+ "output_type": "execute_result"
1535
+ }
1536
+ ],
1537
+ "source": [
1538
+ "raw_pd"
1539
+ ]
1540
+ },
1541
+ {
1542
+ "cell_type": "code",
1543
+ "execution_count": 6,
1544
+ "metadata": {},
1545
+ "outputs": [],
1546
+ "source": [
1547
+ "raw_pd.to_excel(\"./results/raw_data.xlsx\", index=False)\n",
1548
+ "perf_pd.to_excel(\"./results/perf_data.xlsx\", index=False)"
1549
+ ]
1550
+ }
1551
+ ],
1552
+ "metadata": {
1553
+ "kernelspec": {
1554
+ "display_name": "Python 3 (ipykernel)",
1555
+ "language": "python",
1556
+ "name": "python3"
1557
+ },
1558
+ "language_info": {
1559
+ "codemirror_mode": {
1560
+ "name": "ipython",
1561
+ "version": 3
1562
+ },
1563
+ "file_extension": ".py",
1564
+ "mimetype": "text/x-python",
1565
+ "name": "python",
1566
+ "nbconvert_exporter": "python",
1567
+ "pygments_lexer": "ipython3",
1568
+ "version": "3.11.7"
1569
+ }
1570
+ },
1571
+ "nbformat": 4,
1572
+ "nbformat_minor": 4
1573
+ }
results/2_process-raw-data_nvidia-4080.ipynb ADDED
@@ -0,0 +1,1355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "workding dir: /home/inflaton/code/projects/chat-with-orca-2\n"
13
+ ]
14
+ }
15
+ ],
16
+ "source": [
17
+ "import os\n",
18
+ "import sys\n",
19
+ "from pathlib import Path\n",
20
+ "\n",
21
+ "workding_dir = str(Path.cwd().parent)\n",
22
+ "os.chdir(workding_dir)\n",
23
+ "sys.path.append(workding_dir)\n",
24
+ "print(\"workding dir:\", workding_dir)"
25
+ ]
26
+ },
27
+ {
28
+ "cell_type": "code",
29
+ "execution_count": 2,
30
+ "metadata": {},
31
+ "outputs": [
32
+ {
33
+ "name": "stderr",
34
+ "output_type": "stream",
35
+ "text": [
36
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
37
+ " from .autonotebook import tqdm as notebook_tqdm\n"
38
+ ]
39
+ },
40
+ {
41
+ "name": "stdout",
42
+ "output_type": "stream",
43
+ "text": [
44
+ "loading env vars from: /home/inflaton/code/projects/chat-with-orca-2/.env\n",
45
+ "Running on: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35\n",
46
+ "MPS is NOT available\n",
47
+ "CUDA is available\n",
48
+ "MPS not available because the current PyTorch install was not built with MPS enabled.\n",
49
+ "CUDA is available, we have found 1 GPU(s)\n",
50
+ "NVIDIA GeForce RTX 4080 Laptop GPU\n",
51
+ "CUDA version: 12.1\n",
52
+ "hf_embeddings_device_type: cuda:0\n",
53
+ "hf_pipeline_device_type: cuda:0\n",
54
+ "load INSTRUCTOR_Transformer\n"
55
+ ]
56
+ },
57
+ {
58
+ "name": "stderr",
59
+ "output_type": "stream",
60
+ "text": [
61
+ "/home/inflaton/miniconda3/envs/chat-with-orca-2/lib/python3.11/site-packages/torch/_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()\n",
62
+ " return self.fget.__get__(instance, owner)()\n"
63
+ ]
64
+ },
65
+ {
66
+ "name": "stdout",
67
+ "output_type": "stream",
68
+ "text": [
69
+ "max_seq_length 512\n",
70
+ "Completed in 0.638s\n",
71
+ "Load index from ./data/faiss_1024_512/ with FAISS\n",
72
+ "Completed in 0.020s\n",
73
+ "initializing LLM: openai\n",
74
+ " hf_pipeline_device_type: cuda:0\n",
75
+ " load_quantized_model: None\n",
76
+ " torch_dtype: torch.float16\n",
77
+ " n_threds: 4\n",
78
+ " using model: gpt-3.5-turbo\n",
79
+ "initialization complete\n",
80
+ "Completed in 0.028s\n",
81
+ "CPU times: user 6.16 s, sys: 4.73 s, total: 10.9 s\n",
82
+ "Wall time: 3.62 s\n"
83
+ ]
84
+ }
85
+ ],
86
+ "source": [
87
+ "%%time\n",
88
+ "\n",
89
+ "os.environ[\"LLM_MODEL_TYPE\"] = \"openai\"\n",
90
+ "from eval_models import *"
91
+ ]
92
+ },
93
+ {
94
+ "cell_type": "code",
95
+ "execution_count": 3,
96
+ "metadata": {},
97
+ "outputs": [
98
+ {
99
+ "name": "stdout",
100
+ "output_type": "stream",
101
+ "text": [
102
+ "loading: ./notebook/nvidia-4080-llama-2-7b.ipynb\n",
103
+ "processing repetition_penalty: 1.05\n",
104
+ "processing repetition_penalty: 1.10\n",
105
+ "processing repetition_penalty: 1.15\n"
106
+ ]
107
+ },
108
+ {
109
+ "name": "stderr",
110
+ "output_type": "stream",
111
+ "text": [
112
+ "Evaluating: 100%|██████████| 8/8 [00:49<00:00, 6.14s/it]\n"
113
+ ]
114
+ },
115
+ {
116
+ "name": "stdout",
117
+ "output_type": "stream",
118
+ "text": [
119
+ "\n",
120
+ "\n",
121
+ "# Ragas scores: {'faithfulness': 1.0000, 'answer_relevancy': 0.7320, 'overall_score': 0.8452}\n",
122
+ "\n"
123
+ ]
124
+ },
125
+ {
126
+ "name": "stderr",
127
+ "output_type": "stream",
128
+ "text": [
129
+ "Evaluating: 100%|██████████| 8/8 [00:40<00:00, 5.12s/it]\n"
130
+ ]
131
+ },
132
+ {
133
+ "name": "stdout",
134
+ "output_type": "stream",
135
+ "text": [
136
+ "\n",
137
+ "\n",
138
+ "# Ragas scores: {'faithfulness': 0.7500, 'answer_relevancy': 0.7224, 'overall_score': 0.7359}\n",
139
+ "\n"
140
+ ]
141
+ },
142
+ {
143
+ "name": "stderr",
144
+ "output_type": "stream",
145
+ "text": [
146
+ "Evaluating: 100%|██████████| 8/8 [00:38<00:00, 4.80s/it]\n"
147
+ ]
148
+ },
149
+ {
150
+ "name": "stdout",
151
+ "output_type": "stream",
152
+ "text": [
153
+ "\n",
154
+ "\n",
155
+ "# Ragas scores: {'faithfulness': 0.7556, 'answer_relevancy': 0.9682, 'overall_score': 0.8487}\n",
156
+ "\n",
157
+ "loading: ./notebook/nvidia-4080-orca-2-7b.ipynb\n",
158
+ "processing repetition_penalty: 1.05\n",
159
+ "processing repetition_penalty: 1.10\n",
160
+ "processing repetition_penalty: 1.15\n"
161
+ ]
162
+ },
163
+ {
164
+ "name": "stderr",
165
+ "output_type": "stream",
166
+ "text": [
167
+ "Evaluating: 100%|███���██████| 8/8 [00:42<00:00, 5.25s/it]\n"
168
+ ]
169
+ },
170
+ {
171
+ "name": "stdout",
172
+ "output_type": "stream",
173
+ "text": [
174
+ "\n",
175
+ "\n",
176
+ "# Ragas scores: {'faithfulness': 0.8304, 'answer_relevancy': 0.9783, 'overall_score': 0.8983}\n",
177
+ "\n"
178
+ ]
179
+ },
180
+ {
181
+ "name": "stderr",
182
+ "output_type": "stream",
183
+ "text": [
184
+ "Evaluating: 100%|██████████| 8/8 [00:59<00:00, 7.44s/it]\n"
185
+ ]
186
+ },
187
+ {
188
+ "name": "stdout",
189
+ "output_type": "stream",
190
+ "text": [
191
+ "\n",
192
+ "\n",
193
+ "# Ragas scores: {'faithfulness': 1.0000, 'answer_relevancy': 0.9711, 'overall_score': 0.9853}\n",
194
+ "\n"
195
+ ]
196
+ },
197
+ {
198
+ "name": "stderr",
199
+ "output_type": "stream",
200
+ "text": [
201
+ "Evaluating: 100%|██████████| 8/8 [00:33<00:00, 4.18s/it]\n"
202
+ ]
203
+ },
204
+ {
205
+ "name": "stdout",
206
+ "output_type": "stream",
207
+ "text": [
208
+ "\n",
209
+ "\n",
210
+ "# Ragas scores: {'faithfulness': 0.8667, 'answer_relevancy': 0.9637, 'overall_score': 0.9126}\n",
211
+ "\n",
212
+ "loading: ./notebook/nvidia-4080-orca-2-7b_tgi.ipynb\n",
213
+ "processing repetition_penalty: 1.05\n",
214
+ "processing repetition_penalty: 1.10\n",
215
+ "processing repetition_penalty: 1.15\n"
216
+ ]
217
+ },
218
+ {
219
+ "name": "stderr",
220
+ "output_type": "stream",
221
+ "text": [
222
+ "Evaluating: 100%|██████████| 8/8 [00:54<00:00, 6.86s/it]\n"
223
+ ]
224
+ },
225
+ {
226
+ "name": "stdout",
227
+ "output_type": "stream",
228
+ "text": [
229
+ "\n",
230
+ "\n",
231
+ "# Ragas scores: {'faithfulness': 1.0000, 'answer_relevancy': 0.9676, 'overall_score': 0.9835}\n",
232
+ "\n"
233
+ ]
234
+ },
235
+ {
236
+ "name": "stderr",
237
+ "output_type": "stream",
238
+ "text": [
239
+ "Evaluating: 100%|██████████| 8/8 [01:02<00:00, 7.87s/it]\n"
240
+ ]
241
+ },
242
+ {
243
+ "name": "stdout",
244
+ "output_type": "stream",
245
+ "text": [
246
+ "\n",
247
+ "\n",
248
+ "# Ragas scores: {'faithfulness': 0.8583, 'answer_relevancy': 0.9557, 'overall_score': 0.9044}\n",
249
+ "\n"
250
+ ]
251
+ },
252
+ {
253
+ "name": "stderr",
254
+ "output_type": "stream",
255
+ "text": [
256
+ "Evaluating: 100%|██████████| 8/8 [00:48<00:00, 6.08s/it]\n"
257
+ ]
258
+ },
259
+ {
260
+ "name": "stdout",
261
+ "output_type": "stream",
262
+ "text": [
263
+ "\n",
264
+ "\n",
265
+ "# Ragas scores: {'faithfulness': 0.7500, 'answer_relevancy': 0.7140, 'overall_score': 0.7316}\n",
266
+ "\n",
267
+ "loading: ./notebook/nvidia-4080-orca-2-13b_tgi.ipynb\n",
268
+ "processing repetition_penalty: 1.05\n",
269
+ "processing repetition_penalty: 1.10\n",
270
+ "processing repetition_penalty: 1.15\n"
271
+ ]
272
+ },
273
+ {
274
+ "name": "stderr",
275
+ "output_type": "stream",
276
+ "text": [
277
+ "Evaluating: 100%|██████████| 8/8 [00:48<00:00, 6.01s/it]\n"
278
+ ]
279
+ },
280
+ {
281
+ "name": "stdout",
282
+ "output_type": "stream",
283
+ "text": [
284
+ "\n",
285
+ "\n",
286
+ "# Ragas scores: {'faithfulness': 0.9500, 'answer_relevancy': 0.9637, 'overall_score': 0.9568}\n",
287
+ "\n"
288
+ ]
289
+ },
290
+ {
291
+ "name": "stderr",
292
+ "output_type": "stream",
293
+ "text": [
294
+ "Evaluating: 100%|██████████| 8/8 [00:35<00:00, 4.48s/it]\n"
295
+ ]
296
+ },
297
+ {
298
+ "name": "stdout",
299
+ "output_type": "stream",
300
+ "text": [
301
+ "\n",
302
+ "\n",
303
+ "# Ragas scores: {'faithfulness': 0.7500, 'answer_relevancy': 0.9468, 'overall_score': 0.8370}\n",
304
+ "\n"
305
+ ]
306
+ },
307
+ {
308
+ "name": "stderr",
309
+ "output_type": "stream",
310
+ "text": [
311
+ "Evaluating: 100%|██████████| 8/8 [00:41<00:00, 5.24s/it]\n"
312
+ ]
313
+ },
314
+ {
315
+ "name": "stdout",
316
+ "output_type": "stream",
317
+ "text": [
318
+ "\n",
319
+ "\n",
320
+ "# Ragas scores: {'faithfulness': 1.0000, 'answer_relevancy': 0.9388, 'overall_score': 0.9684}\n",
321
+ "\n",
322
+ "CPU times: user 6.76 s, sys: 448 ms, total: 7.21 s\n",
323
+ "Wall time: 9min 26s\n"
324
+ ]
325
+ }
326
+ ],
327
+ "source": [
328
+ "%%time\n",
329
+ "\n",
330
+ "model_names = [\"llama-2-7b\", \"orca-2-7b\", \"orca-2-7b_tgi\", \"orca-2-13b_tgi\"]\n",
331
+ "\n",
332
+ "perf_pd, raw_pd = evaluate_models(model_names, prefix=\"nvidia-4080\")"
333
+ ]
334
+ },
335
+ {
336
+ "cell_type": "code",
337
+ "execution_count": 4,
338
+ "metadata": {},
339
+ "outputs": [
340
+ {
341
+ "data": {
342
+ "text/html": [
343
+ "<div>\n",
344
+ "<style scoped>\n",
345
+ " .dataframe tbody tr th:only-of-type {\n",
346
+ " vertical-align: middle;\n",
347
+ " }\n",
348
+ "\n",
349
+ " .dataframe tbody tr th {\n",
350
+ " vertical-align: top;\n",
351
+ " }\n",
352
+ "\n",
353
+ " .dataframe thead th {\n",
354
+ " text-align: right;\n",
355
+ " }\n",
356
+ "</style>\n",
357
+ "<table border=\"1\" class=\"dataframe\">\n",
358
+ " <thead>\n",
359
+ " <tr style=\"text-align: right;\">\n",
360
+ " <th></th>\n",
361
+ " <th>model_name</th>\n",
362
+ " <th>repetition_penalty</th>\n",
363
+ " <th>faithfulness</th>\n",
364
+ " <th>answer_relevancy</th>\n",
365
+ " <th>overall_score</th>\n",
366
+ " <th>total_time_used</th>\n",
367
+ " <th>num_tokens_generated</th>\n",
368
+ " <th>token_per_second</th>\n",
369
+ " </tr>\n",
370
+ " </thead>\n",
371
+ " <tbody>\n",
372
+ " <tr>\n",
373
+ " <th>0</th>\n",
374
+ " <td>llama-2-7b</td>\n",
375
+ " <td>1.05</td>\n",
376
+ " <td>1.000000</td>\n",
377
+ " <td>0.731964</td>\n",
378
+ " <td>0.845241</td>\n",
379
+ " <td>1234.418</td>\n",
380
+ " <td>2457</td>\n",
381
+ " <td>1.990</td>\n",
382
+ " </tr>\n",
383
+ " <tr>\n",
384
+ " <th>1</th>\n",
385
+ " <td>llama-2-7b</td>\n",
386
+ " <td>1.10</td>\n",
387
+ " <td>0.750000</td>\n",
388
+ " <td>0.722392</td>\n",
389
+ " <td>0.735937</td>\n",
390
+ " <td>272.474</td>\n",
391
+ " <td>623</td>\n",
392
+ " <td>2.286</td>\n",
393
+ " </tr>\n",
394
+ " <tr>\n",
395
+ " <th>2</th>\n",
396
+ " <td>llama-2-7b</td>\n",
397
+ " <td>1.15</td>\n",
398
+ " <td>0.755556</td>\n",
399
+ " <td>0.968164</td>\n",
400
+ " <td>0.848748</td>\n",
401
+ " <td>319.531</td>\n",
402
+ " <td>792</td>\n",
403
+ " <td>2.479</td>\n",
404
+ " </tr>\n",
405
+ " <tr>\n",
406
+ " <th>3</th>\n",
407
+ " <td>orca-2-7b</td>\n",
408
+ " <td>1.05</td>\n",
409
+ " <td>0.830357</td>\n",
410
+ " <td>0.978326</td>\n",
411
+ " <td>0.898289</td>\n",
412
+ " <td>254.981</td>\n",
413
+ " <td>536</td>\n",
414
+ " <td>2.102</td>\n",
415
+ " </tr>\n",
416
+ " <tr>\n",
417
+ " <th>4</th>\n",
418
+ " <td>orca-2-7b</td>\n",
419
+ " <td>1.10</td>\n",
420
+ " <td>1.000000</td>\n",
421
+ " <td>0.971117</td>\n",
422
+ " <td>0.985347</td>\n",
423
+ " <td>273.518</td>\n",
424
+ " <td>549</td>\n",
425
+ " <td>2.007</td>\n",
426
+ " </tr>\n",
427
+ " <tr>\n",
428
+ " <th>5</th>\n",
429
+ " <td>orca-2-7b</td>\n",
430
+ " <td>1.15</td>\n",
431
+ " <td>0.866667</td>\n",
432
+ " <td>0.963659</td>\n",
433
+ " <td>0.912593</td>\n",
434
+ " <td>214.116</td>\n",
435
+ " <td>432</td>\n",
436
+ " <td>2.018</td>\n",
437
+ " </tr>\n",
438
+ " <tr>\n",
439
+ " <th>6</th>\n",
440
+ " <td>orca-2-7b_tgi</td>\n",
441
+ " <td>1.05</td>\n",
442
+ " <td>1.000000</td>\n",
443
+ " <td>0.967557</td>\n",
444
+ " <td>0.983511</td>\n",
445
+ " <td>330.008</td>\n",
446
+ " <td>587</td>\n",
447
+ " <td>1.779</td>\n",
448
+ " </tr>\n",
449
+ " <tr>\n",
450
+ " <th>7</th>\n",
451
+ " <td>orca-2-7b_tgi</td>\n",
452
+ " <td>1.10</td>\n",
453
+ " <td>0.858333</td>\n",
454
+ " <td>0.955750</td>\n",
455
+ " <td>0.904426</td>\n",
456
+ " <td>304.184</td>\n",
457
+ " <td>502</td>\n",
458
+ " <td>1.650</td>\n",
459
+ " </tr>\n",
460
+ " <tr>\n",
461
+ " <th>8</th>\n",
462
+ " <td>orca-2-7b_tgi</td>\n",
463
+ " <td>1.15</td>\n",
464
+ " <td>0.750000</td>\n",
465
+ " <td>0.714001</td>\n",
466
+ " <td>0.731558</td>\n",
467
+ " <td>203.892</td>\n",
468
+ " <td>339</td>\n",
469
+ " <td>1.663</td>\n",
470
+ " </tr>\n",
471
+ " <tr>\n",
472
+ " <th>9</th>\n",
473
+ " <td>orca-2-13b_tgi</td>\n",
474
+ " <td>1.05</td>\n",
475
+ " <td>0.950000</td>\n",
476
+ " <td>0.963749</td>\n",
477
+ " <td>0.956825</td>\n",
478
+ " <td>30.847</td>\n",
479
+ " <td>455</td>\n",
480
+ " <td>14.750</td>\n",
481
+ " </tr>\n",
482
+ " <tr>\n",
483
+ " <th>10</th>\n",
484
+ " <td>orca-2-13b_tgi</td>\n",
485
+ " <td>1.10</td>\n",
486
+ " <td>0.750000</td>\n",
487
+ " <td>0.946751</td>\n",
488
+ " <td>0.836968</td>\n",
489
+ " <td>24.490</td>\n",
490
+ " <td>348</td>\n",
491
+ " <td>14.210</td>\n",
492
+ " </tr>\n",
493
+ " <tr>\n",
494
+ " <th>11</th>\n",
495
+ " <td>orca-2-13b_tgi</td>\n",
496
+ " <td>1.15</td>\n",
497
+ " <td>1.000000</td>\n",
498
+ " <td>0.938756</td>\n",
499
+ " <td>0.968411</td>\n",
500
+ " <td>42.575</td>\n",
501
+ " <td>649</td>\n",
502
+ " <td>15.244</td>\n",
503
+ " </tr>\n",
504
+ " </tbody>\n",
505
+ "</table>\n",
506
+ "</div>"
507
+ ],
508
+ "text/plain": [
509
+ " model_name repetition_penalty faithfulness answer_relevancy \\\n",
510
+ "0 llama-2-7b 1.05 1.000000 0.731964 \n",
511
+ "1 llama-2-7b 1.10 0.750000 0.722392 \n",
512
+ "2 llama-2-7b 1.15 0.755556 0.968164 \n",
513
+ "3 orca-2-7b 1.05 0.830357 0.978326 \n",
514
+ "4 orca-2-7b 1.10 1.000000 0.971117 \n",
515
+ "5 orca-2-7b 1.15 0.866667 0.963659 \n",
516
+ "6 orca-2-7b_tgi 1.05 1.000000 0.967557 \n",
517
+ "7 orca-2-7b_tgi 1.10 0.858333 0.955750 \n",
518
+ "8 orca-2-7b_tgi 1.15 0.750000 0.714001 \n",
519
+ "9 orca-2-13b_tgi 1.05 0.950000 0.963749 \n",
520
+ "10 orca-2-13b_tgi 1.10 0.750000 0.946751 \n",
521
+ "11 orca-2-13b_tgi 1.15 1.000000 0.938756 \n",
522
+ "\n",
523
+ " overall_score total_time_used num_tokens_generated token_per_second \n",
524
+ "0 0.845241 1234.418 2457 1.990 \n",
525
+ "1 0.735937 272.474 623 2.286 \n",
526
+ "2 0.848748 319.531 792 2.479 \n",
527
+ "3 0.898289 254.981 536 2.102 \n",
528
+ "4 0.985347 273.518 549 2.007 \n",
529
+ "5 0.912593 214.116 432 2.018 \n",
530
+ "6 0.983511 330.008 587 1.779 \n",
531
+ "7 0.904426 304.184 502 1.650 \n",
532
+ "8 0.731558 203.892 339 1.663 \n",
533
+ "9 0.956825 30.847 455 14.750 \n",
534
+ "10 0.836968 24.490 348 14.210 \n",
535
+ "11 0.968411 42.575 649 15.244 "
536
+ ]
537
+ },
538
+ "execution_count": 4,
539
+ "metadata": {},
540
+ "output_type": "execute_result"
541
+ }
542
+ ],
543
+ "source": [
544
+ "perf_pd"
545
+ ]
546
+ },
547
+ {
548
+ "cell_type": "code",
549
+ "execution_count": 5,
550
+ "metadata": {},
551
+ "outputs": [
552
+ {
553
+ "data": {
554
+ "text/html": [
555
+ "<div>\n",
556
+ "<style scoped>\n",
557
+ " .dataframe tbody tr th:only-of-type {\n",
558
+ " vertical-align: middle;\n",
559
+ " }\n",
560
+ "\n",
561
+ " .dataframe tbody tr th {\n",
562
+ " vertical-align: top;\n",
563
+ " }\n",
564
+ "\n",
565
+ " .dataframe thead th {\n",
566
+ " text-align: right;\n",
567
+ " }\n",
568
+ "</style>\n",
569
+ "<table border=\"1\" class=\"dataframe\">\n",
570
+ " <thead>\n",
571
+ " <tr style=\"text-align: right;\">\n",
572
+ " <th></th>\n",
573
+ " <th>model_name</th>\n",
574
+ " <th>repetition_penalty</th>\n",
575
+ " <th>user_question</th>\n",
576
+ " <th>standalone_question</th>\n",
577
+ " <th>contexts</th>\n",
578
+ " <th>answer</th>\n",
579
+ " </tr>\n",
580
+ " </thead>\n",
581
+ " <tbody>\n",
582
+ " <tr>\n",
583
+ " <th>0</th>\n",
584
+ " <td>llama-2-7b</td>\n",
585
+ " <td>1.05</td>\n",
586
+ " <td>What's PCI DSS?</td>\n",
587
+ " <td></td>\n",
588
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
589
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
590
+ " </tr>\n",
591
+ " <tr>\n",
592
+ " <th>1</th>\n",
593
+ " <td>llama-2-7b</td>\n",
594
+ " <td>1.05</td>\n",
595
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
596
+ " <td>What are the key changes made in PCI DSS versi...</td>\n",
597
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
598
+ " <td>The key changes made in PCI DSS version 4.0 c...</td>\n",
599
+ " </tr>\n",
600
+ " <tr>\n",
601
+ " <th>2</th>\n",
602
+ " <td>llama-2-7b</td>\n",
603
+ " <td>1.05</td>\n",
604
+ " <td>new requirements for vulnerability assessments</td>\n",
605
+ " <td>What are the updated requirements for vulnerab...</td>\n",
606
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
607
+ " <td>The updated requirements for vulnerability as...</td>\n",
608
+ " </tr>\n",
609
+ " <tr>\n",
610
+ " <th>3</th>\n",
611
+ " <td>llama-2-7b</td>\n",
612
+ " <td>1.05</td>\n",
613
+ " <td>more on penetration testing</td>\n",
614
+ " <td>What are the updated requirements for vulnerab...</td>\n",
615
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
616
+ " <td>The updated requirements for vulnerability as...</td>\n",
617
+ " </tr>\n",
618
+ " <tr>\n",
619
+ " <th>4</th>\n",
620
+ " <td>llama-2-7b</td>\n",
621
+ " <td>1.10</td>\n",
622
+ " <td>What's PCI DSS?</td>\n",
623
+ " <td></td>\n",
624
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
625
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
626
+ " </tr>\n",
627
+ " <tr>\n",
628
+ " <th>5</th>\n",
629
+ " <td>llama-2-7b</td>\n",
630
+ " <td>1.10</td>\n",
631
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
632
+ " <td>What are the key changes made in PCI DSS versi...</td>\n",
633
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
634
+ " <td>The key changes made in PCI DSS version 4.0 c...</td>\n",
635
+ " </tr>\n",
636
+ " <tr>\n",
637
+ " <th>6</th>\n",
638
+ " <td>llama-2-7b</td>\n",
639
+ " <td>1.10</td>\n",
640
+ " <td>new requirements for vulnerability assessments</td>\n",
641
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
642
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
643
+ " <td>According to the provided summary of changes,...</td>\n",
644
+ " </tr>\n",
645
+ " <tr>\n",
646
+ " <th>7</th>\n",
647
+ " <td>llama-2-7b</td>\n",
648
+ " <td>1.10</td>\n",
649
+ " <td>more on penetration testing</td>\n",
650
+ " <td>What are the key differences between penetrati...</td>\n",
651
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
652
+ " <td>Penetration testing and vulnerability assessme...</td>\n",
653
+ " </tr>\n",
654
+ " <tr>\n",
655
+ " <th>8</th>\n",
656
+ " <td>llama-2-7b</td>\n",
657
+ " <td>1.15</td>\n",
658
+ " <td>What's PCI DSS?</td>\n",
659
+ " <td></td>\n",
660
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
661
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
662
+ " </tr>\n",
663
+ " <tr>\n",
664
+ " <th>9</th>\n",
665
+ " <td>llama-2-7b</td>\n",
666
+ " <td>1.15</td>\n",
667
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
668
+ " <td>What are the key changes between PCI DSS versi...</td>\n",
669
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
670
+ " <td>The key changes between PCI DSS versions 3.2.1...</td>\n",
671
+ " </tr>\n",
672
+ " <tr>\n",
673
+ " <th>10</th>\n",
674
+ " <td>llama-2-7b</td>\n",
675
+ " <td>1.15</td>\n",
676
+ " <td>new requirements for vulnerability assessments</td>\n",
677
+ " <td>What are some of the new requirements for vuln...</td>\n",
678
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
679
+ " <td>In PCI DSS version 4.0, there are several new ...</td>\n",
680
+ " </tr>\n",
681
+ " <tr>\n",
682
+ " <th>11</th>\n",
683
+ " <td>llama-2-7b</td>\n",
684
+ " <td>1.15</td>\n",
685
+ " <td>more on penetration testing</td>\n",
686
+ " <td>What are some common techniques used in penetr...</td>\n",
687
+ " <td>[circumvent or defeat the security features of...</td>\n",
688
+ " <td>Penetration testing involves various technique...</td>\n",
689
+ " </tr>\n",
690
+ " <tr>\n",
691
+ " <th>12</th>\n",
692
+ " <td>orca-2-7b</td>\n",
693
+ " <td>1.05</td>\n",
694
+ " <td>What's PCI DSS?</td>\n",
695
+ " <td></td>\n",
696
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
697
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
698
+ " </tr>\n",
699
+ " <tr>\n",
700
+ " <th>13</th>\n",
701
+ " <td>orca-2-7b</td>\n",
702
+ " <td>1.05</td>\n",
703
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
704
+ " <td>What are the main differences between PCI DSS ...</td>\n",
705
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
706
+ " <td>The main differences between PCI DSS version 3...</td>\n",
707
+ " </tr>\n",
708
+ " <tr>\n",
709
+ " <th>14</th>\n",
710
+ " <td>orca-2-7b</td>\n",
711
+ " <td>1.05</td>\n",
712
+ " <td>new requirements for vulnerability assessments</td>\n",
713
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
714
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
715
+ " <td>The new requirements for vulnerability assessm...</td>\n",
716
+ " </tr>\n",
717
+ " <tr>\n",
718
+ " <th>15</th>\n",
719
+ " <td>orca-2-7b</td>\n",
720
+ " <td>1.05</td>\n",
721
+ " <td>more on penetration testing</td>\n",
722
+ " <td>What are the new requirements for penetration ...</td>\n",
723
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
724
+ " <td>The new requirements for penetration testing i...</td>\n",
725
+ " </tr>\n",
726
+ " <tr>\n",
727
+ " <th>16</th>\n",
728
+ " <td>orca-2-7b</td>\n",
729
+ " <td>1.10</td>\n",
730
+ " <td>What's PCI DSS?</td>\n",
731
+ " <td></td>\n",
732
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
733
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
734
+ " </tr>\n",
735
+ " <tr>\n",
736
+ " <th>17</th>\n",
737
+ " <td>orca-2-7b</td>\n",
738
+ " <td>1.10</td>\n",
739
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
740
+ " <td>What are the main differences between PCI DSS ...</td>\n",
741
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
742
+ " <td>The main differences between PCI DSS versions ...</td>\n",
743
+ " </tr>\n",
744
+ " <tr>\n",
745
+ " <th>18</th>\n",
746
+ " <td>orca-2-7b</td>\n",
747
+ " <td>1.10</td>\n",
748
+ " <td>new requirements for vulnerability assessments</td>\n",
749
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
750
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
751
+ " <td>There are several new requirements for vulnera...</td>\n",
752
+ " </tr>\n",
753
+ " <tr>\n",
754
+ " <th>19</th>\n",
755
+ " <td>orca-2-7b</td>\n",
756
+ " <td>1.10</td>\n",
757
+ " <td>more on penetration testing</td>\n",
758
+ " <td>What are some key differences between penetrat...</td>\n",
759
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
760
+ " <td>Penetration testing and vulnerability assessme...</td>\n",
761
+ " </tr>\n",
762
+ " <tr>\n",
763
+ " <th>20</th>\n",
764
+ " <td>orca-2-7b</td>\n",
765
+ " <td>1.15</td>\n",
766
+ " <td>What's PCI DSS?</td>\n",
767
+ " <td></td>\n",
768
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
769
+ " <td>PCI DSS stands for Payment Card Industry Data ...</td>\n",
770
+ " </tr>\n",
771
+ " <tr>\n",
772
+ " <th>21</th>\n",
773
+ " <td>orca-2-7b</td>\n",
774
+ " <td>1.15</td>\n",
775
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
776
+ " <td>How does PCI DSS version 4.0 differ from versi...</td>\n",
777
+ " <td>[Payment Card Industry \\nData Security Standa...</td>\n",
778
+ " <td>In terms of security standards, PCI DSS versio...</td>\n",
779
+ " </tr>\n",
780
+ " <tr>\n",
781
+ " <th>22</th>\n",
782
+ " <td>orca-2-7b</td>\n",
783
+ " <td>1.15</td>\n",
784
+ " <td>new requirements for vulnerability assessments</td>\n",
785
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
786
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
787
+ " <td>There are several new requirements related to ...</td>\n",
788
+ " </tr>\n",
789
+ " <tr>\n",
790
+ " <th>23</th>\n",
791
+ " <td>orca-2-7b</td>\n",
792
+ " <td>1.15</td>\n",
793
+ " <td>more on penetration testing</td>\n",
794
+ " <td>What are some specific techniques used during ...</td>\n",
795
+ " <td>[circumvent or defeat the security features of...</td>\n",
796
+ " <td>Some specific techniques used during penetrati...</td>\n",
797
+ " </tr>\n",
798
+ " <tr>\n",
799
+ " <th>24</th>\n",
800
+ " <td>orca-2-7b_tgi</td>\n",
801
+ " <td>1.05</td>\n",
802
+ " <td>What's PCI DSS?</td>\n",
803
+ " <td></td>\n",
804
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
805
+ " <td>PCI DSS stands for Payment Card Industry Data...</td>\n",
806
+ " </tr>\n",
807
+ " <tr>\n",
808
+ " <th>25</th>\n",
809
+ " <td>orca-2-7b_tgi</td>\n",
810
+ " <td>1.05</td>\n",
811
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
812
+ " <td>What are the key differences between PCI DSS ...</td>\n",
813
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
814
+ " <td>The key differences between PCI DSS version 3...</td>\n",
815
+ " </tr>\n",
816
+ " <tr>\n",
817
+ " <th>26</th>\n",
818
+ " <td>orca-2-7b_tgi</td>\n",
819
+ " <td>1.05</td>\n",
820
+ " <td>new requirements for vulnerability assessments</td>\n",
821
+ " <td>What are the new requirements for vulnerabili...</td>\n",
822
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
823
+ " <td>The new requirements for vulnerability assess...</td>\n",
824
+ " </tr>\n",
825
+ " <tr>\n",
826
+ " <th>27</th>\n",
827
+ " <td>orca-2-7b_tgi</td>\n",
828
+ " <td>1.05</td>\n",
829
+ " <td>more on penetration testing</td>\n",
830
+ " <td>What are the new requirements for penetration...</td>\n",
831
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
832
+ " <td>In PCI DSS version 4.0, the new requirements ...</td>\n",
833
+ " </tr>\n",
834
+ " <tr>\n",
835
+ " <th>28</th>\n",
836
+ " <td>orca-2-7b_tgi</td>\n",
837
+ " <td>1.10</td>\n",
838
+ " <td>What's PCI DSS?</td>\n",
839
+ " <td></td>\n",
840
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
841
+ " <td>PCI DSS stands for Payment Card Industry Data...</td>\n",
842
+ " </tr>\n",
843
+ " <tr>\n",
844
+ " <th>29</th>\n",
845
+ " <td>orca-2-7b_tgi</td>\n",
846
+ " <td>1.10</td>\n",
847
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
848
+ " <td>What are the key differences between PCI DSS ...</td>\n",
849
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
850
+ " <td>The key differences between PCI DSS versions ...</td>\n",
851
+ " </tr>\n",
852
+ " <tr>\n",
853
+ " <th>30</th>\n",
854
+ " <td>orca-2-7b_tgi</td>\n",
855
+ " <td>1.10</td>\n",
856
+ " <td>new requirements for vulnerability assessments</td>\n",
857
+ " <td>What are the new requirements for vulnerabili...</td>\n",
858
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
859
+ " <td>There are several new requirements related to...</td>\n",
860
+ " </tr>\n",
861
+ " <tr>\n",
862
+ " <th>31</th>\n",
863
+ " <td>orca-2-7b_tgi</td>\n",
864
+ " <td>1.10</td>\n",
865
+ " <td>more on penetration testing</td>\n",
866
+ " <td>What are some common methods used in penetrat...</td>\n",
867
+ " <td>[PCI DSS v4.0 ROC Template r1 December 2022 ...</td>\n",
868
+ " <td>Some common methods used in penetration testi...</td>\n",
869
+ " </tr>\n",
870
+ " <tr>\n",
871
+ " <th>32</th>\n",
872
+ " <td>orca-2-7b_tgi</td>\n",
873
+ " <td>1.15</td>\n",
874
+ " <td>What's PCI DSS?</td>\n",
875
+ " <td></td>\n",
876
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
877
+ " <td>PCI DSS stands for Payment Card Industry Data...</td>\n",
878
+ " </tr>\n",
879
+ " <tr>\n",
880
+ " <th>33</th>\n",
881
+ " <td>orca-2-7b_tgi</td>\n",
882
+ " <td>1.15</td>\n",
883
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
884
+ " <td>Summarize the differences between PCI DSS ver...</td>\n",
885
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
886
+ " <td>The main difference between PCI DSS version 3...</td>\n",
887
+ " </tr>\n",
888
+ " <tr>\n",
889
+ " <th>34</th>\n",
890
+ " <td>orca-2-7b_tgi</td>\n",
891
+ " <td>1.15</td>\n",
892
+ " <td>new requirements for vulnerability assessments</td>\n",
893
+ " <td>What are the new requirements for vulnerabili...</td>\n",
894
+ " <td>[PCI DSS v3.2.1 to v.4.0 Summary of Changes r...</td>\n",
895
+ " <td>There are no specific changes mentioned for v...</td>\n",
896
+ " </tr>\n",
897
+ " <tr>\n",
898
+ " <th>35</th>\n",
899
+ " <td>orca-2-7b_tgi</td>\n",
900
+ " <td>1.15</td>\n",
901
+ " <td>more on penetration testing</td>\n",
902
+ " <td>What are some best practices for conducting e...</td>\n",
903
+ " <td>[methodology examined for this testing \\nproc...</td>\n",
904
+ " <td>Some best practices for conducting effective ...</td>\n",
905
+ " </tr>\n",
906
+ " <tr>\n",
907
+ " <th>36</th>\n",
908
+ " <td>orca-2-13b_tgi</td>\n",
909
+ " <td>1.05</td>\n",
910
+ " <td>What's PCI DSS?</td>\n",
911
+ " <td></td>\n",
912
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
913
+ " <td>PCI DSS is a global standard that provides a ...</td>\n",
914
+ " </tr>\n",
915
+ " <tr>\n",
916
+ " <th>37</th>\n",
917
+ " <td>orca-2-13b_tgi</td>\n",
918
+ " <td>1.05</td>\n",
919
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
920
+ " <td>¿Puedes resumir los cambios realizados desde ...</td>\n",
921
+ " <td>[April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi...</td>\n",
922
+ " <td>Sí, puedo resumir los cambios realizados desd...</td>\n",
923
+ " </tr>\n",
924
+ " <tr>\n",
925
+ " <th>38</th>\n",
926
+ " <td>orca-2-13b_tgi</td>\n",
927
+ " <td>1.05</td>\n",
928
+ " <td>new requirements for vulnerability assessments</td>\n",
929
+ " <td>¿Cuáles son las nuevas recomendaciones para l...</td>\n",
930
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
931
+ " <td>Las nuevas recomendaciones para las evaluacion...</td>\n",
932
+ " </tr>\n",
933
+ " <tr>\n",
934
+ " <th>39</th>\n",
935
+ " <td>orca-2-13b_tgi</td>\n",
936
+ " <td>1.05</td>\n",
937
+ " <td>more on penetration testing</td>\n",
938
+ " <td>¿Puedes dar más información sobre las pruebas...</td>\n",
939
+ " <td>[methodology examined for this testing \\nproc...</td>\n",
940
+ " <td>Sí, puedo dar más información sobre las prueb...</td>\n",
941
+ " </tr>\n",
942
+ " <tr>\n",
943
+ " <th>40</th>\n",
944
+ " <td>orca-2-13b_tgi</td>\n",
945
+ " <td>1.10</td>\n",
946
+ " <td>What's PCI DSS?</td>\n",
947
+ " <td></td>\n",
948
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
949
+ " <td>PCI DSS is a set of requirements designed to ...</td>\n",
950
+ " </tr>\n",
951
+ " <tr>\n",
952
+ " <th>41</th>\n",
953
+ " <td>orca-2-13b_tgi</td>\n",
954
+ " <td>1.10</td>\n",
955
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
956
+ " <td>¿Puedes resumir los cambios realizados desde ...</td>\n",
957
+ " <td>[April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi...</td>\n",
958
+ " <td>Sí, puedo resumir los cambios realizados desd...</td>\n",
959
+ " </tr>\n",
960
+ " <tr>\n",
961
+ " <th>42</th>\n",
962
+ " <td>orca-2-13b_tgi</td>\n",
963
+ " <td>1.10</td>\n",
964
+ " <td>new requirements for vulnerability assessments</td>\n",
965
+ " <td>¿Cuáles son las nuevas exigencias para las ev...</td>\n",
966
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
967
+ " <td>Para obtener información sobre las nuevas exi...</td>\n",
968
+ " </tr>\n",
969
+ " <tr>\n",
970
+ " <th>43</th>\n",
971
+ " <td>orca-2-13b_tgi</td>\n",
972
+ " <td>1.10</td>\n",
973
+ " <td>more on penetration testing</td>\n",
974
+ " <td>¿Podría proporcionar más información sobre la...</td>\n",
975
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
976
+ " <td>Sí, puedo proporcionar más información sobre ...</td>\n",
977
+ " </tr>\n",
978
+ " <tr>\n",
979
+ " <th>44</th>\n",
980
+ " <td>orca-2-13b_tgi</td>\n",
981
+ " <td>1.15</td>\n",
982
+ " <td>What's PCI DSS?</td>\n",
983
+ " <td></td>\n",
984
+ " <td>[PCI Data Security Standard\\nPCI DSS provides ...</td>\n",
985
+ " <td>PCI DSS is a set of requirements designed to ...</td>\n",
986
+ " </tr>\n",
987
+ " <tr>\n",
988
+ " <th>45</th>\n",
989
+ " <td>orca-2-13b_tgi</td>\n",
990
+ " <td>1.15</td>\n",
991
+ " <td>Can you summarize the changes made from PCI DS...</td>\n",
992
+ " <td>¿Puedes resumir los cambios realizados desde ...</td>\n",
993
+ " <td>[April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi...</td>\n",
994
+ " <td>Sí, puedo resumir los cambios realizados desd...</td>\n",
995
+ " </tr>\n",
996
+ " <tr>\n",
997
+ " <th>46</th>\n",
998
+ " <td>orca-2-13b_tgi</td>\n",
999
+ " <td>1.15</td>\n",
1000
+ " <td>new requirements for vulnerability assessments</td>\n",
1001
+ " <td>¿Cuáles son las nuevas recomendaciones para l...</td>\n",
1002
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
1003
+ " <td>Some possible helpful answers are:\\n\\n- Las n...</td>\n",
1004
+ " </tr>\n",
1005
+ " <tr>\n",
1006
+ " <th>47</th>\n",
1007
+ " <td>orca-2-13b_tgi</td>\n",
1008
+ " <td>1.15</td>\n",
1009
+ " <td>more on penetration testing</td>\n",
1010
+ " <td>¿Cuál es el papel del prueba de penetración e...</td>\n",
1011
+ " <td>[The Prioritized Approach to Pursue PCI DSS Co...</td>\n",
1012
+ " <td>La prueba de penetración es una parte importa...</td>\n",
1013
+ " </tr>\n",
1014
+ " </tbody>\n",
1015
+ "</table>\n",
1016
+ "</div>"
1017
+ ],
1018
+ "text/plain": [
1019
+ " model_name repetition_penalty \\\n",
1020
+ "0 llama-2-7b 1.05 \n",
1021
+ "1 llama-2-7b 1.05 \n",
1022
+ "2 llama-2-7b 1.05 \n",
1023
+ "3 llama-2-7b 1.05 \n",
1024
+ "4 llama-2-7b 1.10 \n",
1025
+ "5 llama-2-7b 1.10 \n",
1026
+ "6 llama-2-7b 1.10 \n",
1027
+ "7 llama-2-7b 1.10 \n",
1028
+ "8 llama-2-7b 1.15 \n",
1029
+ "9 llama-2-7b 1.15 \n",
1030
+ "10 llama-2-7b 1.15 \n",
1031
+ "11 llama-2-7b 1.15 \n",
1032
+ "12 orca-2-7b 1.05 \n",
1033
+ "13 orca-2-7b 1.05 \n",
1034
+ "14 orca-2-7b 1.05 \n",
1035
+ "15 orca-2-7b 1.05 \n",
1036
+ "16 orca-2-7b 1.10 \n",
1037
+ "17 orca-2-7b 1.10 \n",
1038
+ "18 orca-2-7b 1.10 \n",
1039
+ "19 orca-2-7b 1.10 \n",
1040
+ "20 orca-2-7b 1.15 \n",
1041
+ "21 orca-2-7b 1.15 \n",
1042
+ "22 orca-2-7b 1.15 \n",
1043
+ "23 orca-2-7b 1.15 \n",
1044
+ "24 orca-2-7b_tgi 1.05 \n",
1045
+ "25 orca-2-7b_tgi 1.05 \n",
1046
+ "26 orca-2-7b_tgi 1.05 \n",
1047
+ "27 orca-2-7b_tgi 1.05 \n",
1048
+ "28 orca-2-7b_tgi 1.10 \n",
1049
+ "29 orca-2-7b_tgi 1.10 \n",
1050
+ "30 orca-2-7b_tgi 1.10 \n",
1051
+ "31 orca-2-7b_tgi 1.10 \n",
1052
+ "32 orca-2-7b_tgi 1.15 \n",
1053
+ "33 orca-2-7b_tgi 1.15 \n",
1054
+ "34 orca-2-7b_tgi 1.15 \n",
1055
+ "35 orca-2-7b_tgi 1.15 \n",
1056
+ "36 orca-2-13b_tgi 1.05 \n",
1057
+ "37 orca-2-13b_tgi 1.05 \n",
1058
+ "38 orca-2-13b_tgi 1.05 \n",
1059
+ "39 orca-2-13b_tgi 1.05 \n",
1060
+ "40 orca-2-13b_tgi 1.10 \n",
1061
+ "41 orca-2-13b_tgi 1.10 \n",
1062
+ "42 orca-2-13b_tgi 1.10 \n",
1063
+ "43 orca-2-13b_tgi 1.10 \n",
1064
+ "44 orca-2-13b_tgi 1.15 \n",
1065
+ "45 orca-2-13b_tgi 1.15 \n",
1066
+ "46 orca-2-13b_tgi 1.15 \n",
1067
+ "47 orca-2-13b_tgi 1.15 \n",
1068
+ "\n",
1069
+ " user_question \\\n",
1070
+ "0 What's PCI DSS? \n",
1071
+ "1 Can you summarize the changes made from PCI DS... \n",
1072
+ "2 new requirements for vulnerability assessments \n",
1073
+ "3 more on penetration testing \n",
1074
+ "4 What's PCI DSS? \n",
1075
+ "5 Can you summarize the changes made from PCI DS... \n",
1076
+ "6 new requirements for vulnerability assessments \n",
1077
+ "7 more on penetration testing \n",
1078
+ "8 What's PCI DSS? \n",
1079
+ "9 Can you summarize the changes made from PCI DS... \n",
1080
+ "10 new requirements for vulnerability assessments \n",
1081
+ "11 more on penetration testing \n",
1082
+ "12 What's PCI DSS? \n",
1083
+ "13 Can you summarize the changes made from PCI DS... \n",
1084
+ "14 new requirements for vulnerability assessments \n",
1085
+ "15 more on penetration testing \n",
1086
+ "16 What's PCI DSS? \n",
1087
+ "17 Can you summarize the changes made from PCI DS... \n",
1088
+ "18 new requirements for vulnerability assessments \n",
1089
+ "19 more on penetration testing \n",
1090
+ "20 What's PCI DSS? \n",
1091
+ "21 Can you summarize the changes made from PCI DS... \n",
1092
+ "22 new requirements for vulnerability assessments \n",
1093
+ "23 more on penetration testing \n",
1094
+ "24 What's PCI DSS? \n",
1095
+ "25 Can you summarize the changes made from PCI DS... \n",
1096
+ "26 new requirements for vulnerability assessments \n",
1097
+ "27 more on penetration testing \n",
1098
+ "28 What's PCI DSS? \n",
1099
+ "29 Can you summarize the changes made from PCI DS... \n",
1100
+ "30 new requirements for vulnerability assessments \n",
1101
+ "31 more on penetration testing \n",
1102
+ "32 What's PCI DSS? \n",
1103
+ "33 Can you summarize the changes made from PCI DS... \n",
1104
+ "34 new requirements for vulnerability assessments \n",
1105
+ "35 more on penetration testing \n",
1106
+ "36 What's PCI DSS? \n",
1107
+ "37 Can you summarize the changes made from PCI DS... \n",
1108
+ "38 new requirements for vulnerability assessments \n",
1109
+ "39 more on penetration testing \n",
1110
+ "40 What's PCI DSS? \n",
1111
+ "41 Can you summarize the changes made from PCI DS... \n",
1112
+ "42 new requirements for vulnerability assessments \n",
1113
+ "43 more on penetration testing \n",
1114
+ "44 What's PCI DSS? \n",
1115
+ "45 Can you summarize the changes made from PCI DS... \n",
1116
+ "46 new requirements for vulnerability assessments \n",
1117
+ "47 more on penetration testing \n",
1118
+ "\n",
1119
+ " standalone_question \\\n",
1120
+ "0 \n",
1121
+ "1 What are the key changes made in PCI DSS versi... \n",
1122
+ "2 What are the updated requirements for vulnerab... \n",
1123
+ "3 What are the updated requirements for vulnerab... \n",
1124
+ "4 \n",
1125
+ "5 What are the key changes made in PCI DSS versi... \n",
1126
+ "6 What are the new requirements for vulnerabilit... \n",
1127
+ "7 What are the key differences between penetrati... \n",
1128
+ "8 \n",
1129
+ "9 What are the key changes between PCI DSS versi... \n",
1130
+ "10 What are some of the new requirements for vuln... \n",
1131
+ "11 What are some common techniques used in penetr... \n",
1132
+ "12 \n",
1133
+ "13 What are the main differences between PCI DSS ... \n",
1134
+ "14 What are the new requirements for vulnerabilit... \n",
1135
+ "15 What are the new requirements for penetration ... \n",
1136
+ "16 \n",
1137
+ "17 What are the main differences between PCI DSS ... \n",
1138
+ "18 What are the new requirements for vulnerabilit... \n",
1139
+ "19 What are some key differences between penetrat... \n",
1140
+ "20 \n",
1141
+ "21 How does PCI DSS version 4.0 differ from versi... \n",
1142
+ "22 What are the new requirements for vulnerabilit... \n",
1143
+ "23 What are some specific techniques used during ... \n",
1144
+ "24 \n",
1145
+ "25 What are the key differences between PCI DSS ... \n",
1146
+ "26 What are the new requirements for vulnerabili... \n",
1147
+ "27 What are the new requirements for penetration... \n",
1148
+ "28 \n",
1149
+ "29 What are the key differences between PCI DSS ... \n",
1150
+ "30 What are the new requirements for vulnerabili... \n",
1151
+ "31 What are some common methods used in penetrat... \n",
1152
+ "32 \n",
1153
+ "33 Summarize the differences between PCI DSS ver... \n",
1154
+ "34 What are the new requirements for vulnerabili... \n",
1155
+ "35 What are some best practices for conducting e... \n",
1156
+ "36 \n",
1157
+ "37 ¿Puedes resumir los cambios realizados desde ... \n",
1158
+ "38 ¿Cuáles son las nuevas recomendaciones para l... \n",
1159
+ "39 ¿Puedes dar más información sobre las pruebas... \n",
1160
+ "40 \n",
1161
+ "41 ¿Puedes resumir los cambios realizados desde ... \n",
1162
+ "42 ¿Cuáles son las nuevas exigencias para las ev... \n",
1163
+ "43 ¿Podría proporcionar más información sobre la... \n",
1164
+ "44 \n",
1165
+ "45 ¿Puedes resumir los cambios realizados desde ... \n",
1166
+ "46 ¿Cuáles son las nuevas recomendaciones para l... \n",
1167
+ "47 ¿Cuál es el papel del prueba de penetración e... \n",
1168
+ "\n",
1169
+ " contexts \\\n",
1170
+ "0 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1171
+ "1 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1172
+ "2 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1173
+ "3 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1174
+ "4 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1175
+ "5 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1176
+ "6 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1177
+ "7 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1178
+ "8 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1179
+ "9 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1180
+ "10 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1181
+ "11 [circumvent or defeat the security features of... \n",
1182
+ "12 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1183
+ "13 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1184
+ "14 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1185
+ "15 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1186
+ "16 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1187
+ "17 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1188
+ "18 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1189
+ "19 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1190
+ "20 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1191
+ "21 [Payment Card Industry \\nData Security Standa... \n",
1192
+ "22 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1193
+ "23 [circumvent or defeat the security features of... \n",
1194
+ "24 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1195
+ "25 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1196
+ "26 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1197
+ "27 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1198
+ "28 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1199
+ "29 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1200
+ "30 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1201
+ "31 [PCI DSS v4.0 ROC Template r1 December 2022 ... \n",
1202
+ "32 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1203
+ "33 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1204
+ "34 [PCI DSS v3.2.1 to v.4.0 Summary of Changes r... \n",
1205
+ "35 [methodology examined for this testing \\nproc... \n",
1206
+ "36 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1207
+ "37 [April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi... \n",
1208
+ "38 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1209
+ "39 [methodology examined for this testing \\nproc... \n",
1210
+ "40 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1211
+ "41 [April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi... \n",
1212
+ "42 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1213
+ "43 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1214
+ "44 [PCI Data Security Standard\\nPCI DSS provides ... \n",
1215
+ "45 [April 2015 PCI DSS 3.1, \\nRevision 1.0 Revi... \n",
1216
+ "46 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1217
+ "47 [The Prioritized Approach to Pursue PCI DSS Co... \n",
1218
+ "\n",
1219
+ " answer \n",
1220
+ "0 PCI DSS stands for Payment Card Industry Data ... \n",
1221
+ "1 The key changes made in PCI DSS version 4.0 c... \n",
1222
+ "2 The updated requirements for vulnerability as... \n",
1223
+ "3 The updated requirements for vulnerability as... \n",
1224
+ "4 PCI DSS stands for Payment Card Industry Data ... \n",
1225
+ "5 The key changes made in PCI DSS version 4.0 c... \n",
1226
+ "6 According to the provided summary of changes,... \n",
1227
+ "7 Penetration testing and vulnerability assessme... \n",
1228
+ "8 PCI DSS stands for Payment Card Industry Data ... \n",
1229
+ "9 The key changes between PCI DSS versions 3.2.1... \n",
1230
+ "10 In PCI DSS version 4.0, there are several new ... \n",
1231
+ "11 Penetration testing involves various technique... \n",
1232
+ "12 PCI DSS stands for Payment Card Industry Data ... \n",
1233
+ "13 The main differences between PCI DSS version 3... \n",
1234
+ "14 The new requirements for vulnerability assessm... \n",
1235
+ "15 The new requirements for penetration testing i... \n",
1236
+ "16 PCI DSS stands for Payment Card Industry Data ... \n",
1237
+ "17 The main differences between PCI DSS versions ... \n",
1238
+ "18 There are several new requirements for vulnera... \n",
1239
+ "19 Penetration testing and vulnerability assessme... \n",
1240
+ "20 PCI DSS stands for Payment Card Industry Data ... \n",
1241
+ "21 In terms of security standards, PCI DSS versio... \n",
1242
+ "22 There are several new requirements related to ... \n",
1243
+ "23 Some specific techniques used during penetrati... \n",
1244
+ "24 PCI DSS stands for Payment Card Industry Data... \n",
1245
+ "25 The key differences between PCI DSS version 3... \n",
1246
+ "26 The new requirements for vulnerability assess... \n",
1247
+ "27 In PCI DSS version 4.0, the new requirements ... \n",
1248
+ "28 PCI DSS stands for Payment Card Industry Data... \n",
1249
+ "29 The key differences between PCI DSS versions ... \n",
1250
+ "30 There are several new requirements related to... \n",
1251
+ "31 Some common methods used in penetration testi... \n",
1252
+ "32 PCI DSS stands for Payment Card Industry Data... \n",
1253
+ "33 The main difference between PCI DSS version 3... \n",
1254
+ "34 There are no specific changes mentioned for v... \n",
1255
+ "35 Some best practices for conducting effective ... \n",
1256
+ "36 PCI DSS is a global standard that provides a ... \n",
1257
+ "37 Sí, puedo resumir los cambios realizados desd... \n",
1258
+ "38 Las nuevas recomendaciones para las evaluacion... \n",
1259
+ "39 Sí, puedo dar más información sobre las prueb... \n",
1260
+ "40 PCI DSS is a set of requirements designed to ... \n",
1261
+ "41 Sí, puedo resumir los cambios realizados desd... \n",
1262
+ "42 Para obtener información sobre las nuevas exi... \n",
1263
+ "43 Sí, puedo proporcionar más información sobre ... \n",
1264
+ "44 PCI DSS is a set of requirements designed to ... \n",
1265
+ "45 Sí, puedo resumir los cambios realizados desd... \n",
1266
+ "46 Some possible helpful answers are:\\n\\n- Las n... \n",
1267
+ "47 La prueba de penetración es una parte importa... "
1268
+ ]
1269
+ },
1270
+ "execution_count": 5,
1271
+ "metadata": {},
1272
+ "output_type": "execute_result"
1273
+ }
1274
+ ],
1275
+ "source": [
1276
+ "raw_pd"
1277
+ ]
1278
+ },
1279
+ {
1280
+ "cell_type": "code",
1281
+ "execution_count": 6,
1282
+ "metadata": {},
1283
+ "outputs": [],
1284
+ "source": [
1285
+ "raw_pd.to_excel(\"./results/raw_data_nvidia_4080.xlsx\", index=False)\n",
1286
+ "perf_pd.to_excel(\"./results/perf_data_nvidia_4080.xlsx\", index=False)"
1287
+ ]
1288
+ },
1289
+ {
1290
+ "cell_type": "code",
1291
+ "execution_count": 8,
1292
+ "metadata": {},
1293
+ "outputs": [
1294
+ {
1295
+ "data": {
1296
+ "text/plain": [
1297
+ "('new requirements for vulnerability assessments',\n",
1298
+ " 'What are the updated requirements for vulnerability assessments in PCI DSS version 4.0 compared to version 3.2.1?\\n\\n\\n\\n',\n",
1299
+ " ' The updated requirements for vulnerability assessments in PCI DSS version 4.0 are as follows:\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n')"
1300
+ ]
1301
+ },
1302
+ "execution_count": 8,
1303
+ "metadata": {},
1304
+ "output_type": "execute_result"
1305
+ }
1306
+ ],
1307
+ "source": [
1308
+ "raw_pd[\"user_question\"][2], raw_pd[\"standalone_question\"][2], raw_pd[\"answer\"][2]"
1309
+ ]
1310
+ },
1311
+ {
1312
+ "cell_type": "code",
1313
+ "execution_count": 9,
1314
+ "metadata": {},
1315
+ "outputs": [
1316
+ {
1317
+ "data": {
1318
+ "text/plain": [
1319
+ "('new requirements for vulnerability assessments',\n",
1320
+ " 'What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\\n\\n\\n\\n',\n",
1321
+ " 'The new requirements for vulnerability assessments in PCI DSS version 4.0 include:\\n\\n- Requirement 4.1.2, which states that there is a new requirement for roles and responsibilities related to vulnerability assessments.\\n- Requirement 4.2.1, which requires confirmation that certificates used for Point-to-Point (PAN) transmissions over open, public networks are valid and not expired or revoked. This bullet is a best practice until March 31, 2025.\\n- Requirement 4.2.1.1, which introduces a new requirement to maintain an inventory of trusted keys and certificates. This is also a best practice until March 31, 2025.\\n\\n\\n\\n')"
1322
+ ]
1323
+ },
1324
+ "execution_count": 9,
1325
+ "metadata": {},
1326
+ "output_type": "execute_result"
1327
+ }
1328
+ ],
1329
+ "source": [
1330
+ "raw_pd[\"user_question\"][14], raw_pd[\"standalone_question\"][14], raw_pd[\"answer\"][14]"
1331
+ ]
1332
+ }
1333
+ ],
1334
+ "metadata": {
1335
+ "kernelspec": {
1336
+ "display_name": "Python 3 (ipykernel)",
1337
+ "language": "python",
1338
+ "name": "python3"
1339
+ },
1340
+ "language_info": {
1341
+ "codemirror_mode": {
1342
+ "name": "ipython",
1343
+ "version": 3
1344
+ },
1345
+ "file_extension": ".py",
1346
+ "mimetype": "text/x-python",
1347
+ "name": "python",
1348
+ "nbconvert_exporter": "python",
1349
+ "pygments_lexer": "ipython3",
1350
+ "version": "3.11.7"
1351
+ }
1352
+ },
1353
+ "nbformat": 4,
1354
+ "nbformat_minor": 4
1355
+ }
results/3_analyze-data.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
results/4_translate_spanish_content.ipynb ADDED
@@ -0,0 +1,465 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 2,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "name": "stdout",
10
+ "output_type": "stream",
11
+ "text": [
12
+ "workding dir: /Users/inflaton/code/engd/papers/chat-with-orca-2\n"
13
+ ]
14
+ }
15
+ ],
16
+ "source": [
17
+ "import os\n",
18
+ "import sys\n",
19
+ "from pathlib import Path\n",
20
+ "\n",
21
+ "workding_dir = str(Path.cwd().parent)\n",
22
+ "os.chdir(workding_dir)\n",
23
+ "sys.path.append(workding_dir)\n",
24
+ "print(\"workding dir:\", workding_dir)"
25
+ ]
26
+ },
27
+ {
28
+ "cell_type": "markdown",
29
+ "metadata": {},
30
+ "source": [
31
+ "### Translating Orca-2-13b's Results from Spanish to English"
32
+ ]
33
+ },
34
+ {
35
+ "cell_type": "code",
36
+ "execution_count": 6,
37
+ "metadata": {},
38
+ "outputs": [
39
+ {
40
+ "data": {
41
+ "text/html": [
42
+ "<div>\n",
43
+ "<style scoped>\n",
44
+ " .dataframe tbody tr th:only-of-type {\n",
45
+ " vertical-align: middle;\n",
46
+ " }\n",
47
+ "\n",
48
+ " .dataframe tbody tr th {\n",
49
+ " vertical-align: top;\n",
50
+ " }\n",
51
+ "\n",
52
+ " .dataframe thead th {\n",
53
+ " text-align: right;\n",
54
+ " }\n",
55
+ "</style>\n",
56
+ "<table border=\"1\" class=\"dataframe\">\n",
57
+ " <thead>\n",
58
+ " <tr style=\"text-align: right;\">\n",
59
+ " <th></th>\n",
60
+ " <th>model_name</th>\n",
61
+ " <th>repetition_penalty</th>\n",
62
+ " <th>faithfulness</th>\n",
63
+ " <th>answer_relevancy</th>\n",
64
+ " <th>overall_score</th>\n",
65
+ " <th>total_time_used</th>\n",
66
+ " <th>num_tokens_generated</th>\n",
67
+ " <th>token_per_second</th>\n",
68
+ " </tr>\n",
69
+ " </thead>\n",
70
+ " <tbody>\n",
71
+ " <tr>\n",
72
+ " <th>6</th>\n",
73
+ " <td>orca-2-13b</td>\n",
74
+ " <td>1.05</td>\n",
75
+ " <td>1.0</td>\n",
76
+ " <td>0.987592</td>\n",
77
+ " <td>0.993757</td>\n",
78
+ " <td>397.548</td>\n",
79
+ " <td>641</td>\n",
80
+ " <td>1.612</td>\n",
81
+ " </tr>\n",
82
+ " </tbody>\n",
83
+ "</table>\n",
84
+ "</div>"
85
+ ],
86
+ "text/plain": [
87
+ " model_name repetition_penalty faithfulness answer_relevancy \\\n",
88
+ "6 orca-2-13b 1.05 1.0 0.987592 \n",
89
+ "\n",
90
+ " overall_score total_time_used num_tokens_generated token_per_second \n",
91
+ "6 0.993757 397.548 641 1.612 "
92
+ ]
93
+ },
94
+ "execution_count": 6,
95
+ "metadata": {},
96
+ "output_type": "execute_result"
97
+ }
98
+ ],
99
+ "source": [
100
+ "import pandas as pd\n",
101
+ "\n",
102
+ "perf_pd1 = pd.read_excel(\"./results/perf_data.xlsx\")\n",
103
+ "idx = (\n",
104
+ " perf_pd1[perf_pd1[\"model_name\"] == \"orca-2-13b\"]\n",
105
+ " .groupby(\"model_name\")[\"overall_score\"]\n",
106
+ " .idxmax()\n",
107
+ ")\n",
108
+ "df = perf_pd1.loc[idx].sort_index(ascending=False)\n",
109
+ "df"
110
+ ]
111
+ },
112
+ {
113
+ "cell_type": "code",
114
+ "execution_count": 7,
115
+ "metadata": {},
116
+ "outputs": [],
117
+ "source": [
118
+ "selected = []\n",
119
+ "NUM_QUESTIONS =4\n",
120
+ "for j in range(NUM_QUESTIONS):\n",
121
+ " for i in idx.values:\n",
122
+ " selected.append(i * NUM_QUESTIONS + j)"
123
+ ]
124
+ },
125
+ {
126
+ "cell_type": "code",
127
+ "execution_count": 14,
128
+ "metadata": {},
129
+ "outputs": [
130
+ {
131
+ "data": {
132
+ "text/html": [
133
+ "<div>\n",
134
+ "<style scoped>\n",
135
+ " .dataframe tbody tr th:only-of-type {\n",
136
+ " vertical-align: middle;\n",
137
+ " }\n",
138
+ "\n",
139
+ " .dataframe tbody tr th {\n",
140
+ " vertical-align: top;\n",
141
+ " }\n",
142
+ "\n",
143
+ " .dataframe thead th {\n",
144
+ " text-align: right;\n",
145
+ " }\n",
146
+ "</style>\n",
147
+ "<table border=\"1\" class=\"dataframe\">\n",
148
+ " <thead>\n",
149
+ " <tr style=\"text-align: right;\">\n",
150
+ " <th></th>\n",
151
+ " <th>Model Name</th>\n",
152
+ " <th>LLM Generated Content</th>\n",
153
+ " </tr>\n",
154
+ " </thead>\n",
155
+ " <tbody>\n",
156
+ " <tr>\n",
157
+ " <th>0</th>\n",
158
+ " <td>orca-2-13b</td>\n",
159
+ " <td>PCI DSS is a global standard that provides a b...</td>\n",
160
+ " </tr>\n",
161
+ " <tr>\n",
162
+ " <th>1</th>\n",
163
+ " <td>orca-2-13b</td>\n",
164
+ " <td>**¿Puedes resumir los cambios realizados desde...</td>\n",
165
+ " </tr>\n",
166
+ " <tr>\n",
167
+ " <th>2</th>\n",
168
+ " <td>orca-2-13b</td>\n",
169
+ " <td>**¿Cuáles son las nuevas requisitos para las e...</td>\n",
170
+ " </tr>\n",
171
+ " <tr>\n",
172
+ " <th>3</th>\n",
173
+ " <td>orca-2-13b</td>\n",
174
+ " <td>**¿Puedes dar más detalles sobre las prácticas...</td>\n",
175
+ " </tr>\n",
176
+ " </tbody>\n",
177
+ "</table>\n",
178
+ "</div>"
179
+ ],
180
+ "text/plain": [
181
+ " Model Name LLM Generated Content\n",
182
+ "0 orca-2-13b PCI DSS is a global standard that provides a b...\n",
183
+ "1 orca-2-13b **¿Puedes resumir los cambios realizados desde...\n",
184
+ "2 orca-2-13b **¿Cuáles son las nuevas requisitos para las e...\n",
185
+ "3 orca-2-13b **¿Puedes dar más detalles sobre las prácticas..."
186
+ ]
187
+ },
188
+ "execution_count": 14,
189
+ "metadata": {},
190
+ "output_type": "execute_result"
191
+ }
192
+ ],
193
+ "source": [
194
+ "raw_data = pd.read_excel(\"./results/raw_data.xlsx\")\n",
195
+ "df = raw_data.loc[selected]\n",
196
+ "df = df.drop([\"repetition_penalty\", \"contexts\"], axis=1)\n",
197
+ "df = df.fillna(\"\")\n",
198
+ "df[df.columns] = df.apply(lambda x: x.str.strip())\n",
199
+ "df[\"standalone_question\"] = df[\"standalone_question\"].str.replace(\"\\n\", \"**\\n**\")\n",
200
+ "df[\"standalone_question\"] = df[\"standalone_question\"].apply(\n",
201
+ " lambda x: \"{}{}{}\".format(\"**\", x, \"**\") if len(x) > 0 else x\n",
202
+ ")\n",
203
+ "df[\"standalone_question\"] = df[\"standalone_question\"].str.replace(\"****\", \"\")\n",
204
+ "df[\"LLM Generated Content\"] = (\n",
205
+ " df[\"standalone_question\"].str.cat(df[\"answer\"], sep=\"\\n\").str.strip()\n",
206
+ ")\n",
207
+ "df = df.rename(columns={\"model_name\": \"Model Name\"})\n",
208
+ "df = df.drop(columns=[\"answer\", \"standalone_question\", \"user_question\"])\n",
209
+ "df[df.columns] = df.apply(lambda x: x.str.strip())\n",
210
+ "df.reset_index(drop=True, inplace=True)\n",
211
+ "df"
212
+ ]
213
+ },
214
+ {
215
+ "cell_type": "code",
216
+ "execution_count": 15,
217
+ "metadata": {},
218
+ "outputs": [
219
+ {
220
+ "data": {
221
+ "text/html": [
222
+ "<div>\n",
223
+ "<style scoped>\n",
224
+ " .dataframe tbody tr th:only-of-type {\n",
225
+ " vertical-align: middle;\n",
226
+ " }\n",
227
+ "\n",
228
+ " .dataframe tbody tr th {\n",
229
+ " vertical-align: top;\n",
230
+ " }\n",
231
+ "\n",
232
+ " .dataframe thead th {\n",
233
+ " text-align: right;\n",
234
+ " }\n",
235
+ "</style>\n",
236
+ "<table border=\"1\" class=\"dataframe\">\n",
237
+ " <thead>\n",
238
+ " <tr style=\"text-align: right;\">\n",
239
+ " <th></th>\n",
240
+ " <th>Model Name</th>\n",
241
+ " <th>LLM Generated Content</th>\n",
242
+ " </tr>\n",
243
+ " </thead>\n",
244
+ " <tbody>\n",
245
+ " <tr>\n",
246
+ " <th>1</th>\n",
247
+ " <td>orca-2-13b</td>\n",
248
+ " <td>¿Puedes resumir los cambios realizados desde l...</td>\n",
249
+ " </tr>\n",
250
+ " <tr>\n",
251
+ " <th>2</th>\n",
252
+ " <td>orca-2-13b</td>\n",
253
+ " <td>¿Cuáles son las nuevas requisitos para las eva...</td>\n",
254
+ " </tr>\n",
255
+ " <tr>\n",
256
+ " <th>3</th>\n",
257
+ " <td>orca-2-13b</td>\n",
258
+ " <td>¿Puedes dar más detalles sobre las prácticas d...</td>\n",
259
+ " </tr>\n",
260
+ " </tbody>\n",
261
+ "</table>\n",
262
+ "</div>"
263
+ ],
264
+ "text/plain": [
265
+ " Model Name LLM Generated Content\n",
266
+ "1 orca-2-13b ¿Puedes resumir los cambios realizados desde l...\n",
267
+ "2 orca-2-13b ¿Cuáles son las nuevas requisitos para las eva...\n",
268
+ "3 orca-2-13b ¿Puedes dar más detalles sobre las prácticas d..."
269
+ ]
270
+ },
271
+ "execution_count": 15,
272
+ "metadata": {},
273
+ "output_type": "execute_result"
274
+ }
275
+ ],
276
+ "source": [
277
+ "df.drop(index=[0], inplace=True)\n",
278
+ "orca_2_13b_df = df\n",
279
+ "orca_2_13b_df[\"LLM Generated Content\"] = orca_2_13b_df[\"LLM Generated Content\"].apply(\n",
280
+ " lambda x: x.replace(\"**\", \"\")\n",
281
+ ")\n",
282
+ "orca_2_13b_df"
283
+ ]
284
+ },
285
+ {
286
+ "cell_type": "code",
287
+ "execution_count": 44,
288
+ "metadata": {},
289
+ "outputs": [],
290
+ "source": [
291
+ "import os\n",
292
+ "from openai import OpenAI\n",
293
+ "from app_modules.init import *\n",
294
+ "\n",
295
+ "\n",
296
+ "# Function to translate text using OpenAI\n",
297
+ "def translate(text):\n",
298
+ " client = OpenAI(\n",
299
+ " # This is the default and can be omitted\n",
300
+ " api_key=os.environ.get(\"OPENAI_API_KEY\"),\n",
301
+ " )\n",
302
+ "\n",
303
+ " chat_completion = client.chat.completions.create(\n",
304
+ " messages=[\n",
305
+ " {\n",
306
+ " \"role\": \"user\",\n",
307
+ " \"content\": f\"Translate the following text to English: {text}\",\n",
308
+ " }\n",
309
+ " ],\n",
310
+ " model=\"gpt-4-turbo-preview\",\n",
311
+ " )\n",
312
+ " print(chat_completion)\n",
313
+ " return chat_completion.choices[0].message.content"
314
+ ]
315
+ },
316
+ {
317
+ "cell_type": "code",
318
+ "execution_count": 58,
319
+ "metadata": {},
320
+ "outputs": [
321
+ {
322
+ "name": "stdout",
323
+ "output_type": "stream",
324
+ "text": [
325
+ "ChatCompletion(id='chatcmpl-8mdHUCObrRgeCDBweZXGDc0FTVrh8', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='Can you summarize the changes made from version 3.2.1 to version 4.0 of PCI DSS?\\nYes, I can summarize the changes made from version 3.2.1 to version 4.0 of PCI DSS. The changes include adjustments to align with the modifications from PCI DSS 3.2 to PCI DSS 3.2.1, as well as minor corrections and edits to clarify and improve the format. Then, in version 4.0, updates were made to align with the modifications from PCI DSS 3.2.1 to PCI DSS 4.0, and there were also minor corrections and edits made to clarify and improve the format. In December 2022, there was an additional revision that included minor adjustments, correction of typographical errors, and the removal of \"In Place with Remediation\" as a reporting option.', role='assistant', function_call=None, tool_calls=None))], created=1706601432, model='gpt-4-0125-preview', object='chat.completion', system_fingerprint='fp_376b7f78b9', usage=CompletionUsage(completion_tokens=184, prompt_tokens=240, total_tokens=424))\n",
326
+ "ChatCompletion(id='chatcmpl-8mdHpGDnxgKsm6YBRSw8irwVpMz0y', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='What are the new requirements for vulnerability assessments in PCI DSS version 4.0?\\nThe new requirements for vulnerability assessments in PCI DSS version 4.0 include resolving vulnerabilities with a CVSS score of 4.0 or higher, performing rescans when necessary, and having a defined, documented, and implemented penetration testing method that includes industry-accepted approaches and coverage for the CDE perimeter and critical systems.', role='assistant', function_call=None, tool_calls=None))], created=1706601453, model='gpt-4-0125-preview', object='chat.completion', system_fingerprint='fp_376b7f78b9', usage=CompletionUsage(completion_tokens=84, prompt_tokens=140, total_tokens=224))\n",
327
+ "ChatCompletion(id='chatcmpl-8mdHv2yENauX11654tNa99RW1dMHo', choices=[Choice(finish_reason='stop', index=0, logprobs=None, message=ChatCompletionMessage(content='Can you provide more details about penetration testing practices in PCI DSS?\\nYes, I can provide more details about penetration testing practices in PCI DSS. The PCI DSS requires that external penetration testing be conducted at least once every 12 months and after any significant modification or change in the infrastructure or software. The penetration testing must be conducted by a qualified internal resource or a qualified third party from outside the organization and must comply with the methodology defined by the entity. Additionally, the security vulnerabilities and weaknesses that are found during the penetration testing must be corrected and verified by repeating the testing.', role='assistant', function_call=None, tool_calls=None))], created=1706601459, model='gpt-4-0125-preview', object='chat.completion', system_fingerprint='fp_376b7f78b9', usage=CompletionUsage(completion_tokens=116, prompt_tokens=177, total_tokens=293))\n"
328
+ ]
329
+ },
330
+ {
331
+ "data": {
332
+ "text/html": [
333
+ "<div>\n",
334
+ "<style scoped>\n",
335
+ " .dataframe tbody tr th:only-of-type {\n",
336
+ " vertical-align: middle;\n",
337
+ " }\n",
338
+ "\n",
339
+ " .dataframe tbody tr th {\n",
340
+ " vertical-align: top;\n",
341
+ " }\n",
342
+ "\n",
343
+ " .dataframe thead th {\n",
344
+ " text-align: right;\n",
345
+ " }\n",
346
+ "</style>\n",
347
+ "<table border=\"1\" class=\"dataframe\">\n",
348
+ " <thead>\n",
349
+ " <tr style=\"text-align: right;\">\n",
350
+ " <th></th>\n",
351
+ " <th>Model Name</th>\n",
352
+ " <th>LLM Generated Content</th>\n",
353
+ " <th>Translation by GPT-4-Turbo</th>\n",
354
+ " </tr>\n",
355
+ " </thead>\n",
356
+ " <tbody>\n",
357
+ " <tr>\n",
358
+ " <th>1</th>\n",
359
+ " <td>orca-2-13b</td>\n",
360
+ " <td>¿Puedes resumir los cambios realizados desde l...</td>\n",
361
+ " <td>Can you summarize the changes made from versio...</td>\n",
362
+ " </tr>\n",
363
+ " <tr>\n",
364
+ " <th>2</th>\n",
365
+ " <td>orca-2-13b</td>\n",
366
+ " <td>¿Cuáles son las nuevas requisitos para las eva...</td>\n",
367
+ " <td>What are the new requirements for vulnerabilit...</td>\n",
368
+ " </tr>\n",
369
+ " <tr>\n",
370
+ " <th>3</th>\n",
371
+ " <td>orca-2-13b</td>\n",
372
+ " <td>¿Puedes dar más detalles sobre las prácticas d...</td>\n",
373
+ " <td>Can you provide more details about penetration...</td>\n",
374
+ " </tr>\n",
375
+ " </tbody>\n",
376
+ "</table>\n",
377
+ "</div>"
378
+ ],
379
+ "text/plain": [
380
+ " Model Name LLM Generated Content \\\n",
381
+ "1 orca-2-13b ¿Puedes resumir los cambios realizados desde l... \n",
382
+ "2 orca-2-13b ¿Cuáles son las nuevas requisitos para las eva... \n",
383
+ "3 orca-2-13b ¿Puedes dar más detalles sobre las prácticas d... \n",
384
+ "\n",
385
+ " Translation by GPT-4-Turbo \n",
386
+ "1 Can you summarize the changes made from versio... \n",
387
+ "2 What are the new requirements for vulnerabilit... \n",
388
+ "3 Can you provide more details about penetration... "
389
+ ]
390
+ },
391
+ "execution_count": 58,
392
+ "metadata": {},
393
+ "output_type": "execute_result"
394
+ }
395
+ ],
396
+ "source": [
397
+ "orca_2_13b_df[\"Translation by GPT-4-Turbo\"] = orca_2_13b_df[\n",
398
+ " \"LLM Generated Content\"\n",
399
+ "].apply(translate)\n",
400
+ "orca_2_13b_df"
401
+ ]
402
+ },
403
+ {
404
+ "cell_type": "code",
405
+ "execution_count": 59,
406
+ "metadata": {},
407
+ "outputs": [
408
+ {
409
+ "name": "stdout",
410
+ "output_type": "stream",
411
+ "text": [
412
+ "| | Model Name | LLM Generated Content | Translation by GPT-4-Turbo |\n",
413
+ "|---:|:-------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n",
414
+ "| 1 | orca-2-13b | ¿Puedes resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS? | Can you summarize the changes made from version 3.2.1 to version 4.0 of PCI DSS? |\n",
415
+ "| | | Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones de PCI DSS 3.2 a PCI DSS 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Luego, en la versión 4.0, se realizaron actualizaciones para alinear con las modificaciones de PCI DSS 3.2.1 a PCI DSS 4.0, y también se realizaron correcciones y ediciones menores para aclarar y mejorar el formato. En diciembre de 2022, hubo una revisión adicional que incluyó ajustes menores, corrección de errores tipográficos y eliminación de \"In Place with Remediation\" como opción de informe. | Yes, I can summarize the changes made from version 3.2.1 to version 4.0 of PCI DSS. The changes include adjustments to align with the modifications from PCI DSS 3.2 to PCI DSS 3.2.1, as well as minor corrections and edits to clarify and improve the format. Then, in version 4.0, updates were made to align with the modifications from PCI DSS 3.2.1 to PCI DSS 4.0, and there were also minor corrections and edits made to clarify and improve the format. In December 2022, there was an additional revision that included minor adjustments, correction of typographical errors, and the removal of \"In Place with Remediation\" as a reporting option. |\n",
416
+ "| 2 | orca-2-13b | ¿Cuáles son las nuevas requisitos para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS? | What are the new requirements for vulnerability assessments in PCI DSS version 4.0? |\n",
417
+ "| | | Las nuevas requisitos para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS incluyen resolver vulnerabilidades con una puntuación de 4.0 o más en el CVSS, realizar rescans cuando sea necesario, y tener un método de penetration testing definido, documentado e implementado que incluye enfoques aceptados por la industria y cobertura para el perímetro del SDE y los sistemas críticos. | The new requirements for vulnerability assessments in PCI DSS version 4.0 include resolving vulnerabilities with a CVSS score of 4.0 or higher, performing rescans when necessary, and having a defined, documented, and implemented penetration testing method that includes industry-accepted approaches and coverage for the CDE perimeter and critical systems. |\n",
418
+ "| 3 | orca-2-13b | ¿Puedes dar más detalles sobre las prácticas de prueba de penetración en PCI DSS? | Can you provide more details about penetration testing practices in PCI DSS? |\n",
419
+ "| | | Sí, puedo dar más detalles sobre las prácticas de prueba de penetración en PCI DSS. La PCI DSS requiere que se realice un penetration testing externo al menos una vez cada 12 meses y después de cualquier modificación o cambio significativo en la infraestructura o el software. El penetration testing debe ser realizado por un recurso interno calificado o un tercero de fuera de la organización calificado y debe cumplir con la metodología definida por la entidad. Además, las vulnerabilidades y debilidades de seguridad que se encuentren durante el penetration testing deben ser corregidas y verificadas mediante la repetición del testing. | Yes, I can provide more details about penetration testing practices in PCI DSS. The PCI DSS requires that external penetration testing be conducted at least once every 12 months and after any significant modification or change in the infrastructure or software. The penetration testing must be conducted by a qualified internal resource or a qualified third party from outside the organization and must comply with the methodology defined by the entity. Additionally, the security vulnerabilities and weaknesses that are found during the penetration testing must be corrected and verified by repeating the testing. |\n"
420
+ ]
421
+ }
422
+ ],
423
+ "source": [
424
+ "print(orca_2_13b_df.to_markdown())"
425
+ ]
426
+ },
427
+ {
428
+ "cell_type": "markdown",
429
+ "metadata": {},
430
+ "source": [
431
+ "### Translation of Contents Generated by Orca-2-13b\n",
432
+ "\n",
433
+ "| | Model Name | LLM Generated Content | Translation by GPT-4-Turbo |\n",
434
+ "|---:|:-------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n",
435
+ "| 1 | orca-2-13b | ¿Puedes resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS? | Can you summarize the changes made from version 3.2.1 to version 4.0 of PCI DSS? |\n",
436
+ "| | | Sí, puedo resumir los cambios realizados desde la versión 3.2.1 hasta la versión 4.0 de PCI DSS. Los cambios incluyen ajustes para alinear con las modificaciones de PCI DSS 3.2 a PCI DSS 3.2.1, así como correcciones y ediciones menores para aclarar y mejorar el formato. Luego, en la versión 4.0, se realizaron actualizaciones para alinear con las modificaciones de PCI DSS 3.2.1 a PCI DSS 4.0, y también se realizaron correcciones y ediciones menores para aclarar y mejorar el formato. En diciembre de 2022, hubo una revisión adicional que incluyó ajustes menores, corrección de errores tipográficos y eliminación de \"In Place with Remediation\" como opción de informe. | Yes, I can summarize the changes made from version 3.2.1 to version 4.0 of PCI DSS. The changes include adjustments to align with the modifications from PCI DSS 3.2 to PCI DSS 3.2.1, as well as minor corrections and edits to clarify and improve the format. Then, in version 4.0, updates were made to align with the modifications from PCI DSS 3.2.1 to PCI DSS 4.0, and there were also minor corrections and edits made to clarify and improve the format. In December 2022, there was an additional revision that included minor adjustments, correction of typographical errors, and the removal of \"In Place with Remediation\" as a reporting option. |\n",
437
+ "| 2 | orca-2-13b | ¿Cuáles son las nuevas requisitos para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS? | What are the new requirements for vulnerability assessments in PCI DSS version 4.0? |\n",
438
+ "| | | Las nuevas requisitos para las evaluaciones de vulnerabilidades en la versión 4.0 de PCI DSS incluyen resolver vulnerabilidades con una puntuación de 4.0 o más en el CVSS, realizar rescans cuando sea necesario, y tener un método de penetration testing definido, documentado e implementado que incluye enfoques aceptados por la industria y cobertura para el perímetro del SDE y los sistemas críticos. | The new requirements for vulnerability assessments in PCI DSS version 4.0 include resolving vulnerabilities with a CVSS score of 4.0 or higher, performing rescans when necessary, and having a defined, documented, and implemented penetration testing method that includes industry-accepted approaches and coverage for the CDE perimeter and critical systems. |\n",
439
+ "| 3 | orca-2-13b | ¿Puedes dar más detalles sobre las prácticas de prueba de penetración en PCI DSS? | Can you provide more details about penetration testing practices in PCI DSS? |\n",
440
+ "| | | Sí, puedo dar más detalles sobre las prácticas de prueba de penetración en PCI DSS. La PCI DSS requiere que se realice un penetration testing externo al menos una vez cada 12 meses y después de cualquier modificación o cambio significativo en la infraestructura o el software. El penetration testing debe ser realizado por un recurso interno calificado o un tercero de fuera de la organización calificado y debe cumplir con la metodología definida por la entidad. Además, las vulnerabilidades y debilidades de seguridad que se encuentren durante el penetration testing deben ser corregidas y verificadas mediante la repetición del testing. | Yes, I can provide more details about penetration testing practices in PCI DSS. The PCI DSS requires that external penetration testing be conducted at least once every 12 months and after any significant modification or change in the infrastructure or software. The penetration testing must be conducted by a qualified internal resource or a qualified third party from outside the organization and must comply with the methodology defined by the entity. Additionally, the security vulnerabilities and weaknesses that are found during the penetration testing must be corrected and verified by repeating the testing. "
441
+ ]
442
+ }
443
+ ],
444
+ "metadata": {
445
+ "kernelspec": {
446
+ "display_name": "Python 3 (ipykernel)",
447
+ "language": "python",
448
+ "name": "python3"
449
+ },
450
+ "language_info": {
451
+ "codemirror_mode": {
452
+ "name": "ipython",
453
+ "version": 3
454
+ },
455
+ "file_extension": ".py",
456
+ "mimetype": "text/x-python",
457
+ "name": "python",
458
+ "nbconvert_exporter": "python",
459
+ "pygments_lexer": "ipython3",
460
+ "version": "3.9.18"
461
+ }
462
+ },
463
+ "nbformat": 4,
464
+ "nbformat_minor": 4
465
+ }
results/all_data.xlsx ADDED
Binary file (38.7 kB). View file
 
results/perf_data.xlsx ADDED
Binary file (6.1 kB). View file
 
results/perf_data_nvidia_4080.xlsx ADDED
Binary file (5.87 kB). View file
 
results/raw_data.xlsx ADDED
Binary file (28.9 kB). View file
 
results/raw_data_nvidia_4080.xlsx ADDED
Binary file (25.8 kB). View file