drbh
commited on
Commit
Β·
63f348a
1
Parent(s):
fe983f2
fix: re upload build
Browse files- build/torch27-cxx11-cu118-x86_64-linux/img2gray/{_img2gray_aca891a_dirty.abi3.so β _img2gray_fe983f2_dirty.abi3.so} +1 -1
- build/torch27-cxx11-cu118-x86_64-linux/img2gray/_ops.py +3 -3
- build/torch27-cxx11-cu126-x86_64-linux/img2gray/{_img2gray_aca891a_dirty.abi3.so β _img2gray_fe983f2_dirty.abi3.so} +1 -1
- build/torch27-cxx11-cu126-x86_64-linux/img2gray/_ops.py +3 -3
- build/{torch28-cxx11-cu128-x86_64-linux/img2gray/_img2gray_aca891a_dirty.abi3.so β torch27-cxx11-cu128-x86_64-linux/img2gray/_img2gray_fe983f2_dirty.abi3.so} +1 -1
- build/torch27-cxx11-cu128-x86_64-linux/img2gray/_ops.py +3 -3
- build/torch28-cxx11-cu126-x86_64-linux/img2gray/{_img2gray_aca891a_dirty.abi3.so β _img2gray_fe983f2_dirty.abi3.so} +1 -1
- build/torch28-cxx11-cu126-x86_64-linux/img2gray/_ops.py +3 -3
- build/{torch27-cxx11-cu128-x86_64-linux/img2gray/_img2gray_aca891a_dirty.abi3.so β torch28-cxx11-cu128-x86_64-linux/img2gray/_img2gray_fe983f2_dirty.abi3.so} +1 -1
- build/torch28-cxx11-cu128-x86_64-linux/img2gray/_ops.py +3 -3
- build/torch28-cxx11-cu129-x86_64-linux/img2gray/{_img2gray_aca891a_dirty.abi3.so β _img2gray_fe983f2_dirty.abi3.so} +1 -1
- build/torch28-cxx11-cu129-x86_64-linux/img2gray/_ops.py +3 -3
- test_kernel.py +29 -0
build/torch27-cxx11-cu118-x86_64-linux/img2gray/{_img2gray_aca891a_dirty.abi3.so β _img2gray_fe983f2_dirty.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 1803528
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9d5e74bae644ee5ca293ab6c8d87019321a0115d1f74341b4ce91e694c254ac8
|
| 3 |
size 1803528
|
build/torch27-cxx11-cu118-x86_64-linux/img2gray/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _img2gray_fe983f2_dirty
|
| 3 |
+
ops = torch.ops._img2gray_fe983f2_dirty
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_img2gray_fe983f2_dirty::{op_name}"
|
build/torch27-cxx11-cu126-x86_64-linux/img2gray/{_img2gray_aca891a_dirty.abi3.so β _img2gray_fe983f2_dirty.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 1853168
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:36fe29117596a826b26a16b22b9b85ceb8c9c8c5bc1d3504e5420f67ed1188cf
|
| 3 |
size 1853168
|
build/torch27-cxx11-cu126-x86_64-linux/img2gray/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _img2gray_fe983f2_dirty
|
| 3 |
+
ops = torch.ops._img2gray_fe983f2_dirty
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_img2gray_fe983f2_dirty::{op_name}"
|
build/{torch28-cxx11-cu128-x86_64-linux/img2gray/_img2gray_aca891a_dirty.abi3.so β torch27-cxx11-cu128-x86_64-linux/img2gray/_img2gray_fe983f2_dirty.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 1924496
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a14ea9d259b6531b1b8d68c2e1c7a19ede78b1e429630a2f65270307bc087609
|
| 3 |
size 1924496
|
build/torch27-cxx11-cu128-x86_64-linux/img2gray/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _img2gray_fe983f2_dirty
|
| 3 |
+
ops = torch.ops._img2gray_fe983f2_dirty
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_img2gray_fe983f2_dirty::{op_name}"
|
build/torch28-cxx11-cu126-x86_64-linux/img2gray/{_img2gray_aca891a_dirty.abi3.so β _img2gray_fe983f2_dirty.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 1853168
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:00cb31316c604644a3bb9180a167622ed666921e3ab5154f7f07ae1faf910e14
|
| 3 |
size 1853168
|
build/torch28-cxx11-cu126-x86_64-linux/img2gray/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _img2gray_fe983f2_dirty
|
| 3 |
+
ops = torch.ops._img2gray_fe983f2_dirty
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_img2gray_fe983f2_dirty::{op_name}"
|
build/{torch27-cxx11-cu128-x86_64-linux/img2gray/_img2gray_aca891a_dirty.abi3.so β torch28-cxx11-cu128-x86_64-linux/img2gray/_img2gray_fe983f2_dirty.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 1924496
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6aee1662d13a44c365281710eebc631f6d9eeb160b040dd8ba59eeb5b7b610f4
|
| 3 |
size 1924496
|
build/torch28-cxx11-cu128-x86_64-linux/img2gray/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _img2gray_fe983f2_dirty
|
| 3 |
+
ops = torch.ops._img2gray_fe983f2_dirty
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_img2gray_fe983f2_dirty::{op_name}"
|
build/torch28-cxx11-cu129-x86_64-linux/img2gray/{_img2gray_aca891a_dirty.abi3.so β _img2gray_fe983f2_dirty.abi3.so}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 1950088
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b23c44f236125a7ea7b3a942cdc5ee66e11243cccf15cbe3fbf3a633791b567a
|
| 3 |
size 1950088
|
build/torch28-cxx11-cu129-x86_64-linux/img2gray/_ops.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import torch
|
| 2 |
-
from . import
|
| 3 |
-
ops = torch.ops.
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
-
return f"
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from . import _img2gray_fe983f2_dirty
|
| 3 |
+
ops = torch.ops._img2gray_fe983f2_dirty
|
| 4 |
|
| 5 |
def add_op_namespace_prefix(op_name: str):
|
| 6 |
"""
|
| 7 |
Prefix op by namespace.
|
| 8 |
"""
|
| 9 |
+
return f"_img2gray_fe983f2_dirty::{op_name}"
|
test_kernel.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# /// script
|
| 2 |
+
# requires-python = "==3.10"
|
| 3 |
+
# dependencies = [
|
| 4 |
+
# "kernels",
|
| 5 |
+
# "numpy",
|
| 6 |
+
# "pillow",
|
| 7 |
+
# "torch",
|
| 8 |
+
# ]
|
| 9 |
+
# ///
|
| 10 |
+
import torch
|
| 11 |
+
from PIL import Image
|
| 12 |
+
import numpy as np
|
| 13 |
+
from kernels import get_kernel
|
| 14 |
+
|
| 15 |
+
# This downloads, caches, and loads the kernel library
|
| 16 |
+
# and makes the custom op available in torch.ops
|
| 17 |
+
img2gray_lib = get_kernel("drbh/img2gray")
|
| 18 |
+
|
| 19 |
+
img = Image.open("kernel-builder-logo-color.png").convert("RGB")
|
| 20 |
+
img = np.array(img)
|
| 21 |
+
img_tensor = torch.from_numpy(img).cuda()
|
| 22 |
+
print(img_tensor.shape) # HWC
|
| 23 |
+
|
| 24 |
+
gray_tensor = img2gray_lib.img2gray(img_tensor).squeeze()
|
| 25 |
+
print(gray_tensor.shape) # HW
|
| 26 |
+
|
| 27 |
+
# save the output image
|
| 28 |
+
gray_img = Image.fromarray(gray_tensor.cpu().numpy().astype(np.uint8), mode="L")
|
| 29 |
+
gray_img.save("kernel-builder-logo-gray2.png")
|