File size: 2,206 Bytes
3943768
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
set -o pipefail
set -ex

echo -e "\n\n\n\t\tSTART\n\n\n";

# ensure not in h2ogpt repo folder
cd $HOME

# Check if the h2ogpt directory already exists
if [ -d "h2ogpt" ]; then
    echo "h2ogpt directory exists. Updating the repository."
    cd h2ogpt
    git stash 2>&1
    git pull 2>&1
else
    echo "h2ogpt directory does not exist. Cloning the repository."
    git clone https://github.com/h2oai/h2ogpt.git
    cd h2ogpt
fi

if ! command -v conda &> /dev/null; then
    echo "Conda not found, installing Miniconda."
    wget https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Linux-x86_64.sh
    bash ./Miniconda3-py310_23.1.0-1-Linux-x86_64.sh -b -u
    source ~/miniconda3/bin/activate
    conda init bash
    conda deactivate
else
    echo "Conda is already installed."
    source ~/miniconda3/bin/activate
    conda init bash
    conda deactivate
fi

if [ "$CONDA_DEFAULT_ENV" = "h2ogpt" ]; then
    echo "Deactivating the h2ogpt Conda environment."
    conda deactivate
else
    echo "The h2ogpt Conda environment is not currently activated."
fi

echo "Installing fresh h2oGPT env."
if conda env list | grep -q 'h2ogpt'; then
    conda remove -n h2ogpt --all -y
else
    echo "h2ogpt environment does not exist."
fi
conda update conda -y
conda create -n h2ogpt -y
conda activate h2ogpt
conda install python=3.10 -c conda-forge -y

export CUDA_HOME=/usr/local/cuda-12.1
export PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/cu121"
export GGML_CUDA=1
export CMAKE_ARGS="-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=all"
export FORCE_CMAKE=1

# get patches
curl -O  https://h2o-release.s3.amazonaws.com/h2ogpt/run_patches.sh
curl -O https://h2o-release.s3.amazonaws.com/h2ogpt/trans.patch
curl -O https://h2o-release.s3.amazonaws.com/h2ogpt/xtt.patch
curl -O https://h2o-release.s3.amazonaws.com/h2ogpt/trans2.patch
curl -O https://h2o-release.s3.amazonaws.com/h2ogpt/google.patch
mkdir -p docs
alias cp='cp'
cp run_patches.sh trans.patch xtt.patch trans2.patch google.patch docs/

echo "Installing fresh h2oGPT"
set +x
export GPLOK=1
curl -fsSL https://h2o-release.s3.amazonaws.com/h2ogpt/linux_install.sh | bash


echo -e "\n\n\n\t\t h2oGPT installation FINISHED\n\n\n";