File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,13 @@ In fact, `ltt` is `pip` with a few added options:
103103 ltt install --pytorch-computation-backend=cu102 torch
104104 ```
105105
106+ Borrowing from the mutex packages that PyTorch provides for ` conda ` installations,
107+ ` --cpuonly ` is available as shorthand for ` --pytorch-computation-backend=cu102 ` .
108+
109+ In addition, the computation backend to be installed can also be set through the
110+ ` LTT_PYTORCH_COMPUTATION_BACKEND ` environment variable. It will only be honored in
111+ case no CLI option for the computation backend is specified.
112+
106113- By default, ` ltt ` installs stable PyTorch binaries. To install binaries from the
107114 nightly, test, or LTS channels pass the ` --pytorch-channel ` option:
108115
Original file line number Diff line number Diff line change 44import functools
55import itertools
66import optparse
7+ import os
78import re
89import sys
910import unittest .mock
@@ -145,6 +146,11 @@ def from_pip_argv(cls, argv: List[str]):
145146 }
146147 elif opts .cpuonly :
147148 cbs = {cb .CPUBackend ()}
149+ elif "LTT_PYTORCH_COMPUTATION_BACKEND" in os .environ :
150+ cbs = {
151+ cb .ComputationBackend .from_str (string .strip ())
152+ for string in os .environ ["LTT_PYTORCH_COMPUTATION_BACKEND" ].split ("," )
153+ }
148154 else :
149155 cbs = cb .detect_compatible_computation_backends ()
150156
You can’t perform that action at this time.
0 commit comments