Skip to content

Commit

Permalink
Add CPU specific requirements file to install dependencies (#915)
Browse files Browse the repository at this point in the history
* Update CPU install dependencies

* Added stable channel

* Update cpu requirements for windows too

* Typo in Windows requirement install

* Typo in Windows requirement install

* Update Docker dev file dependencies for CPU

* retrigger checks
  • Loading branch information
maaquib authored Dec 17, 2020
1 parent 6c078d6 commit ccff977
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion docker/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ RUN if [ "$MACHINE_TYPE" = "gpu" ]; then export USE_CUDA=1; fi \
&& git clone https://github.com/pytorch/serve.git \
&& cd serve \
&& git checkout ${BRANCH_NAME} \
&& python ts_scripts/install_dependencies.py --environment=dev --cuda $CUDA_VERSION \
&& if [ "$MACHINE_TYPE" = "gpu" ]; then \
python ts_scripts/install_dependencies.py --environment=dev --cuda $CUDA_VERSION; \
else \
python ts_scripts/install_dependencies.py --environment=dev; \
fi \
&& python ts_scripts/install_from_src.py \
&& useradd -m model-server \
&& mkdir -p /home/model-server/tmp \
Expand Down
6 changes: 5 additions & 1 deletion kubernetes/kfserving/kf_predictor_docker/Dockerfile_kf.dev
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ RUN if [ "$MACHINE_TYPE" = "gpu" ]; then export USE_CUDA=1; fi \
&& git clone https://github.com/pytorch/serve.git \
&& cd serve \
&& git checkout ${BRANCH_NAME} \
&& python ts_scripts/install_dependencies.py --environment=dev --cuda $CUDA_VERSION \
&& if [ "$MACHINE_TYPE" = "gpu" ]; then \
python ts_scripts/install_dependencies.py --environment=dev --cuda $CUDA_VERSION; \
else \
python ts_scripts/install_dependencies.py --environment=dev; \
fi \
&& python ts_scripts/install_from_src.py \
&& pip install captum \
&& pip install transformers\
Expand Down
4 changes: 4 additions & 0 deletions requirements/torch_cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
torch==1.7.1+cpu
torchvision==0.8.2+cpu
torchtext==0.8.1
torchaudio==0.7.2
8 changes: 6 additions & 2 deletions ts_scripts/install_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def install_nodejs(self):
pass

def install_torch_packages(self, cuda_version):
if cuda_version and cuda_version != "latest":
if cuda_version is None:
os.system(f"pip install -U -r requirements/torch_cpu.txt -f {self.torch_stable_url}")
elif cuda_version and cuda_version != "latest":
os.system(f"pip install -U -r requirements/torch_{cuda_version}.txt -f {self.torch_stable_url}")
else:
os.system(f"pip install -U -r requirements/torch.txt")
Expand Down Expand Up @@ -70,7 +72,9 @@ def __init__(self):
self.sudo_cmd = ''

def install_torch_packages(self, cuda_version):
if cuda_version and cuda_version != "latest":
if cuda_version is None:
os.system(f"pip install -U -r requirements/torch_cpu.txt -f {self.torch_stable_url}")
elif cuda_version and cuda_version != "latest":
os.system(f"pip install -U -r requirements/torch_{cuda_version}.txt -f {self.torch_stable_url}")
else:
os.system(f"pip install -U -r requirements/torch.txt -f {self.torch_stable_url}")
Expand Down

0 comments on commit ccff977

Please sign in to comment.