Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/diffusers/models/attention_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
if torch.distributed.is_available():
import torch.distributed._functional_collectives as funcol

from .. import __version__
from ..utils import (
get_logger,
is_aiter_available,
Expand Down Expand Up @@ -728,7 +729,12 @@ def _maybe_download_kernel_for_backend(backend: AttentionBackendName) -> None:
try:
from kernels import get_kernel

kernel_module = get_kernel(config.repo_id, revision=config.revision, version=config.version)
kernel_module = get_kernel(
config.repo_id,
revision=config.revision,
version=config.version,
user_agent={"diffusers": __version__},
)
if needs_kernel:
config.kernel_fn = _resolve_kernel_attr(kernel_module, config.function_attr)

Expand Down
3 changes: 2 additions & 1 deletion src/diffusers/quantizers/gguf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import torch
import torch.nn as nn

from ... import __version__
from ...utils import is_accelerate_available, is_kernels_available, is_kernels_version
from ...utils.constants import DIFFUSERS_TRUST_REMOTE_KERNELS

Expand All @@ -46,7 +47,7 @@
)
# `kernels<0.14.0` has no `trust_remote_code` argument and executes the downloaded code unconditionally.
trust_kwargs = {"trust_remote_code": True} if is_kernels_version(">=", "0.14.0") else {}
ops = get_kernel("Isotr0py/ggml", **trust_kwargs)
ops = get_kernel("Isotr0py/ggml", user_agent={"diffusers": __version__}, **trust_kwargs)
else:
ops = None

Expand Down
5 changes: 4 additions & 1 deletion src/diffusers/quantizers/nunchaku/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import torch
import torch.nn as nn

from ... import __version__
from ...utils import is_accelerate_available, is_kernels_available, is_kernels_version
from ...utils.constants import DIFFUSERS_TRUST_REMOTE_KERNELS

Expand All @@ -30,7 +31,9 @@
)
# `kernels<0.14.0` has no `trust_remote_code` argument and executes the downloaded code unconditionally.
trust_kwargs = {"trust_remote_code": True} if is_kernels_version(">=", "0.14.0") else {}
ops = get_kernel(_HF_KERNEL_REPO, version=_HF_KERNEL_VERSION, **trust_kwargs).ops
ops = get_kernel(
_HF_KERNEL_REPO, version=_HF_KERNEL_VERSION, user_agent={"diffusers": __version__}, **trust_kwargs
).ops
else:
raise ImportError(
"Loading Nunchaku checkpoints requires the Hugging Face `kernels` package. "
Expand Down
Loading