repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/engine/protocol.py
vllm/engine/protocol.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import ABC, abstractmethod from collections.abc import AsyncGenerator, Iterable, Mapping from typing import Any from vllm.config import ModelConfig, VllmConfig from vllm.inputs.data import PromptType fr...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/engine/async_llm_engine.py
vllm/engine/async_llm_engine.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.v1.engine.async_llm import AsyncLLM AsyncLLMEngine = AsyncLLM # type: ignore
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/logging_utils/lazy.py
vllm/logging_utils/lazy.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Callable from typing import Any class lazy: """Wrap a zero-argument callable evaluated only during log formatting.""" __slots__ = ("_factory",) def __init__(self, facto...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/logging_utils/formatter.py
vllm/logging_utils/formatter.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import logging from pathlib import Path from vllm import envs class NewLineFormatter(logging.Formatter): """Adds logging prefix to newlines to align multi-line messages.""" def __init__(self, fmt, dat...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/logging_utils/__init__.py
vllm/logging_utils/__init__.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.logging_utils.formatter import ColoredFormatter, NewLineFormatter from vllm.logging_utils.lazy import lazy from vllm.logging_utils.log_time import logtime __all__ = [ "NewLineFormatter", "Color...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/logging_utils/dump_input.py
vllm/logging_utils/dump_input.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import contextlib import enum import json import torch from vllm.config import VllmConfig from vllm.logger import init_logger from vllm.v1.core.sched.output import SchedulerOutput from vllm.v1.metrics.stats imp...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/logging_utils/log_time.py
vllm/logging_utils/log_time.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Provides a timeslice logging decorator """ import functools import time def logtime(logger, msg=None): """ Logs the execution time of the decorated function. Always place it beneath other decora...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/tokenizers/deepseek_v32_encoding.py
vllm/tokenizers/deepseek_v32_encoding.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # copy from https://huggingface.co/deepseek-ai/DeepSeek-V3.2/blob/main/encoding/encoding_dsv32.py import copy import json from typing import Any import regex as re # flake8: noqa: E501 TOOLS_SYSTEM_TEMPLATE = ...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/tokenizers/registry.py
vllm/tokenizers/registry.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import importlib.util from dataclasses import dataclass, field from functools import lru_cache from pathlib import Path from typing import TYPE_CHECKING import huggingface_hub from typing_extensions import TypeVa...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/tokenizers/detokenizer_utils.py
vllm/tokenizers/detokenizer_utils.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.tokenizers import TokenizerLike def _replace_none_with_empty(tokens: list[str | None]): for i, token in enumerate(tokens): if token is None: tokens[i] = "" def _convert_toke...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/tokenizers/hf.py
vllm/tokenizers/hf.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import contextlib import copy from pathlib import Path from typing import TypeAlias from transformers import AutoTokenizer, PreTrainedTokenizer, PreTrainedTokenizerFast from vllm.transformers_utils.config import...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/tokenizers/__init__.py
vllm/tokenizers/__init__.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from .protocol import TokenizerLike from .registry import ( TokenizerRegistry, cached_get_tokenizer, cached_tokenizer_from_config, get_tokenizer, ) __all__ = [ "TokenizerLike", "Tokenizer...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/tokenizers/protocol.py
vllm/tokenizers/protocol.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from pathlib import Path from typing import TYPE_CHECKING, Any, Protocol if TYPE_CHECKING: from transformers import BatchEncoding from vllm.entrypoints.chat_utils import ChatCompletionMessageParam clas...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/tokenizers/deepseek_v32.py
vllm/tokenizers/deepseek_v32.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from pathlib import Path from typing import Any from transformers import BatchEncoding from vllm.entrypoints.chat_utils import ChatCompletionMessageParam from .deepseek_v32_encoding import encode_messages from...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/tokenizers/mistral.py
vllm/tokenizers/mistral.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from pathlib import Path from typing import TYPE_CHECKING, Any, cast from mistral_common.protocol.instruct.request import ( ChatCompletionRequest as MistralChatCompletionRequest, ) from mistral_common.protoco...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/peft_helper.py
vllm/lora/peft_helper.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project # Adapted from: https://github.com/huggingface/peft/blob/main/src/peft/tuners/lora/config.py import json import math import os from dataclasses import MISSING, dataclass, field, fields from typing import Literal...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/worker_manager.py
vllm/lora/worker_manager.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from contextlib import contextmanager from typing import Any, Literal import torch from vllm.config import VllmConfig from vllm.logger import init_logger from vllm.lora.lora_model import LoRAModel from vllm.lor...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/resolver.py
vllm/lora/resolver.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from abc import ABC, abstractmethod from collections.abc import Set from dataclasses import dataclass, field from vllm.logger import init_logger from vllm.lora.request import LoRARequest logger = init_logger(__...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/lora_model.py
vllm/lora/lora_model.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os import safetensors import torch from vllm.logger import init_logger from vllm.lora.lora_weights import LoRALayerWeights from vllm.lora.peft_helper import PEFTHelper from vllm.lora.utils import ( g...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/request.py
vllm/lora/request.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import msgspec class LoRARequest( msgspec.Struct, omit_defaults=True, # type: ignore[call-arg] array_like=True, ): # type: ignore[call-arg] """ Request for a LoRA adapter. lora_int_i...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/utils.py
vllm/lora/utils.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os from typing import TYPE_CHECKING, Optional import huggingface_hub from huggingface_hub.utils import ( EntryNotFoundError, HfHubHTTPError, HFValidationError, RepositoryNotFoundError, ) f...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/model_manager.py
vllm/lora/model_manager.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math from collections.abc import Callable from typing import TypeVar import regex as re import torch from torch import nn from vllm.config import VllmConfig from vllm.config.lora import LoRAConfig, Model...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
true
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/__init__.py
vllm/lora/__init__.py
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/lora_weights.py
vllm/lora/lora_weights.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Sequence as GenericSequence from typing import Optional import torch import torch.types from vllm.lora.peft_helper import PEFTHelper from vllm.utils.platform_utils import is_pin_memo...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/punica_wrapper/punica_base.py
vllm/lora/punica_wrapper/punica_base.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Based on: Chen, L., Ye, Z., Wu, Y., Zhuo, D., Ceze, L., & Krishnamurthy, A. (2023). Punica: Multi-Tenant LoRA Serving. https://arxiv.org/abs/2310.18547 """ from abc import ABC, abstractmethod from typing impo...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/punica_wrapper/punica_xpu.py
vllm/lora/punica_wrapper/punica_xpu.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Based on: Chen, L., Ye, Z., Wu, Y., Zhuo, D., Ceze, L., & Krishnamurthy, A. (2023). Punica: Multi-Tenant LoRA Serving. https://arxiv.org/abs/2310.18547 """ from typing import final import torch from vllm.lo...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/punica_wrapper/punica_tpu.py
vllm/lora/punica_wrapper/punica_tpu.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import math from typing import TYPE_CHECKING import torch import torch.nn.functional as F import torch_xla from vllm.lora.ops.xla_ops import bgmv_expand, bgmv_expand_slice, bgmv_shrink from vllm.lora.punica_wra...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/punica_wrapper/punica_cpu.py
vllm/lora/punica_wrapper/punica_cpu.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from collections.abc import Callable import torch from vllm.lora.ops.torch_ops import ( bgmv_expand, bgmv_expand_slice, bgmv_shrink, sgmv_expand, sgmv_expand_slice, sgmv_shrink, ) from ...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/punica_wrapper/utils.py
vllm/lora/punica_wrapper/utils.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import TYPE_CHECKING import torch if TYPE_CHECKING: # avoid circuit import from vllm.lora.layers import LoRAMapping def compute_meta( token_lora_tensor: torch.Tensor, ) -> tuple[torch....
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/punica_wrapper/__init__.py
vllm/lora/punica_wrapper/__init__.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.lora.punica_wrapper.punica_base import PunicaWrapperBase from vllm.lora.punica_wrapper.punica_selector import get_punica_wrapper __all__ = [ "PunicaWrapperBase", "get_punica_wrapper", ]
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/punica_wrapper/punica_gpu.py
vllm/lora/punica_wrapper/punica_gpu.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Based on: Chen, L., Ye, Z., Wu, Y., Zhuo, D., Ceze, L., & Krishnamurthy, A. (2023). Punica: Multi-Tenant LoRA Serving. https://arxiv.org/abs/2310.18547 """ from typing import final import torch from vllm.lo...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/punica_wrapper/punica_selector.py
vllm/lora/punica_wrapper/punica_selector.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.logger import init_logger from vllm.platforms import current_platform from vllm.utils.import_utils import resolve_obj_by_qualname from .punica_base import PunicaWrapperBase logger = init_logger(__name...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/layers/row_parallel_linear.py
vllm/lora/layers/row_parallel_linear.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import torch.nn as nn from transformers import PretrainedConfig from vllm.config.lora import LoRAConfig from vllm.distributed import ( split_tensor_along_last_dim, tensor_model_parallel_all...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/layers/logits_processor.py
vllm/lora/layers/logits_processor.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import torch.nn as nn from transformers import PretrainedConfig from vllm.config.lora import LoRAConfig from vllm.distributed import ( get_tensor_model_parallel_rank, get_tensor_model_paral...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/layers/base_linear.py
vllm/lora/layers/base_linear.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from transformers import PretrainedConfig from vllm.config.lora import LoRAConfig from vllm.distributed.utils import divide from vllm.model_executor.layers.linear import ( ColumnParallelLinear,...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/layers/utils.py
vllm/lora/layers/utils.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from dataclasses import dataclass from enum import Enum import torch import torch.nn as nn class LoRAMappingType(Enum): LANGUAGE = 1 TOWER = 2 CONNECTOR = 3 @dataclass class LoRAMapping: inde...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/layers/column_parallel_linear.py
vllm/lora/layers/column_parallel_linear.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import torch.nn as nn from transformers import PretrainedConfig from vllm.config.lora import LoRAConfig from vllm.distributed import tensor_model_parallel_all_gather from vllm.distributed.utils imp...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/layers/vocal_parallel_embedding.py
vllm/lora/layers/vocal_parallel_embedding.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import torch.nn as nn import torch.nn.functional as F from transformers import PretrainedConfig from vllm.config.lora import LoRAConfig from vllm.model_executor.layers.vocab_parallel_embedding impo...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/layers/__init__.py
vllm/lora/layers/__init__.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.lora.layers.base import BaseLayerWithLoRA from vllm.lora.layers.column_parallel_linear import ( ColumnParallelLinearWithLoRA, ColumnParallelLinearWithShardedLoRA, MergedColumnParallelLinearWi...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/layers/base.py
vllm/lora/layers/base.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from typing import TYPE_CHECKING import torch import torch.nn as nn from transformers import PretrainedConfig from vllm.config.lora import LoRAConfig if TYPE_CHECKING: from vllm.lora.punica_wrapper import ...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/layers/replicated_linear.py
vllm/lora/layers/replicated_linear.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch import torch.nn as nn from transformers import PretrainedConfig from vllm.config.lora import LoRAConfig from vllm.model_executor.layers.linear import ReplicatedLinear from .base_linear import Base...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/layers/fused_moe.py
vllm/lora/layers/fused_moe.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import functools import torch import torch.nn as nn from transformers import PretrainedConfig from vllm import envs from vllm.config.lora import LoRAConfig from vllm.distributed.parallel_state import ( get_t...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/__init__.py
vllm/lora/ops/__init__.py
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/torch_ops/lora_ops.py
vllm/lora/ops/torch_ops/lora_ops.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch def sgmv_expand( inputs: torch.Tensor, lora_b_weights: torch.Tensor, output_tensor: torch.Tensor, b_seq_start_loc: torch.Tensor, seq_len_tensor: torch.Tensor, lora_indices_t...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/torch_ops/__init__.py
vllm/lora/ops/torch_ops/__init__.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.lora.ops.torch_ops.lora_ops import ( bgmv_expand, # noqa: F401 bgmv_expand_slice, bgmv_shrink, sgmv_expand, sgmv_expand_slice, sgmv_shrink, ) __all__ = [ "bgmv_expand", ...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/ipex_ops/lora_ops.py
vllm/lora/ops/ipex_ops/lora_ops.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.logger import init_logger logger = init_logger(__name__) try: import intel_extension_for_pytorch as ipex except ImportError as e: raise e def bgmv_shrink( inputs: torch.Ten...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/ipex_ops/__init__.py
vllm/lora/ops/ipex_ops/__init__.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.lora.ops.ipex_ops.lora_ops import bgmv_expand, bgmv_expand_slice, bgmv_shrink __all__ = ["bgmv_expand", "bgmv_expand_slice", "bgmv_shrink"]
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/triton_ops/lora_kernel_metadata.py
vllm/lora/ops/triton_ops/lora_kernel_metadata.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ LoRA kernels metadata preparation utilities. """ from dataclasses import dataclass import torch @dataclass class LoRAKernelMeta: token_lora_mapping: torch.Tensor token_indices_sorted_by_lora_ids: t...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/triton_ops/kernel_utils.py
vllm/lora/ops/triton_ops/kernel_utils.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Utilities for Punica kernel construction. """ from vllm.triton_utils import tl, triton @triton.jit def mm_k( a_ptr, b_ptr, ak_stride, bk_stride, offset_k, K: tl.constexpr, BLOCK_...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/triton_ops/lora_expand_op.py
vllm/lora/ops/triton_ops/lora_expand_op.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Based on: Chen, L., Ye, Z., Wu, Y., Zhuo, D., Ceze, L., & Krishnamurthy, A. (2023). Punica: Multi-Tenant LoRA Serving. https://arxiv.org/abs/2310.18547 """ import torch from vllm.lora.ops.triton_ops.kernel_u...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/triton_ops/fused_moe_lora_op.py
vllm/lora/ops/triton_ops/fused_moe_lora_op.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import torch from vllm.distributed import ( tensor_model_parallel_all_gather, tensor_model_parallel_all_reduce, ) from vllm.triton_utils import tl, triton from vllm.utils.torch_utils import direct_regist...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/triton_ops/utils.py
vllm/lora/ops/triton_ops/utils.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import functools import json from functools import lru_cache from pathlib import Path from typing import Any import torch from vllm import envs from vllm.logger import init_logger from vllm.model_executor.layer...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/triton_ops/__init__.py
vllm/lora/ops/triton_ops/__init__.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.lora.ops.triton_ops.fused_moe_lora_op import ( fused_moe_lora, fused_moe_lora_expand, fused_moe_lora_shrink, ) from vllm.lora.ops.triton_ops.lora_expand_op import lora_expand from vllm.lora...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/triton_ops/lora_shrink_op.py
vllm/lora/ops/triton_ops/lora_shrink_op.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project """ Based on: Chen, L., Ye, Z., Wu, Y., Zhuo, D., Ceze, L., & Krishnamurthy, A. (2023). Punica: Multi-Tenant LoRA Serving. https://arxiv.org/abs/2310.18547 """ import torch from vllm.lora.ops.triton_ops.kernel_u...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/xla_ops/lora_ops.py
vllm/lora/ops/xla_ops/lora_ops.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import jax import jax.numpy as jnp import torch import torch.nn.functional as F import torch_xla.core.xla_builder as xb from torch.library import impl from torch_xla.experimental.custom_kernel import XLA_LIB, jax...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/vllm/lora/ops/xla_ops/__init__.py
vllm/lora/ops/xla_ops/__init__.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project from vllm.lora.ops.xla_ops.lora_ops import bgmv_expand, bgmv_expand_slice, bgmv_shrink __all__ = ["bgmv_expand", "bgmv_expand_slice", "bgmv_shrink"]
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/csrc/cutlass_extensions/vllm_cutlass_library_extension.py
csrc/cutlass_extensions/vllm_cutlass_library_extension.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import enum from cutlass_library import * # # Extend cutlass library with custom types, and missing values # class VLLMDataType(enum.Enum): u4b8 = enum_auto() u8b128 = enum_auto() class MixedInput...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/csrc/quantization/gptq_marlin/generate_kernels.py
csrc/quantization/gptq_marlin/generate_kernels.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import glob import itertools import os import subprocess import sys import jinja2 ARCHS = [] SUPPORT_FP8 = False SUPPORT_SM75 = False SUPPORT_SM80 = False for arch in sys.argv[1].split(","): arch = arch[: ar...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/csrc/quantization/machete/generate.py
csrc/quantization/machete/generate.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import itertools import math import os import shutil from collections.abc import Iterable from copy import deepcopy from dataclasses import dataclass, fields from functools import reduce import jinja2 from vllm_...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
vllm-project/vllm
https://github.com/vllm-project/vllm/blob/0d4044edd85de30d7d4558aeea4d1e95c7c556d6/csrc/moe/marlin_moe_wna16/generate_kernels.py
csrc/moe/marlin_moe_wna16/generate_kernels.py
# SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import glob import itertools import os import subprocess import sys import jinja2 ARCHS = [] SUPPORT_FP8 = False SUPPORT_SM75 = False SUPPORT_SM80 = False for arch in sys.argv[1].split(","): arch = arch[: ar...
python
Apache-2.0
0d4044edd85de30d7d4558aeea4d1e95c7c556d6
2026-01-04T14:38:19.902011Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/setup.py
setup.py
import setuptools with open("readme.md", "r", encoding="utf-8") as f: long_description = f.read() setuptools.setup( name='labml_nn', version='0.5.1', author="Varuna Jayasiri, Nipun Wijerathne", author_email="[email protected], [email protected]", description="🧑‍🏫 Implementations/tutorials ...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/utils/papers_list.py
utils/papers_list.py
import json import re from pathlib import Path from labml import logger from labml.logger import Text HOME = Path('./labml_nn').absolute() print(HOME) REGEX = re.compile(r""" \( https://arxiv\.org/abs/ # Start of a numeric entity reference (?P<id>[0-9\.]+) # Paper ID \) """, re.VERBOSE) IGNORE = { 'neox/m...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/utils/sitemap.py
utils/sitemap.py
from pathlib import Path import git HOME = Path('./labml_nn') REPO = git.Repo('.') def collect(path: Path): if path.is_file(): try: commit = next(iter(REPO.iter_commits(paths=path))) except StopIteration: return [] html = path.relative_to(HOME) if html.su...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/utils/diagrams.py
utils/diagrams.py
import shutil from pathlib import Path from typing import List from xml.dom import minidom import os from labml import monit HOME = Path('.').absolute() STYLES = """ .black-stroke { stroke: #aaa; } rect.black-stroke { stroke: #444; } .black-fill { fill: #ddd; } .white-fill { fill: #333; } .blue-s...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/utils/__init__.py
utils/__init__.py
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/__init__.py
labml_nn/__init__.py
""" # [Annotated Research Paper Implementations: Transformers, StyleGAN, Stable Diffusion, DDPM/DDIM, LayerNorm, Nucleus Sampling and more](index.html) This is a collection of simple PyTorch implementations of neural networks and related algorithms. [These implementations](https://github.com/labmlai/annotated_deep_lea...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/rl/__init__.py
labml_nn/rl/__init__.py
""" --- title: Reinforcement Learning Algorithms summary: > This is a collection of PyTorch implementations/tutorials of reinforcement learning algorithms. It currently includes Proximal Policy Optimization, Generalized Advantage Estimation, and Deep Q Networks. --- # Reinforcement Learning Algorithms * [Proxim...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/rl/game.py
labml_nn/rl/game.py
""" --- title: Atari wrapper with multi-processing summary: This implements the Atari games with multi-processing. --- # Atari wrapper with multi-processing """ import multiprocessing import multiprocessing.connection import cv2 import gym import numpy as np class Game: """ <a id="GameEnvironment"></a> ...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/rl/ppo/gae.py
labml_nn/rl/ppo/gae.py
""" --- title: Generalized Advantage Estimation (GAE) summary: A PyTorch implementation/tutorial of Generalized Advantage Estimation (GAE). --- # Generalized Advantage Estimation (GAE) This is a [PyTorch](https://pytorch.org) implementation of paper [Generalized Advantage Estimation](https://arxiv.org/abs/1506.02438)...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/rl/ppo/experiment.py
labml_nn/rl/ppo/experiment.py
""" --- title: PPO Experiment with Atari Breakout summary: Annotated implementation to train a PPO agent on Atari Breakout game. --- # PPO Experiment with Atari Breakout This experiment trains Proximal Policy Optimization (PPO) agent Atari Breakout game on OpenAI Gym. It runs the [game environments on multiple proce...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/rl/ppo/__init__.py
labml_nn/rl/ppo/__init__.py
""" --- title: Proximal Policy Optimization - PPO summary: > An annotated implementation of Proximal Policy Optimization - PPO algorithm in PyTorch. --- # Proximal Policy Optimization - PPO This is a [PyTorch](https://pytorch.org) implementation of [Proximal Policy Optimization - PPO](https://arxiv.org/abs/1707.0634...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/rl/dqn/experiment.py
labml_nn/rl/dqn/experiment.py
""" --- title: DQN Experiment with Atari Breakout summary: Implementation of DQN experiment with Atari Breakout --- # DQN Experiment with Atari Breakout This experiment trains a Deep Q Network (DQN) to play Atari Breakout game on OpenAI Gym. It runs the [game environments on multiple processes](../game.html) to sampl...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/rl/dqn/model.py
labml_nn/rl/dqn/model.py
""" --- title: Deep Q Network (DQN) Model summary: Implementation of neural network model for Deep Q Network (DQN). --- # Deep Q Network (DQN) Model [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/labmlai/annotated_deep_learning_paper_implementatio...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/rl/dqn/__init__.py
labml_nn/rl/dqn/__init__.py
""" --- title: Deep Q Networks (DQN) summary: > This is a PyTorch implementation/tutorial of Deep Q Networks (DQN) from paper Playing Atari with Deep Reinforcement Learning. This includes dueling network architecture, a prioritized replay buffer and double-Q-network training. --- # Deep Q Networks (DQN) This...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/rl/dqn/replay_buffer.py
labml_nn/rl/dqn/replay_buffer.py
""" --- title: Prioritized Experience Replay Buffer summary: Annotated implementation of prioritized experience replay using a binary segment tree. --- # Prioritized Experience Replay Buffer This implements paper [Prioritized experience replay](https://arxiv.org/abs/1511.05952), using a binary segment tree. [![Open ...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/distillation/small.py
labml_nn/distillation/small.py
""" --- title: Train a small model on CIFAR 10 summary: > Train a small model on CIFAR 10 to test how much distillation benefits. --- # Train a small model on CIFAR 10 This trains a small model on CIFAR 10 to test how much [distillation](index.html) benefits. """ import torch.nn as nn from labml import experimen...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/distillation/large.py
labml_nn/distillation/large.py
""" --- title: Train a large model on CIFAR 10 summary: > Train a large model on CIFAR 10 for distillation. --- # Train a large model on CIFAR 10 This trains a large model on CIFAR 10 for [distillation](index.html). """ import torch.nn as nn from labml import experiment, logger from labml.configs import option f...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/distillation/__init__.py
labml_nn/distillation/__init__.py
""" --- title: Distilling the Knowledge in a Neural Network summary: > PyTorch implementation and tutorial of the paper Distilling the Knowledge in a Neural Network. --- # Distilling the Knowledge in a Neural Network This is a [PyTorch](https://pytorch.org) implementation/tutorial of the paper [Distilling the Kno...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/experiments/nlp_classification.py
labml_nn/experiments/nlp_classification.py
""" --- title: NLP classification trainer summary: > This is a reusable trainer for classification tasks --- # NLP model trainer for classification """ from collections import Counter from typing import Callable import torchtext import torchtext.vocab from torchtext.vocab import Vocab import torch from labml impo...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/experiments/arithmetic_dataset.py
labml_nn/experiments/arithmetic_dataset.py
""" --- title: Arithmetic Dataset summary: > This creates arithmetic problems. --- *This is based on code by [Georges Harik (@gharik)](https://twitter.com/gharik).* """ import random import string from typing import List import torch from labml.logger import Text from torch.utils.data import DataLoader, Dataset f...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/experiments/mnist.py
labml_nn/experiments/mnist.py
""" --- title: MNIST Experiment summary: > This is a reusable trainer for MNIST dataset --- # MNIST Experiment """ import torch.nn as nn import torch.utils.data from labml import tracker from labml.configs import option from labml_nn.helpers.datasets import MNISTConfigs as MNISTDatasetConfigs from labml_nn.helpers...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/experiments/__init__.py
labml_nn/experiments/__init__.py
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/experiments/cifar10.py
labml_nn/experiments/cifar10.py
""" --- title: CIFAR10 Experiment summary: > This is a reusable trainer for CIFAR10 dataset --- # CIFAR10 Experiment """ from typing import List import torch.nn as nn from labml import lab from labml.configs import option from labml_nn.helpers.datasets import CIFAR10Configs as CIFAR10DatasetConfigs from labml_nn.e...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/experiments/nlp_autoregression.py
labml_nn/experiments/nlp_autoregression.py
""" --- title: NLP auto-regression trainer summary: > This is a reusable trainer for auto-regressive tasks --- # Auto-regressive NLP model trainer """ from typing import Callable import torch import torch.nn as nn from labml import lab, monit, logger, tracker from labml.configs import option from labml.logger impo...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/unet/experiment.py
labml_nn/unet/experiment.py
""" --- title: Training a U-Net on Carvana dataset summary: > Code for training a U-Net model on Carvana dataset. --- # Training [U-Net](index.html) This trains a [U-Net](index.html) model on [Carvana dataset](carvana.html). You can find the download instructions [on Kaggle](https://www.kaggle.com/competitions/carv...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/unet/carvana.py
labml_nn/unet/carvana.py
""" --- title: Carvana dataset for the U-Net experiment summary: > Carvana dataset for the U-Net experiment. --- # Carvana Dataset for the [U-Net](index.html) [experiment](experiment.html) You can find the download instructions [on Kaggle](https://www.kaggle.com/competitions/carvana-image-masking-challenge/data). ...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/unet/__init__.py
labml_nn/unet/__init__.py
""" --- title: U-Net summary: > PyTorch implementation and tutorial of U-Net model. --- # U-Net This is an implementation of the U-Net model from the paper, [U-Net: Convolutional Networks for Biomedical Image Segmentation](https://arxiv.org/abs/1505.04597). U-Net consists of a contracting path and an expansive p...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/adaptive_computation/__init__.py
labml_nn/adaptive_computation/__init__.py
""" --- title: Neural Networks with Adaptive Computation summary: > A set of PyTorch implementations/tutorials related to adaptive computation --- # Neural Networks with Adaptive Computation These are neural network architectures that change the computation complexity based on the complexity of the input sample. * ...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/adaptive_computation/parity.py
labml_nn/adaptive_computation/parity.py
""" --- title: "Parity Task" summary: > This creates data for Parity Task from the paper Adaptive Computation Time for Recurrent Neural Networks --- # Parity Task This creates data for Parity Task from the paper [Adaptive Computation Time for Recurrent Neural Networks](https://arxiv.org/abs/1603.08983). The inpu...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/adaptive_computation/ponder_net/experiment.py
labml_nn/adaptive_computation/ponder_net/experiment.py
""" --- title: "PonderNet Parity Task Experiment" summary: > This trains is a PonderNet on Parity Task --- # [PonderNet](index.html) [Parity Task](../parity.html) Experiment This trains a [PonderNet](index.html) on [Parity Task](../parity.html). """ from typing import Any import torch from torch import nn from to...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/adaptive_computation/ponder_net/__init__.py
labml_nn/adaptive_computation/ponder_net/__init__.py
""" --- title: "PonderNet: Learning to Ponder" summary: > A PyTorch implementation/tutorial of PonderNet: Learning to Ponder. --- # PonderNet: Learning to Ponder This is a [PyTorch](https://pytorch.org) implementation of the paper [PonderNet: Learning to Ponder](https://arxiv.org/abs/2107.05407). PonderNet adapts t...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/optimizers/adam_warmup_cosine_decay.py
labml_nn/optimizers/adam_warmup_cosine_decay.py
""" --- title: Adam optimizer with warm-up and cosine decay summary: A PyTorch implementation/tutorial of Adam optimizer with warm-up and cosine decay for GPT. --- # Adam Optimizer with Warmup and Cosine Decay This extends [AMSGrad optimizer](adam.html) and adds a warmup stage. """ import math from typing import Dict...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/optimizers/ada_belief.py
labml_nn/optimizers/ada_belief.py
""" --- title: AdaBelief optimizer summary: A simple PyTorch implementation/tutorial of AdaBelief optimizer. --- # AdaBelief Optimizer This is based from AdaBelief [official implementation](https://github.com/juntang-zhuang/Adabelief-Optimizer) of the paper [AdaBelief Optimizer: Adapting Stepsizes by the Belief in Ob...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/optimizers/radam.py
labml_nn/optimizers/radam.py
""" --- title: Rectified Adam (RAdam) optimizer summary: A simple PyTorch implementation/tutorial of RAdam optimizer. --- # Rectified Adam (RAdam) optimizer This implementation is based on [the official implementation](https://github.com/LiyuanLucasLiu/RAdam) of the paper [On the Variance of the Adaptive Learning Rat...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/optimizers/adam.py
labml_nn/optimizers/adam.py
""" --- title: Adam Optimizer summary: A simple PyTorch implementation/tutorial of Adam optimizer --- # Adam Optimizer This is a [PyTorch](https://pytorch.org) implementation of popular optimizer *Adam* from paper [Adam: A Method for Stochastic Optimization](https://arxiv.org/abs/1412.6980). *Adam* update is, \beg...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/optimizers/configs.py
labml_nn/optimizers/configs.py
""" --- title: Configurable optimizer module summary: This implements a configurable module for optimizers. --- # Configurable Optimizer """ from typing import Tuple import torch from labml.configs import BaseConfigs, option, meta_config from labml_nn.optimizers import WeightDecay class OptimizerConfigs(BaseConfi...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/optimizers/adam_fp16.py
labml_nn/optimizers/adam_fp16.py
""" --- title: Adam Optimizer for Half Precision Training summary: A simple PyTorch implementation/tutorial of Adam optimizer --- # Adam Optimizer for Half Precision Training """ from typing import Dict, Tuple, Optional, Any import torch from torch import nn from torch.optim import Optimizer from torch.cuda.amp impo...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/optimizers/__init__.py
labml_nn/optimizers/__init__.py
""" --- title: Optimizers summary: > A set of PyTorch implementations/tutorials of popular gradient descent based optimizers. Currently includes Adam, AMSGrad and RAdam optimizers. --- # Optimizers ## Optimizer Implementations * [Adam Optimizer](adam.html) * [AMSGrad Optimizer](amsgrad.html) * [Adam Optimizer with ...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/optimizers/sophia.py
labml_nn/optimizers/sophia.py
""" --- title: Sophia Optimizer summary: A simple PyTorch implementation/tutorial of Sophia optimizer --- # Sophia Optimizer This is a [PyTorch](https://pytorch.org) implementation of *Sophia-G* from paper [Sophia: A Scalable Stochastic Second-order Optimizer for Language Model Pre-training](https://arxiv.org/abs/23...
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false
labmlai/annotated_deep_learning_paper_implementations
https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/25e169843e93980faa1d0468ea4df42ca7463382/labml_nn/optimizers/adam_warmup.py
labml_nn/optimizers/adam_warmup.py
""" --- title: Adam optimizer with warm-up summary: A simple PyTorch implementation/tutorial of Adam optimizer with warm-up. --- # Adam Optimizer with Warmup This extends [AMSGrad optimizer](amsgrad.html) and adds a warmup stage. """ from typing import Dict from labml_nn.optimizers import WeightDecay from labml_nn....
python
MIT
25e169843e93980faa1d0468ea4df42ca7463382
2026-01-04T14:38:23.238891Z
false