Skip to content

Commit 951d354

Browse files
authored
fix(cleanup): ensure repository URL has no trailing slash (#1759)
<!-- .github/pull_request_template.md --> ## 📌 Description Remove trailing slash from FLASHINFER_CUBINS_REPOSITORY before concatenating the filename, to avoid redundant double slashes in the URL. Even though servers may handle double slashes, this makes URL construction consistent and cleaner. <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### ✅ Pre-commit Checks - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [x] I have installed the hooks with `pre-commit install`. - [x] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [ ] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. --> --------- Signed-off-by: Tarun Kumar <[email protected]>
1 parent 60dec90 commit 951d354

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

flashinfer/artifacts.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import re
1919
import time
2020
from concurrent.futures import ThreadPoolExecutor, as_completed
21-
21+
from urllib.parse import urljoin
2222
import requests # type: ignore[import-untyped]
2323
import shutil
2424

@@ -94,6 +94,7 @@ class MetaInfoHash:
9494

9595

9696
def get_cubin_file_list():
97+
base = FLASHINFER_CUBINS_REPOSITORY.rstrip("/")
9798
cubin_files = [
9899
(ArtifactPath.TRTLLM_GEN_FMHA + "include/flashInferMetaInfo", ".h"),
99100
(ArtifactPath.TRTLLM_GEN_GEMM + "include/flashinferMetaInfo", ".h"),
@@ -108,7 +109,7 @@ def get_cubin_file_list():
108109
cubin_files += [
109110
(kernel + name, extension)
110111
for name, extension in get_available_cubin_files(
111-
FLASHINFER_CUBINS_REPOSITORY + "/" + kernel
112+
urljoin(base + "/", kernel)
112113
)
113114
]
114115
return cubin_files

flashinfer/jit/cubin_loader.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import ctypes
1818
import hashlib
1919
import os
20+
from urllib.parse import urljoin
2021
import shutil
2122
import time
2223

@@ -154,7 +155,9 @@ def get_cubin(name, sha256, file_extension=".cubin", session=None):
154155
if cubin:
155156
return cubin
156157
# either the file does not exist or it is corrupted, we'll download a new one.
157-
uri = FLASHINFER_CUBINS_REPOSITORY + "/" + cubin_fname
158+
159+
base = FLASHINFER_CUBINS_REPOSITORY.rstrip("/")
160+
uri = urljoin(base + "/", cubin_fname)
158161
logger.info(f"Fetching cubin {name} from {uri}")
159162
download_file(uri, cubin_path, session=session)
160163
return load_cubin(cubin_path, sha256)

0 commit comments

Comments
 (0)