Skip to content

Commit

Permalink
Merge pull request #51 from kretes/py_310
Browse files Browse the repository at this point in the history
python 3.10
  • Loading branch information
lidalida authored Sep 29, 2023
2 parents 2923985 + 1536380 commit c884756
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
14 changes: 12 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM python:3.7
ARG arch_version

FROM python:3.10 as base

MAINTAINER MLR <[email protected]>

Expand All @@ -7,4 +9,12 @@ COPY requirements.txt setup.py Makefile README.md /allrank/

RUN make -C /allrank install-reqs

WORKDIR /allrank
WORKDIR /allrank

FROM base as CPU
RUN python3 -m pip install torchvision==0.14.1 torch==1.13.1 --extra-index-url https://download.pytorch.org/whl/cpu

FROM base as GPU
RUN python3 -m pip install torchvision==0.14.1 torch==1.13.1

FROM ${arch_version} as FINAL
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ To help you get started, we provide a ```run_example.sh``` script which generate
a Transformer model on the data using provided example ```config.json``` config file. Once you run the script, the dummy data can be found in `dummy_data` directory
and the results of the experiment in `test_run` directory. To run the example, Docker is required.

### Getting the right architecture version (GPU vs CPU-only)

Since torch binaries are different for GPU and CPU and GPU version doesn't work on CPU - one must select & build appropriate docker image version.

To do so pass `gpu` or `cpu` as `arch_version` build-arg in

```docker build --build-arg arch_version=${ARCH_VERSION}```

When calling `run_example.sh` you can select the proper version by a first cmd line argument e.g.

```run_example.sh gpu ...```

with `cpu` being the default if not specified.

### Configuring your model & training

To train your own model, configure your experiment in ```config.json``` file and run
Expand Down
4 changes: 3 additions & 1 deletion scripts/run_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
DIR=$(dirname $0)
PROJECT_DIR="$(cd $DIR/..; pwd)"

docker build -t allrank:latest $PROJECT_DIR
ARCH_VERSION=${1:cpu}

docker build --build-arg arch_version=${ARCH_VERSION} --progress=plain -t allrank:latest $PROJECT_DIR
docker run -e PYTHONPATH=/allrank -v $PROJECT_DIR:/allrank allrank:latest /bin/sh -c 'python allrank/data/generate_dummy_data.py && python allrank/main.py --config-file-name /allrank/scripts/local_config.json --run-id test_run --job-dir /allrank/test_run'
13 changes: 6 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
README = (HERE / "README.md").read_text()

reqs = [
"torch>=1.6.0, <=1.8.0",
"torchvision>=0.7.0, <= 0.9.0",
"scikit-learn>=0.23.0",
"pandas>=1.0.5",
"numpy>=1.18.5",
"scipy>=1.4.1",
"scikit-learn>=1.1.0, <=1.2.1",
"pandas>=1.0.5, <=1.3.5",
"numpy>=1.18.5, <=1.21.6",
"scipy>=1.4.1, <=1.7.3",
"attrs>=19.3.0",
"flatten_dict>=0.3.0",
"tensorboardX>=2.1.0",
"gcsfs==0.6.2",
"google-auth==1.27.1"
"google-auth>=2.15.0",
"fsspec <= 2023.1.0"
]

setup(
Expand Down

0 comments on commit c884756

Please sign in to comment.