Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,14 @@ conda_env/
build/
dist/
*.egg-info
# Ignore version control system folders
.git/
.gitignore
# Ignore OS-specific hidden files
.DS_Store
Thumbs.db
# If you have a big data directory or logs, ignore those too
data/
logs/

# jupyter notebooks
.ipynb_checkpoints
__pycache__/
# processed data
processed_data/*
!processed_data/.gitkeep
# results
results/*
!results/.gitkeep
# idea
.idea/
.idea/*
.swp
*.swp
.log
*.log
examples/A_to_Z/processed_data/*
36 changes: 14 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
# Step 1: Use the official TensorFlow 2.11 image as the base
FROM tensorflow/tensorflow:2.11.0
FROM continuumio/miniconda3

# Step 2: Install system dependencies
RUN apt-get update && apt-get install -y \
git \
wget \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace

# Step 3: Upgrade pip to the latest version
RUN python3 -m pip install --upgrade pip
COPY requirements_GenNet.txt .

# Step 4: Copy your requirements file into the container
COPY requirements_GenNet.txt /tmp/requirements_GenNet.txt
# Create the environment
RUN conda create -n env_GenNet python=3.10.12 -y

# Step 5: Install Python packages
RUN pip install --no-cache-dir -r /tmp/requirements_GenNet.txt
# Install pip packages
RUN /bin/bash -c "source activate env_GenNet && \
pip install --upgrade pip && \
pip install -r requirements_GenNet.txt"

# Step 6: Set the working directory
WORKDIR /app
COPY . /workspace

# Step 7: Copy your project files into the container
COPY . /app
# RUN mkdir -p /workspace/processed_data /workspace/results

# Step 8: Set environment variables (optional)
ENV RESULT_PATH="/app/results"
ENV DATA_PATH="/app/examples"
RUN echo "conda activate env_GenNet" >> ~/.bashrc

# Step 9: Define the entrypoint to simplify CLI usage
ENTRYPOINT ["python", "GenNet.py"]
# Set CMD to launch bash with environment activated
CMD ["/bin/bash", "-c", "source activate env_GenNet && exec bash"]
62 changes: 59 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ The Gennet framework is based on tensorflow, click [here](GenNet_utils/LocallyDi

## 2. Getting started

GenNet can be used in two ways:
- Manual installation: clone the repository and set up the virtual environment.
- Use the docker image.

### 1. Manual installation

Follow the instructions below to get started.

> [!TIP]
> Check the [A to Z Colab tutorial](https://colab.research.google.com/github/ArnovanHilten/GenNet/blob/master/examples/A_to_Z/GenNet_A_to_Z.ipynb) for an overview on how to use GenNet with your own data!

### Prerequisites:
#### Prerequisites:

- GenNet is optimized to use Tensorflow on CPU using multiple-cores as sparse matrix multiplcations does not benefit from GPU acceleration. We are currently restricting testing and recommending using:

Expand All @@ -38,13 +44,13 @@ Follow the instructions below to get started.



### Clone the repository
#### Clone the repository

Open terminal. Navigate to the a place where you want to store the project. Clone the repository:
```
git clone https://github.com/arnovanhilten/GenNet
```
### Install the virtual envionment
#### Install the virtual envionment

**Create a virtual environment**
```
Expand Down Expand Up @@ -73,6 +79,56 @@ python GenNet.py train -path ./examples/example_classification/ -ID 1

Check the [wiki](https://github.com/ArnovanHilten/GenNet/wiki) for more info!


### 2. Docker

Make sure that you have [docker](https://www.docker.com/) installed:

#### Pull the Docker image
```bash
docker pull avanhilten/gennet-image:latest
```
#### Run the docker

In Linux/macOS/WSL:

```bash
docker run --rm -it \
-v $(pwd)/examples:/workspace/examples \
-v $(pwd)/processed_data:/workspace/processed_data \
-v $(pwd)/results:/workspace/results \ avanhilten/gennet-image \
```
Or in powershell:
```
powershell docker run --rm -it -v C:\Users\YOURNAME\GenNet\examples:/workspace/examples `
-v C:\Users\YOURNAME\GenNet\processed_data:/workspace/processed_data `
-v C:\Users\YOURNAME\GenNet\results:/workspace/results `
avanhilten/gennet-image
```
> Replace `YOURNAME` with your actual Windows username and adjust the paths if needed.

Then all GenNet commands can be utilized, such as:
```
python GenNet.py train -path /workspace/examples/example_classification -ID 1 -out results
```

> [!CAUTION]
> Output argument required
> Always include the
> `-out /workspace/results` argument when running in Docker to ensure results are written to the mounted `results/` folder on your machine.

#### Running on your own data

You can mount your own input/output directories:
```bash
docker run --rm -it \
-v /path/to/my_data:/workspace/my_data \
-v /path/to/output:/workspace/output \
avanhilten/gennet-image \

python GenNet.py train -path /workspace/my_data -ID 7 -out /workspace/output
```

## 3. GenNet command line.
<img align = "right" src="https://github.com/ArnovanHilten/GenNet/blob/master/figures/Gennet_wiki_overview.png?raw=true" width="480">

Expand Down