From 5036f3a85f22b84bf2dd9c3ee0aa4ba56de0ff32 Mon Sep 17 00:00:00 2001 From: Leon Luithlen Date: Tue, 26 Nov 2024 11:18:36 +0100 Subject: [PATCH] Add -y to setup_ubuntu_instance.sh commands and update EC2_README --- evals/EC2_README.md | 44 +++++++++++++++++++++++----- evals/cloud/setup_ubuntu_instance.sh | 38 +++++++++--------------- 2 files changed, 51 insertions(+), 31 deletions(-) diff --git a/evals/EC2_README.md b/evals/EC2_README.md index 50a92bc27..8e3dccb11 100644 --- a/evals/EC2_README.md +++ b/evals/EC2_README.md @@ -1,3 +1,5 @@ +## Creating the EC2 Instance + Create an EC2 Instance with the `Ubuntu Image` @@ -12,23 +14,51 @@ DON'T FORGET TO ADD Or the evaluation run will run out of space --------------------------------------------------------- +Add a key pair login where you have access to the corresponding key file (*.pem) -Then ssh into the instance, run +## Accessing your instance and setup -source evals/cloud/setup_ubuntu_instance.sh +To ssh into the instance, you have to save your key pair file (*.pem) to an appropriate location, such as ~/.aws. After launching the instance, you can access the Instance Summary, and retrieve "Public IPv4 DNS" address. Then run + +`ssh -i PATH_TO_KEY ubuntu@IPv4ADDRESS` + +to gain command line access to the instance. + +To copy your current state of cognee, go to the folder that contains "cognee" on your local machine, zip it to cognee.zip and run: + +`zip -r cognee.zip cognee` +`scp -i PATH_TO_KEY cognee.zip ubuntu@IPv4ADDRESS:cognee.zip` + +And unzip cognee.zip in your SSH session: + +`sudo apt install unzip` +`unzip cognee.zip` + +Then run: +`cd cognee` +`source evals/cloud/setup_ubuntu_instance.sh` sudo usermod -aG docker $USER disconnect, and reconnect. +Confirm that `ubuntu` has been added to the docker user group with + +`groups | grep docker` + +## Running SWE-bench + Then enter a `screen` and activate the virtual env -screen -source venv/bin/activate +`screen` +`source venv/bin/activate` then, from cognee, you can run swe_bench: -python evals/eval_swe_bench --cognee_off --max_workers=N_CPUS +`cd cognee` -Building the environment images takes roughly 17 minutes \ No newline at end of file +`python evals/eval_swe_bench.py --cognee_off --max_workers=N_CPUS` + +Building the environment images should take roughly 17 minutes + +If the virtual env wasn't set up correctly for some reason, just run the last few lines of `setup_ubuntu_instance.sh` manually \ No newline at end of file diff --git a/evals/cloud/setup_ubuntu_instance.sh b/evals/cloud/setup_ubuntu_instance.sh index e5386c372..e05b761e2 100644 --- a/evals/cloud/setup_ubuntu_instance.sh +++ b/evals/cloud/setup_ubuntu_instance.sh @@ -1,43 +1,33 @@ - -sudo apt-get update -sudo apt-get install ca-certificates curl +sudo apt-get update -y +sudo apt-get install -y ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ - "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ - $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ - sudo tee /etc/apt/sources.list.d/docker.list > /dev/null -sudo apt-get update +"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ +sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update -y -sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin +sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo docker run hello-world -sudo apt install unzip +sudo apt install -y unzip -sudo apt-get install python3-virtualenv +sudo apt-get install -y python3-virtualenv -sudo add-apt-repository ppa:deadsnakes/ppa -sudo apt update +sudo add-apt-repository -y ppa:deadsnakes/ppa -sudo apt install python3.11 +sudo apt update -y + +sudo apt install -y python3.11 virtualenv venv --python=python3.11 source venv/bin/activate - pip install poetry - poetry install - -pip install swebench transformers sentencepiece - -groups | grep docker - -python evals/eval_swe_bench.py --cognee_off - -sudo usermod -aG docker $USER - +pip install swebench transformers sentencepiece datasets tiktoken protobuf