Repository navigation
🚨 [Kernels] Sync to latest version
#46039
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
Changes from all commits
1b2d8fb
f9212eb
dd1a67a
1139b4e
b2dcc45
cb0ef71
4a04de2
9595dec
2da8885
f5c00b0
25a43d5
40d1389
b91e19e
a33e778
3e719ef
e2da24f
2fbdc55
87c30c9
9dd63b1
41651a8
e5de62d
1ec50dc
8597923
9e4a2f4
f2ecb90
f1c52f6
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 |
|---|---|---|
|
|
@@ -34,6 +34,8 @@ | |
|
|
||
| from ..utils import logging | ||
| from ..utils.import_utils import ( | ||
| KERNELS_MAX_VERSION, | ||
| KERNELS_MIN_VERSION, | ||
| get_cuda_runtime_version, | ||
| is_kernels_available, | ||
| is_torchdynamo_compiling, | ||
|
|
@@ -81,7 +83,9 @@ def _load_deepgemm_kernel(requires_sm100: bool = False) -> DeepGEMM: | |
| if not is_torchdynamo_compiling(): | ||
| if not is_kernels_available(): | ||
| raise ImportError( | ||
| "DeepGEMM kernel requires the `kernels` package. Install it with `pip install -U kernels`." | ||
| "DeepGEMM kernel requires the `kernels` package. " | ||
| f"Please install a compatible version ({KERNELS_MIN_VERSION} <= version < {KERNELS_MAX_VERSION}), " | ||
| f"e.g. `pip install kernels=={KERNELS_MIN_VERSION}`" | ||
|
Comment on lines
+87
to
+88
Member
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. We could also recommend
Collaborator
Author
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. Would like to keep, at some point we want to remove the dedicated kernels tbh so this seems more explicit |
||
| ) | ||
| if not torch.cuda.is_available(): | ||
| raise ImportError("DeepGEMM kernel requires CUDA, but CUDA is not available.") | ||
|
|
@@ -140,7 +144,9 @@ def _load_deepgemm_kernel(requires_sm100: bool = False) -> DeepGEMM: | |
| ] | ||
| if missing: | ||
| raise ImportError( | ||
| f"DeepGEMM kernel is missing required symbols: {', '.join(missing)}. Update with `pip install -U kernels`." | ||
| f"DeepGEMM kernel is missing required symbols: {', '.join(missing)}. " | ||
| f"Please install a compatible version ({KERNELS_MIN_VERSION} <= version < {KERNELS_MAX_VERSION}), " | ||
| f"e.g. `pip install kernels=={KERNELS_MIN_VERSION}`" | ||
| ) | ||
| return DeepGEMM( | ||
| fp8_fp4_matmul=fp8_fp4_matmul, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,12 @@ | |
| from ..core_model_loading import ConversionOps | ||
| from ..quantizers.quantizers_utils import get_module_from_name, should_convert_module | ||
| from ..utils import logging | ||
| from ..utils.import_utils import is_kernels_available, is_torchdynamo_compiling | ||
| from ..utils.import_utils import ( | ||
| KERNELS_MAX_VERSION, | ||
| KERNELS_MIN_VERSION, | ||
| is_kernels_available, | ||
| is_torchdynamo_compiling, | ||
| ) | ||
| from .deepgemm import ( | ||
| deepgemm_fp8_fp4_experts_forward, | ||
| deepgemm_fp8_fp4_linear, | ||
|
|
@@ -83,7 +88,9 @@ def _load_finegrained_fp8_kernel() -> FineGrainedFP8: | |
| if not is_torchdynamo_compiling(): | ||
| if not is_kernels_available(): | ||
| raise ImportError( | ||
| "finegrained-fp8 kernel requires the `kernels` package. Install it with `pip install -U kernels`." | ||
| "finegrained-fp8 kernel requires the `kernels` package. " | ||
| f"Please install a compatible version ({KERNELS_MIN_VERSION} <= version < {KERNELS_MAX_VERSION}), " | ||
| f"e.g. `pip install kernels=={KERNELS_MIN_VERSION}`" | ||
| ) | ||
|
|
||
| kernel = lazy_load_kernel("finegrained-fp8") | ||
|
Comment on lines
89
to
96
Member
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. does
Collaborator
Author
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. Nope, it has a fallback mechanism so it's not as clear as doing it this way |
||
|
|
@@ -109,7 +116,8 @@ def _load_finegrained_fp8_kernel() -> FineGrainedFP8: | |
| if missing: | ||
| raise ImportError( | ||
| f"finegrained-fp8 kernel is missing required symbols: {', '.join(missing)}. " | ||
| "Please update the `kernels` package (`pip install -U kernels`)." | ||
| f"Please install a compatible version ({KERNELS_MIN_VERSION} <= version < {KERNELS_MAX_VERSION}), " | ||
| f"e.g. `pip install kernels=={KERNELS_MIN_VERSION}`" | ||
| ) | ||
|
|
||
| return FineGrainedFP8( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.