kernels 0.3.2__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kernels-0.3.2 → kernels-0.4.0}/PKG-INFO +5 -5
- {kernels-0.3.2 → kernels-0.4.0}/pyproject.toml +4 -4
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels/layer.py +17 -2
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels.egg-info/PKG-INFO +5 -5
- kernels-0.4.0/src/kernels.egg-info/requires.txt +8 -0
- {kernels-0.3.2 → kernels-0.4.0}/tests/test_layer.py +19 -0
- kernels-0.3.2/src/kernels.egg-info/requires.txt +0 -8
- {kernels-0.3.2 → kernels-0.4.0}/README.md +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/setup.cfg +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels/__init__.py +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels/cli.py +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels/compat.py +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels/lockfile.py +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels/utils.py +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels.egg-info/SOURCES.txt +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels.egg-info/dependency_links.txt +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels.egg-info/entry_points.txt +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/src/kernels.egg-info/top_level.txt +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/tests/test_basic.py +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/tests/test_benchmarks.py +0 -0
- {kernels-0.3.2 → kernels-0.4.0}/tests/test_kernel_locking.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: kernels
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Download compute kernels
|
|
5
5
|
Author-email: OlivierDehaene <olivier@huggingface.co>, Daniel de Kok <daniel@huggingface.co>, David Holtz <david@huggingface.co>, Nicolas Patry <nicolas@huggingface.co>
|
|
6
6
|
Requires-Python: >=3.9
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
|
-
Requires-Dist:
|
|
9
|
-
Requires-Dist: packaging>=
|
|
10
|
-
Requires-Dist: tomli>=2.0
|
|
8
|
+
Requires-Dist: huggingface_hub<1.0,>=0.26.0
|
|
9
|
+
Requires-Dist: packaging>=20.0
|
|
10
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
11
11
|
Provides-Extra: torch
|
|
12
12
|
Requires-Dist: torch; extra == "torch"
|
|
13
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "kernels"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.4.0"
|
|
4
4
|
description = "Download compute kernels"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "OlivierDehaene", email = "olivier@huggingface.co" },
|
|
@@ -11,9 +11,9 @@ authors = [
|
|
|
11
11
|
readme = "README.md"
|
|
12
12
|
requires-python = ">= 3.9"
|
|
13
13
|
dependencies = [
|
|
14
|
-
"
|
|
15
|
-
"packaging>=
|
|
16
|
-
"tomli>=2.0
|
|
14
|
+
"huggingface_hub>=0.26.0,<1.0",
|
|
15
|
+
"packaging>=20.0",
|
|
16
|
+
"tomli>=2.0; python_version<'3.11'",
|
|
17
17
|
]
|
|
18
18
|
|
|
19
19
|
[build-system]
|
|
@@ -54,11 +54,26 @@ _KERNEL_MAPPING: ContextVar[Dict[str, Dict[Device, LayerRepository]]] = ContextV
|
|
|
54
54
|
)
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
def use_kernel_mapping(
|
|
57
|
+
def use_kernel_mapping(
|
|
58
|
+
mapping: Dict[str, Dict[Union[Device, str], LayerRepository]],
|
|
59
|
+
*,
|
|
60
|
+
inherit_mapping: bool = True,
|
|
61
|
+
):
|
|
62
|
+
"""
|
|
63
|
+
Context manager that sets a mapping for a duration of the context.
|
|
64
|
+
|
|
65
|
+
When `inherit_mapping` is set to `True` the current mapping will be
|
|
66
|
+
extended by `mapping` inside the context. If it is `False`, only
|
|
67
|
+
`mapping` is used inside the context.
|
|
68
|
+
"""
|
|
69
|
+
|
|
58
70
|
class ContextManager:
|
|
59
71
|
def __enter__(self):
|
|
60
72
|
# Mappings always stack on previous mappings.
|
|
61
|
-
|
|
73
|
+
if inherit_mapping:
|
|
74
|
+
self.token = _KERNEL_MAPPING.set(deepcopy(_KERNEL_MAPPING.get()))
|
|
75
|
+
else:
|
|
76
|
+
self.token = _KERNEL_MAPPING.set({})
|
|
62
77
|
register_kernel_mapping(mapping)
|
|
63
78
|
|
|
64
79
|
def __exit__(self, exc_type, exc_value, traceback):
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: kernels
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Download compute kernels
|
|
5
5
|
Author-email: OlivierDehaene <olivier@huggingface.co>, Daniel de Kok <daniel@huggingface.co>, David Holtz <david@huggingface.co>, Nicolas Patry <nicolas@huggingface.co>
|
|
6
6
|
Requires-Python: >=3.9
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
|
-
Requires-Dist:
|
|
9
|
-
Requires-Dist: packaging>=
|
|
10
|
-
Requires-Dist: tomli>=2.0
|
|
8
|
+
Requires-Dist: huggingface_hub<1.0,>=0.26.0
|
|
9
|
+
Requires-Dist: packaging>=20.0
|
|
10
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
11
11
|
Provides-Extra: torch
|
|
12
12
|
Requires-Dist: torch; extra == "torch"
|
|
13
13
|
|
|
@@ -152,6 +152,25 @@ def test_mapping_contexts():
|
|
|
152
152
|
== "kernels-community/activation"
|
|
153
153
|
)
|
|
154
154
|
|
|
155
|
+
with use_kernel_mapping(extra_mapping2, inherit_mapping=False):
|
|
156
|
+
assert set(_KERNEL_MAPPING.get().keys()) == {
|
|
157
|
+
"SiluAndMul",
|
|
158
|
+
}
|
|
159
|
+
assert (
|
|
160
|
+
_KERNEL_MAPPING.get()["SiluAndMul"][Device(type="cuda")].repo_id
|
|
161
|
+
== "kernels-community/non-existing"
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
assert set(_KERNEL_MAPPING.get().keys()) == {
|
|
165
|
+
"SiluAndMul",
|
|
166
|
+
"SiluAndMulStringDevice",
|
|
167
|
+
"TestKernel",
|
|
168
|
+
}
|
|
169
|
+
assert (
|
|
170
|
+
_KERNEL_MAPPING.get()["SiluAndMul"][Device(type="cuda")].repo_id
|
|
171
|
+
== "kernels-community/activation"
|
|
172
|
+
)
|
|
173
|
+
|
|
155
174
|
assert set(_KERNEL_MAPPING.get().keys()) == {
|
|
156
175
|
"SiluAndMul",
|
|
157
176
|
"SiluAndMulStringDevice",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|