Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ commands:
steps:
- run:
name: "Install dependencies via pip"
command: ./scripts/install_via_pip.sh -v 1.8.1 << parameters.args >>
command: ./scripts/install_via_pip.sh << parameters.args >>

lint_flake8:
description: "Lint with flake8"
Expand Down
6 changes: 3 additions & 3 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
torch==1.8.1
torchvision>=0.9.1
torch
torchvision
tqdm>=4.40
requests>=2.25.1
black
Expand All @@ -9,7 +9,6 @@ sphinx
sphinx-autodoc-typehints
mypy>=0.760
isort
torchcsprng
hypothesis
tensorboard
datasets
Expand All @@ -18,3 +17,4 @@ scikit-learn
pytorch-lightning
lightning-bolts
jsonargparse[signatures]>=3.19.3 # required for Lightning CLI
-e git+https://github.com/pytorch/csprng.git@cd8f2f670355f5a9b345dbe2cb58a52fb2c44d39#egg=torchcsprng
5 changes: 3 additions & 2 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ If you are getting an error like this, `ImportError: libcudart.so.10.2: cannot o

The fix is to just install the package for the right Cuda version you have :)

Here's the copypasta to install PyTorch with CUDA 10.1:
Here's the copypasta to install PyTorch with CUDA 10.2:

```
pip install torchcsprng==0.1.2+cu101 torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
pip3 install torch torchvision torchaudio
pip install git+https://github.com/pytorch/csprng.git#egg=torchcsprng
```

After this, you can just `pip install opacus` and it will work :)
Expand Down
9 changes: 7 additions & 2 deletions scripts/install_via_pip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,20 @@ export TERM=xterm
# upgrade pip
pip install --upgrade pip

# install without dependencies first
# this is needed because csprng temporarily depends on the source
# we need to have torch installed to correctly install .[dev]
pip install -e . --user

# install with dev dependencies
pip install -e .[dev] --user

# install pytorch nightly if asked for
if [[ $PYTORCH_NIGHTLY == true ]]; then
if [[ $CUDA == true ]]; then
pip install --upgrade --pre torch torchvision torchcsprng -f https://download.pytorch.org/whl/nightly/cu101/torch_nightly.html
pip install --upgrade --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu101/torch_nightly.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be cu102 since you are changing Cuda version to 10.2?

else
pip install --upgrade --pre torch torchvision torchcsprng -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
pip install --upgrade --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
fi
else
# If no version specified, upgrade to latest release.
Expand Down
7 changes: 1 addition & 6 deletions scripts/pytorch_install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,4 @@ If ($TORCH_VERSION -eq "1.8.0") {
$TORCHVISION_VERSION="0.10.1"
}
pip install torch==$TORCH_VERSION+cpu torchvision==$TORCHVISION_VERSION+cpu -f https://download.pytorch.org/whl/torch_stable.html

If ($TORCH_VERSION -eq "1.8.0") {
pip install torchcsprng==$TORCHCSPRNG_VERSION+cpu -f https://download.pytorch.org/whl/torch_stable.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L19 is now irrelevant.

} Else {
echo "No torchcsprng"
}
pip install "git+https://github.com/pytorch/csprng.git@cd8f2f670355f5a9b345dbe2cb58a52fb2c44d39#egg=torchcsprng"
7 changes: 1 addition & 6 deletions scripts/pytorch_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,4 @@ pip install torch=="${TORCH_VERSION}"
pip install torchvision==${TORCHVISION_VERSION}

# torchcsprng
if [ "$TORCH_VERSION" = "1.8.0" ]
then
pip install torchcsprng==${TORCHCSPRNG_VERSION}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this means L22 is no longer required?

else
echo "No torchcsprng"
fi
pip install git+https://github.com/pytorch/csprng.git@cd8f2f670355f5a9b345dbe2cb58a52fb2c44d39#egg=torchcsprng
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment explaining why you chose this specific commit?

9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# limitations under the License.

import os
import re
import sys

from setuptools import find_packages, setup
Expand Down Expand Up @@ -55,7 +56,13 @@
required = f.read().splitlines()

with open("dev_requirements.txt", encoding="utf8") as f:
dev_required = f.read().splitlines()
dev_required = [
# This is to process correctly git repositories as dependencies
# https://stackoverflow.com/questions/32688688/how-to-write-setup-py-to-include-a-git-repository-as-a-dependency
re.sub(r"-e (git\+.*egg=(.*))", r"\2 @ \1", line)
for line in f.read().splitlines()
]


setup(
name="opacus",
Expand Down