Skip to content

Commit 8380309

Browse files
committed
Refactor: Convert pytorch_connectomics from submodule to downloaded package
- Remove git submodule configuration (.gitmodules) - Add setup_pytorch_connectomics.sh script to download at commit 20ccfde (v1.0) - Update Dockerfile to download package instead of copying submodule - Update start.sh to auto-setup pytorch_connectomics if missing - Update README.md with new installation instructions - Add pytorch_connectomics/ to .gitignore to prevent accidental commits
1 parent d254cd1 commit 8380309

File tree

6 files changed

+61
-7
lines changed

6 files changed

+61
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.png
66
node_modules/
77
pytc/
8+
pytorch_connectomics/
89
logs/
910
data/
1011
outputs/

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "pytorch_connectomics"]
2-
path = pytorch_connectomics
3-
url = https://github.com/zudi-lin/pytorch_connectomics.git

Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#centOS
22
FROM nvidia/cuda:11.1.1-devel-ubi8
33

4-
# Enable AppStream and install Python 3.9
4+
# Enable AppStream and install Python 3.9 and git
55
RUN yum -y module enable python39 && \
66
yum install -y python39-3.9.2 && \
77
yum install -y python39-devel-3.9.2 && \
8+
yum install -y git && \
89
yum clean all && \
910
(python3.9 --version || echo "Python installation failed" && exit 1)
1011

@@ -21,7 +22,11 @@ WORKDIR /app
2122
# Install dependencies
2223
RUN pip3 install --no-cache-dir torch==1.9.0 torchvision==0.10.0 cuda-python==11.1.1
2324

24-
COPY ./pytorch_connectomics /app/pytorch_connectomics
25+
# Download pytorch_connectomics at specific commit (version 1.0)
26+
RUN git clone https://github.com/zudi-lin/pytorch_connectomics.git /app/pytorch_connectomics && \
27+
cd /app/pytorch_connectomics && \
28+
git checkout 20ccfde
29+
2530
COPY ./samples_pytc /app/samples_pytc
2631
COPY ./server_pytc /app/server_pytc
2732
COPY ./server_api /app/server_api
@@ -35,9 +40,10 @@ WORKDIR /app/server_api
3540
RUN pip3 install --no-cache-dir -r requirements.txt
3641

3742
WORKDIR /app
38-
# Copies the startup script, and runs it at CMD
43+
# Copies the startup scripts, and runs it at CMD
3944
COPY ./start.sh /app/
40-
RUN chmod +x start.sh
45+
COPY ./setup_pytorch_connectomics.sh /app/
46+
RUN chmod +x start.sh setup_pytorch_connectomics.sh
4147

4248
# Expose ports
4349
EXPOSE 4242 4243 4244 6006

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,17 @@ pip install -r requirements.txt
6262

6363
In root folder,
6464
```bash
65+
# The setup script will automatically download pytorch_connectomics at commit 20ccfde (version 1.0)
66+
./setup_pytorch_connectomics.sh
67+
cd pytorch_connectomics
68+
pip install --editable .
69+
```
70+
71+
Alternatively, you can run this manually:
72+
```bash
6573
git clone https://github.com/zudi-lin/pytorch_connectomics.git
6674
cd pytorch_connectomics
75+
git checkout 20ccfde
6776
pip install --editable .
6877
```
6978

setup_pytorch_connectomics.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
# Setup script for pytorch_connectomics
4+
# Downloads the repository at commit 20ccfde (version 1.0)
5+
6+
set -e
7+
8+
PYTORCH_CONNECTOMICS_COMMIT="20ccfde"
9+
REPO_URL="https://github.com/zudi-lin/pytorch_connectomics.git"
10+
PYTORCH_CONNECTOMICS_DIR="pytorch_connectomics"
11+
12+
echo "Setting up pytorch_connectomics at commit ${PYTORCH_CONNECTOMICS_COMMIT}"
13+
14+
# Remove existing directory if it exists
15+
if [ -d "${PYTORCH_CONNECTOMICS_DIR}" ]; then
16+
echo "Removing existing ${PYTORCH_CONNECTOMICS_DIR} directory"
17+
rm -rf "${PYTORCH_CONNECTOMICS_DIR}"
18+
fi
19+
20+
# Clone the repository
21+
echo "Cloning pytorch_connectomics repository..."
22+
git clone "${REPO_URL}" "${PYTORCH_CONNECTOMICS_DIR}"
23+
24+
# Change to the directory and checkout the specific commit
25+
cd "${PYTORCH_CONNECTOMICS_DIR}"
26+
echo "Checking out commit ${PYTORCH_CONNECTOMICS_COMMIT}..."
27+
git checkout "${PYTORCH_CONNECTOMICS_COMMIT}"
28+
29+
# Return to parent directory
30+
cd ..
31+
32+
echo "pytorch_connectomics setup complete!"
33+
echo "To install, run: cd ${PYTORCH_CONNECTOMICS_DIR} && pip install --editable ."

start.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
22

3+
# Setup pytorch_connectomics if not already present
4+
if [ ! -d "pytorch_connectomics" ]; then
5+
echo "Setting up pytorch_connectomics..."
6+
./setup_pytorch_connectomics.sh
7+
echo "Installing pytorch_connectomics..."
8+
cd pytorch_connectomics && pip3 install --editable . && cd ..
9+
fi
10+
311
# Install dependencies in ./server_api
412
pip3 install -r server_api/requirements.txt
513

0 commit comments

Comments
 (0)