Skip to content

Commit

Permalink
fix: Add non-interactive Docker environment for SWE-bench evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexCuadron committed Feb 17, 2025
1 parent 30e39e8 commit 157fe37
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
14 changes: 14 additions & 0 deletions evaluation/swe_bench/scripts/docker/docker_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Set Docker to run non-interactively
export DOCKER_BUILDKIT=1
export DOCKER_SCAN_SUGGEST=false
export DEBIAN_FRONTEND=noninteractive

# Function to run Docker commands with yes piped in
docker_noninteractive() {
yes | "$@"
}

# Alias docker to use the non-interactive function
alias docker=docker_noninteractive
69 changes: 69 additions & 0 deletions evaluation/swe_bench/scripts/docker/pull_all_eval_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
set -e

# Source the Docker environment settings
source "$(dirname "$0")/docker_env.sh"

LEVEL=$1
# three levels:
# - base, keyword "sweb.base"
# - env, keyword "sweb.env"
# - instance, keyword "sweb.eval"
SET=$2

if [ -z "$LEVEL" ]; then
echo "Usage: $0 <cache_level> <set>"
echo "cache_level: base, env, or instance"
echo "set: lite, full"
exit 1
fi

if [ -z "$SET" ]; then
echo "Usage: $0 <cache_level> <set>"
echo "cache_level: base, env, or instance"
echo "set: lite, full, default is lite"
SET="lite"
fi

# Check if namespace is provided via argument $3, otherwise default to 'xingyaoww'
NAMESPACE=${3:-xingyaoww}

echo "Using namespace: $NAMESPACE"

if [ "$SET" == "lite" ]; then
IMAGE_FILE="$(dirname "$0")/all-swebench-lite-instance-images.txt"
else
IMAGE_FILE="$(dirname "$0")/all-swebench-full-instance-images.txt"
fi

# Define a pattern based on the level
case $LEVEL in
base)
PATTERN="sweb.base"
;;
env)
PATTERN="sweb.base\|sweb.env"
;;
instance)
PATTERN="sweb.base\|sweb.env\|sweb.eval"
;;
*)
echo "Invalid cache level: $LEVEL"
echo "Valid levels are: base, env, instance"
exit 1
;;
esac

echo "Pulling docker images for [$LEVEL] level"

echo "Pattern: $PATTERN"
echo "Image file: $IMAGE_FILE"

# Read each line from the file, filter by pattern, and pull the docker image
grep "$PATTERN" "$IMAGE_FILE" | while IFS= read -r image; do
echo "Pulling $NAMESPACE/$image into $image"
docker pull $NAMESPACE/$image
# replace _s_ to __ in the image name
renamed_image=$(echo "$image" | sed 's/_s_/__/g')
docker tag $NAMESPACE/$image $renamed_image
done

0 comments on commit 157fe37

Please sign in to comment.