Skip to content

Commit aa61c45

Browse files
authored
use pytorch version env variable (#373)
1 parent bc2f8b7 commit aa61c45

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
torch
2-
numpy
31
sentencepiece
42
packaging
53
expecttest # So we can use IS_FBCODE flag

setup.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ def get_extensions():
8888

8989
return ext_modules
9090

91+
# Mimic code from torchvision https://github.com/pytorch/vision/blob/143d078b28f00471156a4e562dd3836370acc9ee/setup.py#L58
92+
pytorch_dep = "torch"
93+
if os.getenv("PYTORCH_VERSION"):
94+
pytorch_dep += "==" + os.getenv("PYTORCH_VERSION")
95+
96+
requirements = [
97+
"numpy",
98+
pytorch_dep,
99+
]
100+
91101
setup(
92102
name=package_name,
93103
version=version+version_suffix,
@@ -97,7 +107,7 @@ def get_extensions():
97107
"torchao.kernel.configs": ["*.pkl"],
98108
},
99109
ext_modules=get_extensions() if use_cpp != "0" else None,
100-
install_requires=read_requirements("requirements.txt"),
110+
install_requires=requirements,
101111
extras_require={"dev": read_requirements("dev-requirements.txt")},
102112
description="Package for applying ao techniques to GPU models",
103113
long_description=open("README.md").read(),

0 commit comments

Comments
 (0)