forked from pythaiml/automindx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aglm.install
116 lines (98 loc) · 4.1 KB
/
aglm.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env bash
# Script Description:
# This script automates the setup and installation of the aGLM environment, including Miniconda, required packages, and the automindx repository.
# Tested on Ubuntu 22.04.6 LTS, Linux Mint 21.2, and Manjaro Linux
# Expanding from https://github.com/pythaiml/automindx/ creates aGLM Autonomous General Learning Model with MASTERMIND and RAGE
# 4096chunk.py is currently disabled; the model will crash on inputs above 4096 characters
# To do: upgrade to Mixtral or LLAMA3
# Copyright Information:
# codephreak (c) codephreak MIT licence 2023
# automindx (c) codephreak 2023 BSD licence
# mastermind (c) codephreak GPLv3 2024
# aGLM (c) codephreak Apache licence 2024
# Ensure the script is run with sudo privileges
#if [ "$(id -u)" != "0" ]; then
# echo "This script must be run as root" 1>&2
# exit 1
#fi
# Detect the user's shell
USER_SHELL=$(basename $SHELL)
echo "Detected shell: $USER_SHELL"
# Update PATH in the user's shell initialization file
INIT_FILE="$HOME/.${USER_SHELL}rc"
echo "Updating $INIT_FILE with necessary paths..."
# Source the initialization file to apply changes
if [ -f "$INIT_FILE" ]; then
source "$INIT_FILE"
else
echo "Initialization file not found, please check your shell settings."
exit 1
fi
# Prompt user to upgrade the system
read -p "Would you like to upgrade your apt-based system? (y/n): " UPGRADE_SYSTEM
if [[ $UPGRADE_SYSTEM =~ ^[Yy]$ ]]; then
echo "Upgrading system..."
sudo apt-get update && sudo apt-get upgrade -y && sudo apt install git hardinfo -y
echo "System upgrade completed."
else
echo "Skipping system upgrade."
fi
# Check and install Miniconda
if command -v conda &> /dev/null; then
echo "Miniconda is already installed."
read -p "Do you want to install Miniconda over your existing Miniconda? (y/n): " REINSTALL
if [[ $REINSTALL =~ ^[Yy]$ ]]; then
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p "$HOME/miniconda3"
rm miniconda.sh
else
echo "Using the existing Miniconda installation."
fi
else
echo "Installing Miniconda..."
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p "$HOME/miniconda3"
rm miniconda.sh
fi
# Clone the automindx repository and enter working directory
echo "Cloning the automindx repository..."
git clone https://github.com/GATERAGE/aglm/
cd aglm
pwd
ls -l
# Initialize Conda for the detected shell
conda init $USER_SHELL
# Check if the 'automindx' environment already exists
if conda env list | grep -q "automindx"; then
echo "The 'automindx' environment already exists."
read -p "Would you like to remove and recreate the 'automindx' environment? (y/n): " RECREATE_ENV
if [[ $RECREATE_ENV =~ ^[Yy]$ ]]; then
echo "Removing existing 'automindx' environment..."
conda remove --name automindx --all -y
echo "Creating new 'automindx' environment with Python 3.11.4..."
conda create --name automindx python=3.11.4 -y
else
echo "Using existing 'automindx' environment."
fi
else
echo "Creating new 'automindx' environment with Python 3.11.4..."
conda create --name automindx python=3.11.4 -y
fi
# Activate the 'automindx' environment
conda activate automindx
# Re-source the initialization file after conda changes
if [ -f "$INIT_FILE" ]; then
source "$INIT_FILE"
else
echo "Failed to source $INIT_FILE after Conda initialization."
exit 1
fi
# Show conda environments with the current marked with *
conda info --envs
# Install requirements to automindx builder in the conda environment from requirements.txt
echo "Installing Python packages from requirements.txt..."
pip install -r requirements.txt
# Execute the UIUX script with parameters
echo "Running UIUX.py..."
python3 UIUX17.py --model_name="TheBloke/llama2-7b-chat-codeCherryPop-qLoRA-GGML" --tokenizer_name="TheBloke/llama2-7b-chat-codeCherryPop-qLoRA-GGML" --model_type="ggml" --save_history --file_name="llama-2-7b-chat-codeCherryPop.ggmlv3.q4_1.bin"
echo "aGLM setup completed successfully."