Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve type hint issues and import dependencies #1176

Merged
merged 1 commit into from
Feb 25, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def worker_process_entrypoint(
while True:
try:
task = req_gen.send(result)
if isinstance(task, str) and task == _END_SENTINEL:
if isinstance(task, str) and task == EndSentinel():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait what? this was just referencing some unknown symbol?! 🤦

break

assert isinstance(task, TaskRequest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from typing import Any, Dict, List, Optional

import torch
from fairscale.nn.model_parallel.initialize import get_model_parallel_rank
from fairscale.nn.model_parallel.layers import ColumnParallelLinear, RowParallelLinear
from fairscale.nn.model_parallel.mappings import reduce_from_model_parallel_region
from llama_models.llama3.api.args import ModelArgs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ def show():
image_data.append({"image_base64": image_base64})
buf.close()

req_con, resp_con = _open_connections()
# The _open_connections method is dynamically made available to
# the interpreter by bundling code from "code_env_prefix.py" -- by literally prefixing it -- and
# then "eval"ing it within a sandboxed interpreter.
req_con, resp_con = _open_connections() # noqa: F821

_json_dump = _json.dumps(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
SamplingParams,
TextTruncation,
ToolChoice,
ToolConfig,
ToolDefinition,
ToolPromptFormat,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from typing import List

import pytest

from llama_stack.apis.common.job_types import JobStatus
Expand Down
7 changes: 5 additions & 2 deletions llama_stack/providers/utils/inference/embedding_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
# the root directory of this source tree.

import logging
from typing import List, Optional
from typing import TYPE_CHECKING, List, Optional

if TYPE_CHECKING:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeehaaaw!

from sentence_transformers import SentenceTransformer

from llama_stack.apis.inference import (
EmbeddingsResponse,
Expand Down Expand Up @@ -40,7 +43,7 @@ async def embeddings(
)
return EmbeddingsResponse(embeddings=embeddings)

def _load_sentence_transformer_model(self, model: str) -> "SentenceTransformer":
def _load_sentence_transformer_model(self, model: str) -> SentenceTransformer:
global EMBEDDING_MODELS

loaded_model = EMBEDDING_MODELS.get(model)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ ignore = [
"E721",
"E741",
"F405",
"F821",
"F841",
"C408", # ignored because we like the dict keyword argument syntax
"E302",
Expand Down