Skip to content

Commit 9241013

Browse files
committed
remove further type ignore
1 parent 8335128 commit 9241013

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

stubs/outlines/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import models
2+
3+
__all__: list[str] = []

stubs/outlines/models/__init__.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import base, llamacpp, mlxlm, sglang, transformers, vllm_offline
2+
3+
__all__: list[str] = []

stubs/outlines/models/llamacpp.pyi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from typing import TYPE_CHECKING
2+
3+
from outlines.models.base import Model
4+
5+
if TYPE_CHECKING:
6+
from llama_cpp import Llama
7+
8+
class LlamaCpp(Model): ...
9+
10+
def from_llamacpp(model: Llama) -> LlamaCpp: ...

stubs/outlines/models/sglang.pyi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from typing import TYPE_CHECKING, Any, Union
2+
3+
from outlines.models.base import AsyncModel, Model
4+
5+
if TYPE_CHECKING:
6+
from openai import AsyncOpenAI, OpenAI
7+
8+
class SGLang(Model): ...
9+
class AsyncSGLang(AsyncModel): ...
10+
11+
def from_sglang(client: OpenAI | AsyncOpenAI, *args: Any, **kwargs: Any) -> SGLang | AsyncSGLang: ...

tests/models/test_outlines.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,7 @@ def llamacpp_model() -> OutlinesModel:
163163

164164
@pytest.fixture
165165
def mlxlm_model() -> OutlinesModel: # pragma: no cover
166-
outlines_model = outlines.models.mlxlm.from_mlxlm( # type: ignore[reportUnknownMemberType]
167-
*mlx_lm.load('mlx-community/SmolLM-135M-Instruct-4bit') # type: ignore
168-
)
166+
outlines_model = outlines.models.mlxlm.from_mlxlm(*mlx_lm.load('mlx-community/SmolLM-135M-Instruct-4bit'))
169167
return OutlinesModel(outlines_model, provider=OutlinesProvider())
170168

171169

@@ -214,7 +212,7 @@ def binary_image() -> BinaryImage:
214212
),
215213
pytest.param(
216214
'from_mlxlm',
217-
lambda: mlx_lm.load('mlx-community/SmolLM-135M-Instruct-4bit'), # type: ignore
215+
lambda: mlx_lm.load('mlx-community/SmolLM-135M-Instruct-4bit'),
218216
marks=skip_if_mlxlm_imports_unsuccessful,
219217
),
220218
pytest.param(
@@ -273,7 +271,7 @@ def test_init(model_loading_function_name: str, args: Callable[[], tuple[Any]])
273271
),
274272
pytest.param(
275273
'from_mlxlm',
276-
lambda: mlx_lm.load('mlx-community/SmolLM-135M-Instruct-4bit'), # type: ignore
274+
lambda: mlx_lm.load('mlx-community/SmolLM-135M-Instruct-4bit'),
277275
marks=skip_if_mlxlm_imports_unsuccessful,
278276
),
279277
pytest.param(

0 commit comments

Comments
 (0)