Skip to content

Commit 5118e30

Browse files
ESM Changes (#43)
Updated readme for docker with proxy instructions. Minor code changes to enable docker with proxy
1 parent 6145e01 commit 5118e30

File tree

3 files changed

+58
-49
lines changed

3 files changed

+58
-49
lines changed

applications/esm/Dockerfile.esm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ RUN bash -c "source ${HOME}/conda/etc/profile.d/conda.sh && \
1414
source ${HOME}/conda/etc/profile.d/mamba.sh && \
1515
mamba activate esm_py11 && \
1616
pip install . &&\
17-
pip install torch==2.4.0+cpu torchvision==0.19.0+cpu torchaudio==2.4.0+cpu --index-url https://download.pytorch.org/whl/cpu && \
18-
pip install intel-extension-for-pytorch==2.4.0"
17+
pip install torch==2.4.0+cpu torchvision==0.19.0+cpu torchaudio==2.4.0+cpu --index-url https://download.pytorch.org/whl/cpu"
1918

2019
RUN echo "#!/bin/bash" >> /app/init.sh && \
2120
echo "source ${HOME}/conda/etc/profile.d/conda.sh" >> /app/init.sh && \

applications/esm/README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,24 @@
44
Open-Omics-ESM is an optimized version of the Evolutionary Scale Modeling (ESM) toolkit, tailored for modern CPUs. It enhances the performance of key ESM modules—such as ESM-embeddings, LM-Design, InverseFolding, and ESMFold—by leveraging the Intel Extension for PyTorch (IPEX), the latest version of PyTorch, and lower-precision (bf16) computations.
55

66
## Installation
7-
### Step 1: Run the script to create the Docker images
8-
Execute the script using the following command:
7+
### Step 1: 🛠️ Building the Docker Image
8+
Run the following command to build the Docker image:
99

1010
```bash
11-
./build_docker_images.sh
11+
./build_docker_images.sh
1212
```
13+
#### 🌐 Building Behind a Proxy
14+
If you're working in a corporate or institutional environment, your internet access may be routed through a proxy server. In such cases, Docker may not be able to download dependencies during the build process unless you explicitly configure proxy settings.
15+
16+
To build the Docker image with proxy settings, you can use the --build-arg option to pass your proxy configuration:
17+
18+
```bash
19+
./build_docker_images.sh --http_proxy=$http_proxy --https_proxy=$https_proxy --no_proxy=$no_proxy
20+
```
21+
🔒 Note: Make sure the environment variables http_proxy, https_proxy, and no_proxy are correctly set in your shell before running this command.
22+
23+
For more details, refer to the official Docker documentation:
24+
[Docker behind proxy](https://docs.docker.com/engine/cli/proxy/)
1325
### Step 2: Choose the ESM image to install
1426
Select the ESM image you want to build based on your specific needs
1527

applications/esm/build_docker_images.sh

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,25 @@ image_exists() {
1616
$runtime images -q "$image_name" | grep -q .
1717
}
1818

19+
# Parse optional proxy args from command-line
20+
for arg in "$@"; do
21+
case $arg in
22+
--http_proxy=*)
23+
http_proxy="${arg#*=}"
24+
;;
25+
--https_proxy=*)
26+
https_proxy="${arg#*=}"
27+
;;
28+
--no_proxy=*)
29+
no_proxy="${arg#*=}"
30+
;;
31+
*)
32+
echo "Unknown option: $arg"
33+
exit 1
34+
;;
35+
esac
36+
done
37+
1938
runtime=docker
2039
if ! command_exists "$runtime"; then
2140
echo "$runtime is not installed on your system. Please install it first."
@@ -33,65 +52,44 @@ echo "3 Both esm and esm_fold"
3352
read -r task_option
3453

3554
case $task_option in
36-
1)
37-
build_esm=true
38-
;;
39-
2)
40-
build_esmfold=true
41-
;;
42-
3)
43-
build_esm=true
44-
build_esmfold=true
45-
;;
46-
*)
47-
echo "Invalid option selected. Please choose 1, 2, or 3."
48-
exit 1
49-
;;
55+
1) build_esm=true ;;
56+
2) build_esmfold=true ;;
57+
3) build_esm=true; build_esmfold=true ;;
58+
*) echo "Invalid option selected. Please choose 1, 2, or 3."; exit 1 ;;
5059
esac
5160

5261
echo "build_esm = ${build_esm}"
5362
echo "build_esmfold = ${build_esmfold}"
5463

55-
# Function to build a Docker image with optional proxy arguments
64+
# Function to build Docker image
5665
build_image() {
57-
local image_name="$1"
58-
local dockerfile="$2"
59-
local args=()
60-
61-
# Add proxy arguments if set
62-
if [[ -n "$http_proxy" ]]; then
63-
args+=(--build-arg http_proxy=$http_proxy)
64-
fi
65-
if [[ -n "$https_proxy" ]]; then
66-
args+=(--build-arg https_proxy=$https_proxy)
67-
fi
68-
if [[ -n "$no_proxy" ]]; then
69-
args+=(--build-arg no_proxy=$no_proxy)
70-
fi
71-
72-
# Add the BASE_IMAGE argument
73-
args+=(--build-arg BASE_IMAGE=$BASE_IMAGE)
74-
75-
# Execute the build command
76-
$runtime build "${args[@]}" -f "$dockerfile" -t "$image_name" .
66+
local image_name="$1"
67+
local dockerfile="$2"
68+
local args=(--build-arg BASE_IMAGE=$BASE_IMAGE)
69+
70+
[[ -n "$http_proxy" ]] && args+=(--build-arg http_proxy=$http_proxy)
71+
[[ -n "$https_proxy" ]] && args+=(--build-arg https_proxy=$https_proxy)
72+
[[ -n "$no_proxy" ]] && args+=(--build-arg no_proxy=$no_proxy)
73+
74+
$runtime build "${args[@]}" -f "$dockerfile" -t "$image_name" .
7775
}
7876

79-
# Build base image with optional proxy arguments
77+
# Build base image
8078
if ! image_exists "$BASE_IMAGE"; then
81-
echo "Building base image..."
82-
build_image "$BASE_IMAGE" "Dockerfile.base"
79+
echo "Building base image..."
80+
build_image "$BASE_IMAGE" "Dockerfile.base"
8381
fi
8482

85-
# Build image for esm
83+
# Build esm image
8684
if $build_esm && ! image_exists "$ESM_IMAGE"; then
87-
echo "Building image for esm..."
88-
build_image "$ESM_IMAGE" "Dockerfile.esm"
85+
echo "Building image for esm..."
86+
build_image "$ESM_IMAGE" "Dockerfile.esm"
8987
fi
9088

91-
# Build image for esm_fold
89+
# Build esm_fold image
9290
if $build_esmfold && ! image_exists "$ESMFOLD_IMAGE"; then
93-
echo "Building image for esm_fold..."
94-
build_image "$ESMFOLD_IMAGE" "Dockerfile.esmfold"
91+
echo "Building image for esm_fold..."
92+
build_image "$ESMFOLD_IMAGE" "Dockerfile.esmfold"
9593
fi
9694

9795
echo "Build process completed."

0 commit comments

Comments
 (0)