-
Notifications
You must be signed in to change notification settings - Fork 530
[wip] ci: add release workflow for flashinfer-jit-cache
package
#1858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,31 @@ | ||||||
import hashlib | ||||||
import pathlib | ||||||
import re | ||||||
|
||||||
for path in sorted(pathlib.Path("dist").glob("*.whl")): | ||||||
with open(path, "rb") as f: | ||||||
sha256 = hashlib.sha256(f.read()).hexdigest() | ||||||
# Extract version and CUDA version from wheel name | ||||||
# Example: flashinfer_jit_cache-1.2.3+cu128-cp39-abi3-manylinux_2_28_x86_64.whl | ||||||
# Example: flashinfer_jit_cache-1.2.3rc1+cu128-cp39-abi3-manylinux_2_28_x86_64.whl | ||||||
# Example: flashinfer_jit_cache-1.2.3.post1+cu128-cp39-abi3-manylinux_2_28_x86_64.whl | ||||||
match = re.search( | ||||||
r"flashinfer_jit_cache-([0-9]+\.[0-9]+\.[0-9]+[a-z0-9.]*)\+cu(\d+)-", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The regular expression for parsing the version string is quite specific and might break if the versioning scheme changes slightly (e.g., from
Suggested change
|
||||||
path.name, | ||||||
) | ||||||
if not match: | ||||||
print(f"Warning: Could not parse wheel name: {path.name}") | ||||||
continue | ||||||
|
||||||
ver, cu = match.groups() | ||||||
|
||||||
# Create directory structure: cu{version}/flashinfer-jit-cache/ | ||||||
# No torch subdirectory since we don't separate by torch version | ||||||
index_dir = pathlib.Path(f"flashinfer-whl/cu{cu}/flashinfer-jit-cache") | ||||||
index_dir.mkdir(parents=True, exist_ok=True) | ||||||
|
||||||
base_url = "https://github.com/flashinfer-ai/flashinfer/releases/download" | ||||||
full_url = f"{base_url}/v{ver}/{path.name}#sha256={sha256}" | ||||||
|
||||||
with (index_dir / "index.html").open("a") as f: | ||||||
f.write(f'<a href="{full_url}">{path.name}</a><br>\n') | ||||||
Comment on lines
+30
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opening the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading the entire file into memory to calculate the SHA256 hash can be inefficient and cause high memory usage for large wheel files. It's a better practice to read the file in chunks to avoid this.