Skip to content

Commit f3993d6

Browse files
authored
use extra index rathe than find links for link patching (#59)
1 parent 44120a8 commit f3993d6

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

light_the_torch/_patch.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,19 +198,22 @@ def postprocessing(input, output):
198198

199199
@contextlib.contextmanager
200200
def patch_link_collection(computation_backends, channel):
201-
if channel == Channel.STABLE:
202-
urls = ["https://download.pytorch.org/whl/torch_stable.html"]
203-
elif channel == Channel.LTS:
204-
# TODO: expand this when there are more LTS versions
205-
urls = ["https://download.pytorch.org/whl/lts/1.8/torch_lts.html"]
206-
else:
201+
if channel == channel != Channel.LTS:
202+
find_links = []
207203
# TODO: this template is not valid for all backends
208-
urls = [
209-
f"https://download.pytorch.org/whl/"
210-
f"{channel.name.lower()}/{backend}/torch_{channel.name.lower()}.html"
204+
channel_path = f"{channel.name.lower()}/" if channel != Channel.STABLE else ""
205+
index_urls = [
206+
f"https://download.pytorch.org/whl/{channel_path}{backend}"
211207
for backend in sorted(computation_backends)
212208
]
213-
search_scope = SearchScope.create(find_links=urls, index_urls=[])
209+
else:
210+
# TODO: expand this when there are more LTS versions
211+
# TODO: switch this to index_urls when
212+
# https://github.com/pytorch/pytorch/pull/74753 is resolved
213+
find_links = ["https://download.pytorch.org/whl/lts/1.8/torch_lts.html"]
214+
index_urls = []
215+
216+
search_scope = SearchScope.create(find_links=find_links, index_urls=index_urls)
214217

215218
@contextlib.contextmanager
216219
def context(input):

0 commit comments

Comments
 (0)