From e348be8ce0916983c32879574af56e6fa934b8a3 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Tue, 21 Apr 2026 13:19:01 +0000 Subject: [PATCH] inference: add AGPLv3 license headers All eight files introduced on this branch now carry the SPDX AGPLv3 header used by the MoE kernels. flex_paged_attention.py keeps its BSD 3-Clause attribution to attention-gym alongside the new header. --- tests/flex_fastlm_bench.py | 3 +++ tests/flex_fastlm_smoke.py | 3 +++ unsloth/inference/__init__.py | 3 +++ unsloth/inference/flex_engine.py | 3 +++ unsloth/inference/flex_gemma4.py | 3 +++ unsloth/inference/flex_paged_attention.py | 10 ++++++---- unsloth/inference/flex_qwen3_llama.py | 3 +++ unsloth/inference/vllm_shim.py | 3 +++ 8 files changed, 27 insertions(+), 4 deletions(-) diff --git a/tests/flex_fastlm_bench.py b/tests/flex_fastlm_bench.py index c7c3d152dd..96311d5be0 100644 --- a/tests/flex_fastlm_bench.py +++ b/tests/flex_fastlm_bench.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: GNU Affero General Public License v3.0 +# Copyright 2023-present the Unsloth team. All rights reserved. + """Batched steady-state throughput bench through ``FastLanguageModel`` + ``UNSLOTH_FAST_INFERENCE=1``. First ``generate`` call primes CUDA graphs; subsequent calls report steady state. Compare against April CLI-only diff --git a/tests/flex_fastlm_smoke.py b/tests/flex_fastlm_smoke.py index 1bea61dc52..4c8ce8d1ea 100644 --- a/tests/flex_fastlm_smoke.py +++ b/tests/flex_fastlm_smoke.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: GNU Affero General Public License v3.0 +# Copyright 2023-present the Unsloth team. All rights reserved. + """Smoke-test the ``UNSLOTH_FAST_INFERENCE=1`` path through ``FastLanguageModel.from_pretrained``. diff --git a/unsloth/inference/__init__.py b/unsloth/inference/__init__.py index cc0deb9efa..476bda5d39 100644 --- a/unsloth/inference/__init__.py +++ b/unsloth/inference/__init__.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: GNU Affero General Public License v3.0 +# Copyright 2023-present the Unsloth team. All rights reserved. + """Flex-attention inference engines. ``UNSLOTH_FAST_INFERENCE=1`` routes ``FastLanguageModel.from_pretrained`` diff --git a/unsloth/inference/flex_engine.py b/unsloth/inference/flex_engine.py index 5c83735460..ef7da5acaf 100644 --- a/unsloth/inference/flex_engine.py +++ b/unsloth/inference/flex_engine.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: GNU Affero General Public License v3.0 +# Copyright 2023-present the Unsloth team. All rights reserved. + """FlexEngine: vLLM-compatible LLM surface for the flex inference backends. When ``UNSLOTH_FAST_INFERENCE=1`` is set, :func:`load_flex` wraps the HF model diff --git a/unsloth/inference/flex_gemma4.py b/unsloth/inference/flex_gemma4.py index 87fa9d2ec7..268181af30 100644 --- a/unsloth/inference/flex_gemma4.py +++ b/unsloth/inference/flex_gemma4.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: GNU Affero General Public License v3.0 +# Copyright 2023-present the Unsloth team. All rights reserved. + """Gemma-4-E2B-it inference with flex_attention + paged KV cache + CUDA graphs. Extends the Qwen3/Llama-3.2 engine in `qwen3_flex_inference.py` to a third diff --git a/unsloth/inference/flex_paged_attention.py b/unsloth/inference/flex_paged_attention.py index e76716ab46..f5b3aabc89 100644 --- a/unsloth/inference/flex_paged_attention.py +++ b/unsloth/inference/flex_paged_attention.py @@ -1,7 +1,9 @@ -# Adapted from attention-gym -# Original source: https://github.com/pytorch-labs/attention-gym -# License: BSD 3-Clause (see THIRD_PARTY_LICENSES.md) -# Copyright (c) 2023, Driss Guessous +# SPDX-License-Identifier: GNU Affero General Public License v3.0 +# Copyright 2023-present the Unsloth team. All rights reserved. +# +# Adapted from attention-gym (https://github.com/pytorch-labs/attention-gym) +# Copyright (c) 2023, Driss Guessous, licensed under BSD 3-Clause +# (see THIRD_PARTY_LICENSES.md). # the original implementation has some bugs and has some feature that lives outside of the PageTable class diff --git a/unsloth/inference/flex_qwen3_llama.py b/unsloth/inference/flex_qwen3_llama.py index 83bf3b1e73..272549ceae 100644 --- a/unsloth/inference/flex_qwen3_llama.py +++ b/unsloth/inference/flex_qwen3_llama.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: GNU Affero General Public License v3.0 +# Copyright 2023-present the Unsloth team. All rights reserved. + """Llama / Qwen3 inference with flex_attention + paged KV cache + CUDA graphs. The transformers continuous-batching path tops out at ~10% of vLLM on this diff --git a/unsloth/inference/vllm_shim.py b/unsloth/inference/vllm_shim.py index 19a37b51f4..13a3960453 100644 --- a/unsloth/inference/vllm_shim.py +++ b/unsloth/inference/vllm_shim.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: GNU Affero General Public License v3.0 +# Copyright 2023-present the Unsloth team. All rights reserved. + """vLLM-API surface for the flex inference backend. `FlexEngine.generate` / `.chat` return :class:`RequestOutput` objects with the