Skip to content
Closed
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
4 changes: 2 additions & 2 deletions llama_stack/core/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# the root directory of this source tree.

import importlib.resources
import logging
import sys

from pydantic import BaseModel
Expand All @@ -17,9 +16,10 @@
from llama_stack.core.utils.exec import run_command
from llama_stack.core.utils.image_types import LlamaStackImageType
from llama_stack.distributions.template import DistributionTemplate
from llama_stack.log import get_logger
from llama_stack.providers.datatypes import Api

log = logging.getLogger(__name__)
log = get_logger(name=__name__, category="core")

# These are the dependencies needed by the distribution server.
# `llama-stack` is automatically installed by the installation script.
Expand Down
4 changes: 2 additions & 2 deletions llama_stack/core/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
import logging
import textwrap
from typing import Any

Expand All @@ -21,9 +20,10 @@
from llama_stack.core.utils.config_dirs import EXTERNAL_PROVIDERS_DIR
from llama_stack.core.utils.dynamic import instantiate_class_type
from llama_stack.core.utils.prompt_for_config import prompt_for_config
from llama_stack.log import get_logger
from llama_stack.providers.datatypes import Api, ProviderSpec

logger = logging.getLogger(__name__)
logger = get_logger(name=__name__, category="core")


def configure_single_provider(registry: dict[str, ProviderSpec], provider: Provider) -> Provider:
Expand Down
3 changes: 2 additions & 1 deletion llama_stack/core/library_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@
from llama_stack.core.utils.config import redact_sensitive_fields
from llama_stack.core.utils.context import preserve_contexts_async_generator
from llama_stack.core.utils.exec import in_notebook
from llama_stack.log import get_logger
from llama_stack.providers.utils.telemetry.tracing import (
CURRENT_TRACE_CONTEXT,
end_trace,
setup_logger,
start_trace,
)

logger = logging.getLogger(__name__)
logger = get_logger(name=__name__, category="core")

T = TypeVar("T")

Expand Down
4 changes: 2 additions & 2 deletions llama_stack/core/request_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

import contextvars
import json
import logging
from contextlib import AbstractContextManager
from typing import Any

from llama_stack.core.datatypes import User
from llama_stack.log import get_logger

from .utils.dynamic import instantiate_class_type

log = logging.getLogger(__name__)
log = get_logger(name=__name__, category="core")

# Context variable for request provider data and auth attributes
PROVIDER_DATA_VAR = contextvars.ContextVar("provider_data", default=None)
Expand Down
5 changes: 3 additions & 2 deletions llama_stack/core/utils/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

import logging
import os
import signal
import subprocess
import sys

from termcolor import cprint

log = logging.getLogger(__name__)
from llama_stack.log import get_logger

log = get_logger(name=__name__, category="core")

import importlib

Expand Down
5 changes: 3 additions & 2 deletions llama_stack/core/utils/prompt_for_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@

import inspect
import json
import logging
from enum import Enum
from typing import Annotated, Any, Literal, Union, get_args, get_origin

from pydantic import BaseModel
from pydantic.fields import FieldInfo
from pydantic_core import PydanticUndefinedType

log = logging.getLogger(__name__)
from llama_stack.log import get_logger

log = get_logger(name=__name__, category="core")


def is_list_of_primitives(field_type):
Expand Down
9 changes: 5 additions & 4 deletions llama_stack/models/llama/llama3/multimodal/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

import logging
import math
from collections.abc import Callable
from functools import partial
Expand All @@ -22,6 +20,8 @@
from torch import Tensor, nn
from torch.distributed import _functional_collectives as funcol

from llama_stack.log import get_logger

from ..model import ModelArgs, RMSNorm, apply_rotary_emb, precompute_freqs_cis
from .encoder_utils import (
build_encoder_attention_mask,
Expand All @@ -34,9 +34,10 @@
from .image_transform import VariableSizeImageTransform
from .utils import get_negative_inf_value, to_2tuple

logger = logging.getLogger(__name__)
MP_SCALE = 8

logger = get_logger(name=__name__, category="models")


def reduce_from_tensor_model_parallel_region(input_):
"""All-reduce the input tensor across model parallel group."""
Expand Down Expand Up @@ -771,7 +772,7 @@ def load_hook(
if embed is not None:
# reshape the weights to the correct shape
nt_old, nt_old, _, w = embed.shape
logging.info(f"Resizing tile embedding from {nt_old}x{nt_old} to {self.num_tiles}x{self.num_tiles}")
logger.info(f"Resizing tile embedding from {nt_old}x{nt_old} to {self.num_tiles}x{self.num_tiles}")
embed_new = TilePositionEmbedding._dynamic_resize(embed, self.num_tiles)
# assign the weights to the module
state_dict[prefix + "embedding"] = embed_new
Expand Down
5 changes: 3 additions & 2 deletions llama_stack/models/llama/llama4/quantization/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

import logging
import os
from collections.abc import Callable

Expand All @@ -13,11 +12,13 @@
from torch import Tensor, nn
from torch.nn import functional as F

from llama_stack.log import get_logger

from ...datatypes import QuantizationMode
from ..model import Transformer, TransformerBlock
from ..moe import MoE

log = logging.getLogger(__name__)
log = get_logger(name=__name__, category="models")


def swiglu_wrapper_no_reduce(
Expand Down
5 changes: 3 additions & 2 deletions llama_stack/models/llama/quantize_impls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

# type: ignore
import collections
import logging

log = logging.getLogger(__name__)
from llama_stack.log import get_logger

log = get_logger(name=__name__, category="llama")

try:
import fbgemm_gpu.experimental.gen_ai # noqa: F401
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

import logging
import uuid
from collections.abc import AsyncGenerator
from datetime import UTC, datetime
Expand Down Expand Up @@ -42,6 +41,7 @@
from llama_stack.apis.tools import ToolGroups, ToolRuntime
from llama_stack.apis.vector_io import VectorIO
from llama_stack.core.datatypes import AccessRule
from llama_stack.log import get_logger
from llama_stack.providers.utils.kvstore import InmemoryKVStoreImpl, kvstore_impl
from llama_stack.providers.utils.pagination import paginate_records
from llama_stack.providers.utils.responses.responses_store import ResponsesStore
Expand All @@ -51,7 +51,7 @@
from .openai_responses import OpenAIResponsesImpl
from .persistence import AgentInfo

logger = logging.getLogger()
logger = get_logger(name=__name__, category="openai_responses")


class MetaReferenceAgentsImpl(Agents):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
from llama_stack.providers.utils.inference.openai_compat import convert_tooldef_to_openai_tool
from llama_stack.providers.utils.responses.responses_store import ResponsesStore

logger = get_logger(name=__name__, category="openai_responses")
logger = get_logger(name=__name__, category="agents")

OPENAI_RESPONSES_PREFIX = "openai_responses:"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# the root directory of this source tree.

import json
import logging
import uuid
from datetime import UTC, datetime

Expand All @@ -15,9 +14,10 @@
from llama_stack.core.access_control.datatypes import AccessRule
from llama_stack.core.datatypes import User
from llama_stack.core.request_headers import get_authenticated_user
from llama_stack.log import get_logger
from llama_stack.providers.utils.kvstore import KVStore

log = logging.getLogger(__name__)
log = get_logger(name=__name__, category="agents")


class AgentSessionInfo(Session):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
# the root directory of this source tree.

import asyncio
import logging

from llama_stack.apis.inference import Message
from llama_stack.apis.safety import Safety, SafetyViolation, ViolationLevel
from llama_stack.log import get_logger
from llama_stack.providers.utils.telemetry import tracing

log = logging.getLogger(__name__)
log = get_logger(name=__name__, category="agents")


class SafetyException(Exception): # noqa: N818
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import copy
import json
import logging
import multiprocessing
import os
import tempfile
Expand All @@ -32,13 +31,14 @@
from pydantic import BaseModel, Field
from torch.distributed.launcher.api import LaunchConfig, elastic_launch

from llama_stack.log import get_logger
from llama_stack.models.llama.datatypes import GenerationResult
from llama_stack.providers.utils.inference.prompt_adapter import (
ChatCompletionRequestWithRawContent,
CompletionRequestWithRawContent,
)

log = logging.getLogger(__name__)
log = get_logger(name=__name__, category="inference")


class ProcessingMessageName(str, Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

import logging
from collections.abc import AsyncGenerator

from llama_stack.apis.inference import (
Expand All @@ -21,6 +20,7 @@
ToolPromptFormat,
)
from llama_stack.apis.models import ModelType
from llama_stack.log import get_logger
from llama_stack.providers.datatypes import Model, ModelsProtocolPrivate
from llama_stack.providers.utils.inference.embedding_mixin import (
SentenceTransformerEmbeddingMixin,
Expand All @@ -32,7 +32,7 @@

from .config import SentenceTransformersInferenceConfig

log = logging.getLogger(__name__)
log = get_logger(name=__name__, category="inference")


class SentenceTransformersInferenceImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import gc
import json
import logging
import multiprocessing
from pathlib import Path
from typing import Any
Expand All @@ -28,6 +27,7 @@
LoraFinetuningConfig,
TrainingConfig,
)
from llama_stack.log import get_logger
from llama_stack.providers.inline.post_training.common.utils import evacuate_model_from_device

from ..config import HuggingFacePostTrainingConfig
Expand All @@ -44,7 +44,7 @@
split_dataset,
)

logger = logging.getLogger(__name__)
logger = get_logger(name=__name__, category="post_training")


class HFFinetuningSingleDevice:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# the root directory of this source tree.

import gc
import logging
import multiprocessing
from pathlib import Path
from typing import Any
Expand All @@ -24,6 +23,7 @@
DPOAlignmentConfig,
TrainingConfig,
)
from llama_stack.log import get_logger
from llama_stack.providers.inline.post_training.common.utils import evacuate_model_from_device

from ..config import HuggingFacePostTrainingConfig
Expand All @@ -40,7 +40,7 @@
split_dataset,
)

logger = logging.getLogger(__name__)
logger = get_logger(name=__name__, category="post_training")


class HFDPOAlignmentSingleDevice:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

import logging
import os
import signal
import sys
Expand All @@ -19,10 +18,11 @@

from llama_stack.apis.datasetio import DatasetIO
from llama_stack.apis.post_training import Checkpoint, TrainingConfig
from llama_stack.log import get_logger

from .config import HuggingFacePostTrainingConfig

logger = logging.getLogger(__name__)
logger = get_logger(name=__name__, category="post_training")


def setup_environment():
Expand Down
Loading
Loading