-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathinstall_dev.py
More file actions
74 lines (63 loc) · 2.27 KB
/
install_dev.py
File metadata and controls
74 lines (63 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import argparse
import subprocess
import sys
def install_torch_nightly_deps():
"""Install torch related dependencies from pinned nightly"""
EXECUTORCH_NIGHTLY_VERSION = "dev20260317"
TORCHAO_NIGHTLY_VERSION = "dev20260317"
# Torch nightly is aligned with pinned nightly in https://github.com/pytorch/executorch/blob/main/torch_pin.py#L2
TORCH_NIGHTLY_VERSION = "dev20260317"
subprocess.check_call(
[
sys.executable,
"-m",
"pip",
"install",
"--no-cache-dir", # Prevent cached CUDA packages
f"executorch==1.3.0.{EXECUTORCH_NIGHTLY_VERSION}",
f"torch==2.12.0.{TORCH_NIGHTLY_VERSION}",
f"torchvision==0.26.0.{TORCH_NIGHTLY_VERSION}",
f"torchaudio==2.11.0.{TORCH_NIGHTLY_VERSION}",
f"torchao==0.17.0.{TORCHAO_NIGHTLY_VERSION}",
"--extra-index-url",
"https://download.pytorch.org/whl/nightly/cpu",
]
)
def install_dep_from_source():
"""Install deps from source at pinned commits"""
subprocess.check_call(
[
sys.executable,
"-m",
"pip",
"install",
"git+https://github.com/huggingface/transformers@bdc85cb85c8772d37aa29ce447860b44d7fad6ef#egg=transformers", # v5.0.0rc0
]
)
subprocess.check_call(
[
sys.executable,
"-m",
"pip",
"install",
"git+https://github.com/pytorch-labs/tokenizers@3aada3fe28c945d14d5ec62254eb56ccdf10eb11#egg=pytorch-tokenizers",
]
)
def main():
"""Install optimum-executorch in dev mode with nightly dependencies"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--skip_override_torch",
action="store_true",
help="Skip installation of nightly executorch and torch dependencies",
)
args = parser.parse_args()
# Install nightly torch dependencies FIRST to avoid pulling CUDA versions
if not args.skip_override_torch:
install_torch_nightly_deps()
# Install package with dev extras
subprocess.check_call([sys.executable, "-m", "pip", "install", ".[dev]"])
# Install source dependencies
install_dep_from_source()
if __name__ == "__main__":
main()