fxn 0.0.51__py3-none-any.whl → 0.0.52__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fxn/beta/__init__.py +2 -1
- fxn/beta/metadata.py +19 -0
- fxn/compile.py +20 -6
- fxn/version.py +1 -1
- {fxn-0.0.51.dist-info → fxn-0.0.52.dist-info}/METADATA +1 -1
- {fxn-0.0.51.dist-info → fxn-0.0.52.dist-info}/RECORD +10 -10
- {fxn-0.0.51.dist-info → fxn-0.0.52.dist-info}/WHEEL +1 -1
- {fxn-0.0.51.dist-info → fxn-0.0.52.dist-info}/entry_points.txt +0 -0
- {fxn-0.0.51.dist-info → fxn-0.0.52.dist-info}/licenses/LICENSE +0 -0
- {fxn-0.0.51.dist-info → fxn-0.0.52.dist-info}/top_level.txt +0 -0
fxn/beta/__init__.py
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
from .metadata import (
|
7
7
|
CoreMLInferenceMetadata, LiteRTInferenceMetadata, LlamaCppInferenceMetadata,
|
8
|
-
ONNXInferenceMetadata, ONNXRuntimeInferenceSessionMetadata
|
8
|
+
ONNXInferenceMetadata, ONNXRuntimeInferenceSessionMetadata, OpenVINOInferenceMetadata,
|
9
|
+
QnnInferenceMetadata
|
9
10
|
)
|
10
11
|
from .remote import RemoteAcceleration
|
fxn/beta/metadata.py
CHANGED
@@ -61,6 +61,25 @@ class LiteRTInferenceMetadata (BaseModel):
|
|
61
61
|
model_args: list[object] = Field(description="Positional inputs to the model.", exclude=True)
|
62
62
|
model_config = ConfigDict(arbitrary_types_allowed=True, frozen=True)
|
63
63
|
|
64
|
+
class OpenVINOInferenceMetadata (BaseModel):
|
65
|
+
"""
|
66
|
+
Metadata required to lower PyTorch model for interence with Intel OpenVINO.
|
67
|
+
"""
|
68
|
+
kind: Literal["meta.inference.openvino"] = "meta.inference.openvino"
|
69
|
+
model: Annotated[object, BeforeValidator(_validate_torch_module)] = Field(description="PyTorch module to apply metadata to.", exclude=True)
|
70
|
+
model_args: list[object] = Field(description="Positional inputs to the model.", exclude=True)
|
71
|
+
model_config = ConfigDict(arbitrary_types_allowed=True, frozen=True)
|
72
|
+
|
73
|
+
class QnnInferenceMetadata (BaseModel):
|
74
|
+
"""
|
75
|
+
Metadata required to lower a PyTorch model for inference on Qualcomm accelerators with QNN SDK.
|
76
|
+
"""
|
77
|
+
kind: Literal["meta.inference.qnn"] = "meta.inference.qnn"
|
78
|
+
model: Annotated[object, BeforeValidator(_validate_torch_module)] = Field(description="PyTorch module to apply metadata to.", exclude=True)
|
79
|
+
model_args: list[object] = Field(description="Positional inputs to the model.", exclude=True)
|
80
|
+
backend: Literal["cpu", "gpu"] = Field(default="cpu", description="QNN backend to execute the model.", exclude=True) # CHECK # Add `htp`
|
81
|
+
model_config = ConfigDict(arbitrary_types_allowed=True, frozen=True)
|
82
|
+
|
64
83
|
class LlamaCppInferenceMetadata (BaseModel): # INCOMPLETE
|
65
84
|
"""
|
66
85
|
Metadata required to lower a GGUF model for LLM inference.
|
fxn/compile.py
CHANGED
@@ -9,25 +9,39 @@ from inspect import isasyncgenfunction, iscoroutinefunction
|
|
9
9
|
from pathlib import Path
|
10
10
|
from pydantic import BaseModel, ConfigDict, Field
|
11
11
|
from types import ModuleType
|
12
|
-
from typing import Literal
|
12
|
+
from typing import Any, Callable, Literal, ParamSpec, TypeVar, cast
|
13
13
|
|
14
14
|
from .beta import (
|
15
15
|
CoreMLInferenceMetadata, LiteRTInferenceMetadata, LlamaCppInferenceMetadata,
|
16
|
-
ONNXInferenceMetadata, ONNXRuntimeInferenceSessionMetadata
|
16
|
+
ONNXInferenceMetadata, ONNXRuntimeInferenceSessionMetadata, OpenVINOInferenceMetadata,
|
17
|
+
QnnInferenceMetadata
|
17
18
|
)
|
18
19
|
from .sandbox import Sandbox
|
19
20
|
from .types import AccessMode
|
20
21
|
|
21
|
-
CompileTarget = Literal[
|
22
|
+
CompileTarget = Literal[
|
23
|
+
"android",
|
24
|
+
"ios",
|
25
|
+
"linux",
|
26
|
+
"macos",
|
27
|
+
"visionos",
|
28
|
+
"wasm",
|
29
|
+
"windows"
|
30
|
+
]
|
22
31
|
|
23
32
|
CompileMetadata = (
|
24
33
|
CoreMLInferenceMetadata |
|
25
34
|
LiteRTInferenceMetadata |
|
26
35
|
LlamaCppInferenceMetadata |
|
27
36
|
ONNXInferenceMetadata |
|
28
|
-
ONNXRuntimeInferenceSessionMetadata
|
37
|
+
ONNXRuntimeInferenceSessionMetadata |
|
38
|
+
OpenVINOInferenceMetadata |
|
39
|
+
QnnInferenceMetadata
|
29
40
|
)
|
30
41
|
|
42
|
+
P = ParamSpec("P")
|
43
|
+
R = TypeVar("R")
|
44
|
+
|
31
45
|
class PredictorSpec (BaseModel):
|
32
46
|
"""
|
33
47
|
Descriptor of a predictor to be compiled.
|
@@ -56,7 +70,7 @@ def compile (
|
|
56
70
|
media: Path=None,
|
57
71
|
license: str=None,
|
58
72
|
**kwargs
|
59
|
-
):
|
73
|
+
) -> Callable[[Callable[P, R]], Callable[P, R]]:
|
60
74
|
"""
|
61
75
|
Create a predictor by compiling a stateless function.
|
62
76
|
|
@@ -97,5 +111,5 @@ def compile (
|
|
97
111
|
def wrapper (*args, **kwargs):
|
98
112
|
return func(*args, **kwargs)
|
99
113
|
wrapper.__predictor_spec = spec
|
100
|
-
return wrapper
|
114
|
+
return cast(Callable[P, R], wrapper)
|
101
115
|
return decorator
|
fxn/version.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
fxn/__init__.py,sha256=gnJK7iOmMVWFhluW9bOvTNxJbpT-GwzDJTMmjA_XxOE,284
|
2
2
|
fxn/client.py,sha256=Deje8eiS1VOHX85tQnV34viv2CPVx2ljwHSbyVB5Z1o,3790
|
3
|
-
fxn/compile.py,sha256=
|
3
|
+
fxn/compile.py,sha256=flfWCztkPl4mj8HHNJ5hagiw6GPXwEgCzML5DF3jE3I,4371
|
4
4
|
fxn/function.py,sha256=XeEuALkbVhkvwEBUfP0A2fu3tdimwHemoR17oomhzc8,1407
|
5
5
|
fxn/logging.py,sha256=MsTSf0GZxrHNDwVAXDOh8_zRUg9hkeZ8DfhFUJs7D8A,7250
|
6
6
|
fxn/sandbox.py,sha256=50yY2GDdkAFl-6pXTleaD1LXYM6-pJ3C1epKsr0xdrM,7313
|
7
|
-
fxn/version.py,sha256=
|
8
|
-
fxn/beta/__init__.py,sha256=
|
7
|
+
fxn/version.py,sha256=EVnLH1XFtA_XTvNVV5KvP6eyRyNaYwO1HmlkKenTsNw,95
|
8
|
+
fxn/beta/__init__.py,sha256=P8x10VoMJw58mhz-ZfnHECPeMq7AELBz6mQN4a-8WAc,334
|
9
9
|
fxn/beta/client.py,sha256=0lfwQPcB9ToIJC7AcCXO6DlJKkmId8EChhd9bk29GGE,2611
|
10
|
-
fxn/beta/metadata.py,sha256=
|
10
|
+
fxn/beta/metadata.py,sha256=z3ykTsbMsmPEtK8HNpZcFCeJfszZR7f7lUQqppnz7_w,4919
|
11
11
|
fxn/beta/prediction.py,sha256=9DTBahNF6m0TicLab2o9e8IKpiSV6K7cUSTYaFju0ZU,356
|
12
12
|
fxn/beta/remote.py,sha256=psPNcGFQKMGHAJG4NRDIQ2trStvTj2NOZeQqVI-e29Q,7529
|
13
13
|
fxn/c/__init__.py,sha256=NMIduqO_MYtI9jVCu6ZxvbBtYQXoQyNEWblNy3m2UPY,313
|
@@ -41,9 +41,9 @@ fxn/types/dtype.py,sha256=71Tuu4IydmELcBcSBbmWswhCE-7WqBSQ4VkETsFRzjA,617
|
|
41
41
|
fxn/types/prediction.py,sha256=BdLTxnKiSFbz5warX8g_Z4DedNxXK3gaNjSKR2FP8tA,2051
|
42
42
|
fxn/types/predictor.py,sha256=KRGZEuDt7WPMCyRcZvQq4y2FMocfVrLEUNJCJgfDY9Y,4000
|
43
43
|
fxn/types/user.py,sha256=Z44TwEocyxSrfKyzcNfmAXUrpX_Ry8fJ7MffSxRn4oU,1071
|
44
|
-
fxn-0.0.
|
45
|
-
fxn-0.0.
|
46
|
-
fxn-0.0.
|
47
|
-
fxn-0.0.
|
48
|
-
fxn-0.0.
|
49
|
-
fxn-0.0.
|
44
|
+
fxn-0.0.52.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
45
|
+
fxn-0.0.52.dist-info/METADATA,sha256=du31QRBmBTzGvzhr3Nu23Om-JwMg7GKQLh6nJw3LOfA,16136
|
46
|
+
fxn-0.0.52.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
47
|
+
fxn-0.0.52.dist-info/entry_points.txt,sha256=O_AwD5dYaeB-YT1F9hPAPuDYCkw_W0tdNGYbc5RVR2k,45
|
48
|
+
fxn-0.0.52.dist-info/top_level.txt,sha256=1ULIEGrnMlhId8nYAkjmRn9g3KEFuHKboq193SEKQkA,4
|
49
|
+
fxn-0.0.52.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|