mirror of
https://github.com/bentoml/OpenLLM.git
synced 2026-04-24 00:47:44 -04:00
fix: persistent styling between ruff and yapf (#279)
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
from __future__ import annotations
|
||||
import os
|
||||
|
||||
from hypothesis import HealthCheck, settings
|
||||
from hypothesis import HealthCheck
|
||||
from hypothesis import settings
|
||||
|
||||
settings.register_profile('CI', settings(suppress_health_check=[HealthCheck.too_slow]), deadline=None)
|
||||
|
||||
if 'CI' in os.environ: settings.load_profile('CI')
|
||||
|
||||
@@ -5,7 +5,9 @@ import typing as t
|
||||
from hypothesis import strategies as st
|
||||
|
||||
import openllm
|
||||
|
||||
from openllm_core._configuration import ModelSettings
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
env_strats = st.sampled_from([openllm.utils.EnvVarMixin(model_name) for model_name in openllm.CONFIG_MAPPING.keys()])
|
||||
|
||||
@@ -3,17 +3,25 @@ import contextlib
|
||||
import os
|
||||
import sys
|
||||
import typing as t
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import attr
|
||||
import pytest
|
||||
import transformers
|
||||
from hypothesis import assume, given, strategies as st
|
||||
|
||||
from hypothesis import assume
|
||||
from hypothesis import given
|
||||
from hypothesis import strategies as st
|
||||
|
||||
import openllm
|
||||
from openllm_core._configuration import GenerationConfig, ModelSettings, field_env_key
|
||||
|
||||
from ._strategies._configuration import make_llm_config, model_settings
|
||||
from openllm_core._configuration import GenerationConfig
|
||||
from openllm_core._configuration import ModelSettings
|
||||
from openllm_core._configuration import field_env_key
|
||||
|
||||
from ._strategies._configuration import make_llm_config
|
||||
from ._strategies._configuration import model_settings
|
||||
|
||||
# XXX: @aarnphm fixes TypedDict behaviour in 3.11
|
||||
@pytest.mark.skipif(sys.version_info[:2] == (3, 11), reason='TypedDict in 3.11 behaves differently, so we need to fix this')
|
||||
|
||||
@@ -6,7 +6,9 @@ import typing as t
|
||||
import pytest
|
||||
|
||||
import openllm
|
||||
if t.TYPE_CHECKING: from openllm_core._typing_compat import LiteralRuntime
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from openllm_core._typing_compat import LiteralRuntime
|
||||
|
||||
_FRAMEWORK_MAPPING = {'flan_t5': 'google/flan-t5-small', 'opt': 'facebook/opt-125m', 'baichuan': 'baichuan-inc/Baichuan-7B',}
|
||||
_PROMPT_MAPPING = {'qa': 'Answer the following yes/no question by reasoning step-by-step. Can you write a whole Haiku in a single tweet?',}
|
||||
|
||||
@@ -6,7 +6,9 @@ import logging
|
||||
import sys
|
||||
import time
|
||||
import typing as t
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from abc import ABC
|
||||
from abc import abstractmethod
|
||||
|
||||
import attr
|
||||
import docker
|
||||
@@ -14,18 +16,25 @@ import docker.errors
|
||||
import docker.types
|
||||
import orjson
|
||||
import pytest
|
||||
|
||||
from syrupy.extensions.json import JSONSnapshotExtension
|
||||
|
||||
import openllm
|
||||
|
||||
from openllm._llm import normalise_model_name
|
||||
from openllm_core._typing_compat import DictStrAny, ListAny
|
||||
from openllm_core._typing_compat import DictStrAny
|
||||
from openllm_core._typing_compat import ListAny
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import subprocess
|
||||
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
from syrupy.types import PropertyFilter, PropertyMatcher, SerializableData, SerializedData
|
||||
from syrupy.types import PropertyFilter
|
||||
from syrupy.types import PropertyMatcher
|
||||
from syrupy.types import SerializableData
|
||||
from syrupy.types import SerializedData
|
||||
|
||||
from openllm._configuration import GenerationConfig
|
||||
from openllm.client import BaseAsyncClient
|
||||
|
||||
@@ -4,10 +4,14 @@ import typing as t
|
||||
import pytest
|
||||
|
||||
import openllm
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import contextlib
|
||||
|
||||
from .conftest import HandleProtocol, ResponseComparator, _Handle
|
||||
from .conftest import HandleProtocol
|
||||
from .conftest import ResponseComparator
|
||||
from .conftest import _Handle
|
||||
|
||||
model = 'flan_t5'
|
||||
model_id = 'google/flan-t5-small'
|
||||
|
||||
|
||||
@@ -4,10 +4,14 @@ import typing as t
|
||||
import pytest
|
||||
|
||||
import openllm
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import contextlib
|
||||
|
||||
from .conftest import HandleProtocol, ResponseComparator, _Handle
|
||||
from .conftest import HandleProtocol
|
||||
from .conftest import ResponseComparator
|
||||
from .conftest import _Handle
|
||||
|
||||
model = 'opt'
|
||||
model_id = 'facebook/opt-125m'
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ import os
|
||||
import typing as t
|
||||
|
||||
import pytest
|
||||
if t.TYPE_CHECKING: import openllm
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
import openllm
|
||||
|
||||
@pytest.mark.skipif(os.getenv('GITHUB_ACTIONS') is not None, reason='Model is too large for CI')
|
||||
def test_flan_t5_implementation(prompt: str, llm: openllm.LLM[t.Any, t.Any]):
|
||||
|
||||
@@ -6,8 +6,11 @@ import typing as t
|
||||
import pytest
|
||||
|
||||
import openllm
|
||||
|
||||
from bentoml._internal.configuration.containers import BentoMLContainer
|
||||
if t.TYPE_CHECKING: from pathlib import Path
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
HF_INTERNAL_T5_TESTING = 'hf-internal-testing/tiny-random-t5'
|
||||
|
||||
|
||||
@@ -5,9 +5,14 @@ import typing as t
|
||||
import pytest
|
||||
|
||||
import bentoml
|
||||
|
||||
from openllm_core import _strategies as strategy
|
||||
from openllm_core._strategies import CascadingResourceStrategy, NvidiaGpuResource, get_resource
|
||||
if t.TYPE_CHECKING: from _pytest.monkeypatch import MonkeyPatch
|
||||
from openllm_core._strategies import CascadingResourceStrategy
|
||||
from openllm_core._strategies import NvidiaGpuResource
|
||||
from openllm_core._strategies import get_resource
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
|
||||
def test_nvidia_gpu_resource_from_env(monkeypatch: pytest.MonkeyPatch):
|
||||
with monkeypatch.context() as mcls:
|
||||
|
||||
Reference in New Issue
Block a user