Skip to content

Commit c884756

Browse files
authored
Merge pull request #51 from kretes/py_310
python 3.10
2 parents 2923985 + 1536380 commit c884756

File tree

4 files changed

+35
-10
lines changed

4 files changed

+35
-10
lines changed

Dockerfile

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM python:3.7
1+
ARG arch_version
2+
3+
FROM python:3.10 as base
24

35
MAINTAINER MLR <[email protected]>
46

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

810
RUN make -C /allrank install-reqs
911

10-
WORKDIR /allrank
12+
WORKDIR /allrank
13+
14+
FROM base as CPU
15+
RUN python3 -m pip install torchvision==0.14.1 torch==1.13.1 --extra-index-url https://download.pytorch.org/whl/cpu
16+
17+
FROM base as GPU
18+
RUN python3 -m pip install torchvision==0.14.1 torch==1.13.1
19+
20+
FROM ${arch_version} as FINAL

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ To help you get started, we provide a ```run_example.sh``` script which generate
3333
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
3434
and the results of the experiment in `test_run` directory. To run the example, Docker is required.
3535

36+
### Getting the right architecture version (GPU vs CPU-only)
37+
38+
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.
39+
40+
To do so pass `gpu` or `cpu` as `arch_version` build-arg in
41+
42+
```docker build --build-arg arch_version=${ARCH_VERSION}```
43+
44+
When calling `run_example.sh` you can select the proper version by a first cmd line argument e.g.
45+
46+
```run_example.sh gpu ...```
47+
48+
with `cpu` being the default if not specified.
49+
3650
### Configuring your model & training
3751

3852
To train your own model, configure your experiment in ```config.json``` file and run

scripts/run_example.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
DIR=$(dirname $0)
44
PROJECT_DIR="$(cd $DIR/..; pwd)"
55

6-
docker build -t allrank:latest $PROJECT_DIR
6+
ARCH_VERSION=${1:cpu}
7+
8+
docker build --build-arg arch_version=${ARCH_VERSION} --progress=plain -t allrank:latest $PROJECT_DIR
79
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'

setup.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@
77
README = (HERE / "README.md").read_text()
88

99
reqs = [
10-
"torch>=1.6.0, <=1.8.0",
11-
"torchvision>=0.7.0, <= 0.9.0",
12-
"scikit-learn>=0.23.0",
13-
"pandas>=1.0.5",
14-
"numpy>=1.18.5",
15-
"scipy>=1.4.1",
10+
"scikit-learn>=1.1.0, <=1.2.1",
11+
"pandas>=1.0.5, <=1.3.5",
12+
"numpy>=1.18.5, <=1.21.6",
13+
"scipy>=1.4.1, <=1.7.3",
1614
"attrs>=19.3.0",
1715
"flatten_dict>=0.3.0",
1816
"tensorboardX>=2.1.0",
1917
"gcsfs==0.6.2",
20-
"google-auth==1.27.1"
18+
"google-auth>=2.15.0",
19+
"fsspec <= 2023.1.0"
2120
]
2221

2322
setup(

0 commit comments

Comments
 (0)