[Misc] Add SPDX-License-Identifier headers to python source files (#12628)

- **Add SPDX license headers to python source files**
- **Check for SPDX headers using pre-commit**

commit 9d7ef44c3cfb72ca4c32e1c677d99259d10d4745
Author: Russell Bryant <rbryant@redhat.com>
Date:   Fri Jan 31 14:18:24 2025 -0500

    Add SPDX license headers to python source files
    
This commit adds SPDX license headers to python source files as
recommended to
the project by the Linux Foundation. These headers provide a concise way
that is
both human and machine readable for communicating license information
for each
source file. It helps avoid any ambiguity about the license of the code
and can
    also be easily used by tools to help manage license compliance.
    
The Linux Foundation runs license scans against the codebase to help
ensure
    we are in compliance with the licenses of the code we use, including
dependencies. Having these headers in place helps that tool do its job.
    
    More information can be found on the SPDX site:
    
    - https://spdx.dev/learn/handling-license-info/
    
    Signed-off-by: Russell Bryant <rbryant@redhat.com>

commit 5a1cf1cb3b80759131c73f6a9dddebccac039dea
Author: Russell Bryant <rbryant@redhat.com>
Date:   Fri Jan 31 14:36:32 2025 -0500

    Check for SPDX headers using pre-commit
    
    Signed-off-by: Russell Bryant <rbryant@redhat.com>

---------

Signed-off-by: Russell Bryant <rbryant@redhat.com>
This commit is contained in:
Russell Bryant
2025-02-02 11:58:18 -08:00
committed by GitHub
parent f256ebe4df
commit e489ad7a21
1012 changed files with 1884 additions and 2 deletions
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""vLLM: a high-throughput and memory-efficient inference engine for LLMs"""
import os
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import contextlib
import importlib
from typing import TYPE_CHECKING, List, Optional, Tuple, Union
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from typing import List, Optional, Tuple
import torch
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
from typing import Tuple
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from abc import ABC, abstractmethod
from typing import Any, Callable, Dict, Optional, TypeVar
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from abc import ABC, abstractmethod
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Callable, Dict, Optional, Set
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from abc import ABC, abstractmethod
from typing import Any, Optional, Set
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
from typing import Literal
from urllib.parse import urljoin
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from functools import lru_cache
from pathlib import Path
from typing import Optional
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
from typing import Literal
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
from functools import lru_cache
from typing import List, Literal
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from vllm.attention.backends.abstract import (AttentionBackend,
AttentionMetadata,
AttentionMetadataBuilder,
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from abc import ABC, abstractmethod
from contextlib import contextmanager
from dataclasses import dataclass, fields
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Tuple, Type
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""Attention layer with FlashAttention."""
from collections import defaultdict
from dataclasses import dataclass
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import dataclasses
from collections import defaultdict
from contextlib import contextmanager
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
###############################################################################
# Copyright (C) 2024 Habana Labs, Ltd. an Intel Company
###############################################################################
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
""" Attention layer with torch scaled_dot_product_attention
and PagedAttention."""
from dataclasses import dataclass
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Dict, Generic, List, Optional, Tuple
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple, Type
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Tuple, Type
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from collections import defaultdict
from dataclasses import dataclass
from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Type
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""Attention layer ROCm GPUs."""
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Type
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
""" Attention layer with torch scaled_dot_product_attention
and PagedAttention."""
from dataclasses import dataclass
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from collections import defaultdict
from contextlib import contextmanager
from dataclasses import dataclass
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""Attention backend utils"""
from collections import defaultdict
from contextlib import contextmanager
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""Attention layer with xFormers and PagedAttention."""
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Tuple, Type
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""Attention layer."""
from typing import Any, Dict, List, Optional
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import torch
import triton
import triton.language as tl
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import math
import torch
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# Helper functions for 3D sparse pattern
# These function are not optimized and very inefficient.
# Avoid calling them too frequent or use a cache mechanism.
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
###############################################################################
# Copyright (C) 2024 Habana Labs, Ltd. an Intel Company
###############################################################################
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, List, Optional, Tuple
try:
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
import neuronxcc.nki.isa as nisa
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
from typing import List, Optional, Tuple
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# The kernels in this file are adapted from LightLLM's context_attention_fwd:
# https://github.com/ModelTC/lightllm/blob/main/lightllm/models/llama/triton_kernel/context_flashattention_nopad.py
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# Adapted from
# https://github.com/sgl-project/sglang/blob/9f635ea50de920aa507f486daafba26a5b837574/python/sglang/srt/layers/attention/triton_ops/decode_attention.py
# which was originally adapted from
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
#!/usr/bin/env python
"""
Fused Attention
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import os
from contextlib import contextmanager
from functools import cache
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import ast
import copy
import dataclasses
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import copy
import dataclasses
from contextlib import contextmanager
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import inspect
from typing import Callable, Dict, List, Optional, TypeVar, Union, overload
from unittest.mock import patch
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import operator
from typing import Dict, Iterable, List, Optional, Tuple, Union
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Callable, Dict, List, NamedTuple, Optional, Tuple
import torch
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import operator
from typing import Iterable, Optional
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import hashlib
import inspect
import types
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import os
import time
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import abc
import operator
from abc import abstractmethod
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Dict, List
from torch import fx as fx
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Union
import torch.fx
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import time
import torch
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import os
import sys
from abc import abstractmethod
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import ast
import copy
import enum
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from pathlib import Path
from typing import Mapping, MutableMapping, Optional
from urllib.parse import urlparse
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import math
from typing import List, Optional
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from collections import deque
from dataclasses import dataclass
from typing import Deque, Dict, Iterable, List, Optional, Protocol, Tuple
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, FrozenSet, List, Optional, Tuple
from vllm.core.block.interfaces import (Block, BlockAllocator, BlockId,
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from abc import ABC, abstractmethod
from typing import Dict, FrozenSet, List, Optional, Protocol, Tuple
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from collections import deque
from typing import Deque, FrozenSet, Iterable, List, Optional, Tuple, Union
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""Token blocks."""
import sys
from bisect import bisect_left
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""Block manager utils."""
from vllm.sequence import SequenceGroup
from vllm.utils import (STR_NOT_IMPL_ENC_DEC_PREFIX_CACHE,
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""A block manager that manages token blocks."""
from typing import Dict, List, Optional
from typing import Sequence as GenericSequence
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import enum
import heapq
from abc import ABC, abstractmethod
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import enum
from abc import ABC, abstractmethod
from typing import List
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from typing import List, Tuple
from vllm.core.interfaces import AllocStatus, BlockSpaceManager
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import enum
import os
import random
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# cumem-based pytorch pluggable allocator to implement sleep mode.
# other approaches tried but failed:
# - cuda-python package binding
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from .communication_op import *
from .parallel_state import *
from .utils import *
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Dict, Optional, Union
import torch
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""This file is a pure Python wrapper for the cudart library.
It avoids the need to compile a separate shared library, and is
convenient for use when we just need to call a few functions.
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import ctypes
from contextlib import contextmanager
from typing import List, Optional, Union
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import ctypes
import json
import os
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import torch
import torch.distributed as dist
from torch.distributed import ProcessGroup
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Optional, Union
# ===================== import region =====================
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# This file is a pure Python wrapper for the NCCL library.
# The main purpose is to use NCCL combined with CUDA graph.
# Before writing this script, we tried the following approach:
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import os
import pickle
import sys
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import os
import torch
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import torch
import torch.distributed as dist
from torch.distributed import ProcessGroup
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""
KVConnectorBase Class for Distributed KV Cache & Hidden State communication
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import importlib
from typing import TYPE_CHECKING, Callable, Dict, Type
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""
Simple KV Cache Connector for Distributed Machine Learning Inference
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""
This file contains a new class `KVLookupBufferBase` that allows developers to
think of KV cache operations as inserting new KV cache entries (`insert`)
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""
Implements a distributed key-value (KV) cache transfer mechanism.
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""
This file defines an interface `KVPipeBase`
that provides an abstraction for sending and receiving tensors, or None, via
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import json
import os
import pickle
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""
This module implements a PyNccl pipe for sending and receiving
Optional[torch.Tensor] between distributed ranks with advanced
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""A centralized entrypoint to perform distributed KV cache transfer.
This implementation is a shim wrapper on two APIs exposed by `kv_connector`:
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2023 The vLLM team.
# Adapted from
# https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/core/parallel_state.py
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2023 The vLLM team.
# Adapted from
# https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/core/tensor_parallel/utils.py
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import argparse
import dataclasses
import json
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import asyncio
import copy
import time
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
# Workaround for https://github.com/python/cpython/issues/86296
#
# From https://github.com/aio-libs/async-timeout/blob/master/async_timeout/__init__.py
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import copy
import time
from collections import Counter as collectionsCounter
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import time
from typing import TYPE_CHECKING
from typing import Counter as CollectionsCounter
+1
View File
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
"""
These types are defined in this file to avoid importing vllm.engine.metrics
and therefore importing prometheus_client.
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import uuid
from dataclasses import dataclass, field
from enum import Enum
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import asyncio
import copy
import pickle
+2
View File
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
import pickle
import signal
from contextlib import contextmanager

Some files were not shown because too many files have changed in this diff Show More