Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

110 implement the chat bot user interface #117

Merged
merged 8 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/scripts/GUI/model_configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: DeepCNCFQuantized
context_size: 2048
f16: true
threads: 14
gpu_layers: 90
mmap: true
parameters:
# Reference any HF model or a local file here
#model: huggingface://TheBloke/phi-2-GGUF/phi-2.Q8_0.gguf
#model: huggingface://google/gemma-2b-it/gemma-2b-it.gguf
model: huggingface://Kubermatic/DeepCNCFQuantized/ggml-model-Q4_K_M.gguf
temperature: 0.7
top_k: 50
top_p: 0.95
#repetition_penalty: 1.0
#max_new_tokens: 1024
#stop: ["<|im_end|>"]

#backend: langchain-huggingface

template:

chat: &template |
Question: {{.Input}}
Answer:
# Modify the prompt template here ^^^ as per your requirements
completion: *template
20 changes: 20 additions & 0 deletions src/scripts/GUI/preparation_scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

## install NVIDIA Container Toolkit
# source: https://www.server-world.info/en/note?os=Ubuntu_22.04&p=nvidia&f=2
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add -
# result: OK
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu22.04/nvidia-docker.list > /etc/apt/sources.list.d/nvidia-docker.list
apt update
apt -y install nvidia-container-toolkit
systemctl restart docker
docker run --gpus all nvidia/cuda:11.5.2-base-ubuntu20.04 nvidia-smi # checks if NVIDIA Container Toolkit is installed


docker run -it --gpus all nvidia/cuda:12.5.0-base-ubuntu22.04 bash
docker run -p 8080:8080 --gpus all --name local-ai -ti localai/localai:latest-aio-gpu-nvidia-cuda-12

docker run -p 8080:8080 --gpus all --env-file .env localai/localai:v2.18.1-cublas-cuda12-ffmpeg-core https://raw.githubusercontent.com/amosproj/amos2024ss08-cloud-native-llm/110-implement-the-chat-bot-user-interface/src/scripts/GUI/model_configuration.yaml

# Run localai with model config from gist

docker run -p 8080:8080 --gpus all --env-file .env localai/localai:v2.18.1-cublas-cuda12-ffmpeg-core https://gist.githubusercontent.com/anosh-ar/91658012cccb8f74abb72ddc78bb71c8/raw/e00cca94739213ebf83e9074e3e9e3f74e55d7fb/model_config.yaml
2 changes: 1 addition & 1 deletion src/scripts/data_preparation/stackoverflow_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,4 @@ def load_tags() -> list:
print("directory is created")
tags = load_tags()

extract_all_projects(tags)
extract_all_projects(tags)
3 changes: 2 additions & 1 deletion src/scripts/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def merge_data() -> None:
'answer': 'Answer',
'tag': 'Project'
})

# Drop additional columns
df2 = df2.drop(['question_id', 'score'], axis=1)
# Concatenate the selected and renamed columns
merged_df = pd.concat([df1_selected, df2_selected])

Expand Down