-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·76 lines (59 loc) · 2.31 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·76 lines (59 loc) · 2.31 KB
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
#!/bin/bash
# Delete the existing graphrag directory if it exists
if [ -d "graphrag" ]; then
rm -rf graphrag
fi
# Clone the GraphRag repository
git clone https://github.com/microsoft/graphrag.git
# Navigate into the graphrag directory
cd graphrag
# Check if poetry is installed, if not, notify the user and exit
if ! command -v poetry &> /dev/null
then
echo "Error: Poetry could not be found. Please install poetry before running this script."
echo "Visit https://python-poetry.org/docs/#installation for installation instructions."
exit 1
else
echo "Poetry is already installed"
fi
# Install dependencies using poetry (from pyproject.toml)
poetry install
# Rename the indexing folder to avoid conflicts with the graphrag package
mv ../indexing ../init/indexing
# Create the indexing folder
mkdir ../indexing
# Initialize the indexing folder using graphrag.index
poetry run python3 -m graphrag.index --init --root ../indexing
# Go back to the parent directory (root of graphrag repo) for the pip install step
cd ..
# Install the repository in editable mode
pip install -e ./graphrag
# Automatically replace or add files from the init folder to the project
echo "Processing files from init folder..."
# Loop through all files in the init folder and copy them to the corresponding locations in the project
find ./init -type f | while read src_file; do
# Determine the relative path of the file in the init directory
relative_path="${src_file#./init/}"
# Define the corresponding target file path in the project directory
target_file="./$relative_path"
# Check if the target file exists
if [ -f "$target_file" ]; then
# If the file exists, replace it
echo "Replacing $target_file with $src_file"
cp "$src_file" "$target_file"
else
# If the file doesn't exist, add it
echo "Adding new file $target_file from $src_file"
# Create the directory structure if it doesn't exist
mkdir -p "$(dirname "$target_file")"
# Copy the new file
cp "$src_file" "$target_file"
fi
done
# We no longer need the init/indexing folder
rm -rf ./init/indexing
# Install dependencies from requirements.txt
pip install -r requirements.txt
# Pull the required models using ollama
ollama pull mistral-nemo:12b-instruct-2407-fp16
ollama pull nomic-embed-text