fxn 0.0.46__py3-none-any.whl → 0.0.48__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/metadata.py +14 -5
- fxn/lib/linux/arm64/libFunction.so +0 -0
- fxn/lib/linux/x86_64/libFunction.so +0 -0
- fxn/lib/macos/arm64/Function.dylib +0 -0
- fxn/lib/macos/x86_64/Function.dylib +0 -0
- fxn/lib/windows/arm64/Function.dll +0 -0
- fxn/lib/windows/x86_64/Function.dll +0 -0
- fxn/sandbox.py +14 -4
- fxn/version.py +1 -1
- {fxn-0.0.46.dist-info → fxn-0.0.48.dist-info}/METADATA +1 -1
- {fxn-0.0.46.dist-info → fxn-0.0.48.dist-info}/RECORD +15 -15
- {fxn-0.0.46.dist-info → fxn-0.0.48.dist-info}/WHEEL +1 -1
- {fxn-0.0.46.dist-info → fxn-0.0.48.dist-info}/entry_points.txt +0 -0
- {fxn-0.0.46.dist-info → fxn-0.0.48.dist-info}/licenses/LICENSE +0 -0
- {fxn-0.0.46.dist-info → fxn-0.0.48.dist-info}/top_level.txt +0 -0
fxn/beta/metadata.py
CHANGED
@@ -27,7 +27,7 @@ def _validate_ort_inference_session (session: "onnxruntime.InferenceSession") ->
|
|
27
27
|
|
28
28
|
class CoreMLInferenceMetadata (BaseModel):
|
29
29
|
"""
|
30
|
-
Metadata required to lower PyTorch
|
30
|
+
Metadata required to lower a PyTorch model for inference on iOS, macOS, and visionOS with CoreML.
|
31
31
|
"""
|
32
32
|
kind: Literal["meta.inference.coreml"] = "meta.inference.coreml"
|
33
33
|
model: Annotated[object, BeforeValidator(_validate_torch_module)] = Field(description="PyTorch module to apply metadata to.")
|
@@ -36,7 +36,7 @@ class CoreMLInferenceMetadata (BaseModel):
|
|
36
36
|
|
37
37
|
class ONNXInferenceMetadata (BaseModel):
|
38
38
|
"""
|
39
|
-
Metadata required to lower PyTorch
|
39
|
+
Metadata required to lower a PyTorch model for inference.
|
40
40
|
"""
|
41
41
|
kind: Literal["meta.inference.onnx"] = "meta.inference.onnx"
|
42
42
|
model: Annotated[object, BeforeValidator(_validate_torch_module)] = Field(description="PyTorch module to apply metadata to.")
|
@@ -45,16 +45,25 @@ class ONNXInferenceMetadata (BaseModel):
|
|
45
45
|
|
46
46
|
class ONNXRuntimeInferenceSessionMetadata (BaseModel):
|
47
47
|
"""
|
48
|
-
Metadata required to lower ONNXRuntime
|
48
|
+
Metadata required to lower an ONNXRuntime `InferenceSession` for inference.
|
49
49
|
"""
|
50
50
|
kind: Literal["meta.inference.onnxruntime"] = "meta.inference.onnxruntime"
|
51
51
|
session: Annotated[object, BeforeValidator(_validate_ort_inference_session)] = Field(description="ONNXRuntime inference session to apply metadata to.")
|
52
52
|
model_path: Path = Field(description="ONNX model path. The model must exist at this path in the compiler sandbox.")
|
53
53
|
model_config = ConfigDict(arbitrary_types_allowed=True, frozen=True)
|
54
54
|
|
55
|
-
class
|
55
|
+
class LiteRTInferenceMetadata (BaseModel):
|
56
56
|
"""
|
57
|
-
Metadata required to lower
|
57
|
+
Metadata required to lower PyTorch model for inference with LiteRT (fka TensorFlow Lite).
|
58
|
+
"""
|
59
|
+
kind: Literal["meta.inference.litert"] = "meta.inference.litert"
|
60
|
+
model: Annotated[object, BeforeValidator(_validate_torch_module)] = Field(description="PyTorch module to apply metadata to.")
|
61
|
+
model_args: list[object] = Field(description="Positional inputs to the model.")
|
62
|
+
model_config = ConfigDict(arbitrary_types_allowed=True, frozen=True)
|
63
|
+
|
64
|
+
class LlamaCppInferenceMetadata (BaseModel): # INCOMPLETE
|
65
|
+
"""
|
66
|
+
Metadata required to lower a GGUF model for LLM inference.
|
58
67
|
"""
|
59
68
|
kind: Literal["meta.inference.gguf"] = "meta.inference.gguf"
|
60
69
|
model_path: Path = Field(description="GGUF model path. The model must exist at this path in the compiler sandbox.")
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
fxn/sandbox.py
CHANGED
@@ -43,7 +43,8 @@ class UploadDirectoryCommand (UploadableCommand):
|
|
43
43
|
|
44
44
|
def get_files (self) -> list[Path]:
|
45
45
|
from_path = Path(self.from_path)
|
46
|
-
|
46
|
+
if not from_path.is_absolute():
|
47
|
+
raise ValueError("Cannot upload directory because directory path must be absolute")
|
47
48
|
return [file for file in from_path.rglob("*") if file.is_file()]
|
48
49
|
|
49
50
|
class EntrypointCommand (UploadableCommand):
|
@@ -106,7 +107,11 @@ class Sandbox (BaseModel):
|
|
106
107
|
from_path (str | Path): File path on the local file system.
|
107
108
|
to_path (str | Path): Remote path to upload file to.
|
108
109
|
"""
|
109
|
-
|
110
|
+
from_path = from_path if isinstance(from_path, Path) else Path(from_path)
|
111
|
+
command = UploadFileCommand(
|
112
|
+
from_path=str(from_path.resolve()),
|
113
|
+
to_path=str(to_path)
|
114
|
+
)
|
110
115
|
return Sandbox(commands=self.commands + [command])
|
111
116
|
|
112
117
|
def upload_directory (
|
@@ -121,7 +126,11 @@ class Sandbox (BaseModel):
|
|
121
126
|
from_path (str | Path): Directory path on the local file system.
|
122
127
|
to_path (str | Path): Remote path to upload directory to.
|
123
128
|
"""
|
124
|
-
|
129
|
+
from_path = from_path if isinstance(from_path, Path) else Path(from_path)
|
130
|
+
command = UploadDirectoryCommand(
|
131
|
+
from_path=str(from_path.resolve()),
|
132
|
+
to_path=str(to_path)
|
133
|
+
)
|
125
134
|
return Sandbox(commands=self.commands + [command])
|
126
135
|
|
127
136
|
def pip_install (self, *packages: str) -> Sandbox:
|
@@ -180,7 +189,8 @@ class Sandbox (BaseModel):
|
|
180
189
|
return self
|
181
190
|
|
182
191
|
def __upload_file (self, path: Path, fxn: Function) -> str:
|
183
|
-
|
192
|
+
if not path.is_file():
|
193
|
+
raise ValueError(f"Cannot upload file at path {path} because it is not a file")
|
184
194
|
hash = self.__compute_hash(path)
|
185
195
|
try:
|
186
196
|
fxn.client.request(method="HEAD", path=f"/resources/{hash}")
|
fxn/version.py
CHANGED
@@ -3,11 +3,11 @@ fxn/client.py,sha256=Deje8eiS1VOHX85tQnV34viv2CPVx2ljwHSbyVB5Z1o,3790
|
|
3
3
|
fxn/compile.py,sha256=A9dxw6yv1eCd-zEYnqiyjDUZou8TkbEIA_yB9Tn4pXo,3894
|
4
4
|
fxn/function.py,sha256=XeEuALkbVhkvwEBUfP0A2fu3tdimwHemoR17oomhzc8,1407
|
5
5
|
fxn/logging.py,sha256=MsTSf0GZxrHNDwVAXDOh8_zRUg9hkeZ8DfhFUJs7D8A,7250
|
6
|
-
fxn/sandbox.py,sha256=
|
7
|
-
fxn/version.py,sha256=
|
6
|
+
fxn/sandbox.py,sha256=50yY2GDdkAFl-6pXTleaD1LXYM6-pJ3C1epKsr0xdrM,7313
|
7
|
+
fxn/version.py,sha256=_EmrbT-E7sc_SHi2REm8tGA4Pf2B1qbvfQFTZznSQKQ,95
|
8
8
|
fxn/beta/__init__.py,sha256=aQAV-apg11Z7Pn86eIegJ2id7wkRUaYeEaeZthaCmYk,252
|
9
9
|
fxn/beta/client.py,sha256=0lfwQPcB9ToIJC7AcCXO6DlJKkmId8EChhd9bk29GGE,2611
|
10
|
-
fxn/beta/metadata.py,sha256=
|
10
|
+
fxn/beta/metadata.py,sha256=gIG9QSgcDG6bpMefFc2KvnLfGkiRtpA7w-zM4TkzFZA,3587
|
11
11
|
fxn/beta/prediction.py,sha256=9DTBahNF6m0TicLab2o9e8IKpiSV6K7cUSTYaFju0ZU,356
|
12
12
|
fxn/beta/remote.py,sha256=HC8OIslZYyxw3XafVCCrP_wrPa00y5uekkKd_tkzyV0,7551
|
13
13
|
fxn/c/__init__.py,sha256=NMIduqO_MYtI9jVCu6ZxvbBtYQXoQyNEWblNy3m2UPY,313
|
@@ -26,12 +26,12 @@ fxn/cli/predictions.py,sha256=ma7wbsKD5CFCRTU_TtJ8N0nN1fgFX2BZPGG8qm8HlNI,3182
|
|
26
26
|
fxn/cli/predictors.py,sha256=bVQAuBue_Jxb79X85RTCzOerWRRT2Ny1oF5DNYAsx4M,1545
|
27
27
|
fxn/cli/sources.py,sha256=HQ_PBLXY2CZ5tGuuqQeJQTpM9S9rKtBzyNVTK-ywG84,1781
|
28
28
|
fxn/lib/__init__.py,sha256=-w1ikmmki5NMpzJjERW-O4SwOfBNkimej_0jL8ujYRk,71
|
29
|
-
fxn/lib/linux/arm64/libFunction.so,sha256=
|
30
|
-
fxn/lib/linux/x86_64/libFunction.so,sha256=
|
31
|
-
fxn/lib/macos/arm64/Function.dylib,sha256=
|
32
|
-
fxn/lib/macos/x86_64/Function.dylib,sha256=
|
33
|
-
fxn/lib/windows/arm64/Function.dll,sha256=
|
34
|
-
fxn/lib/windows/x86_64/Function.dll,sha256=
|
29
|
+
fxn/lib/linux/arm64/libFunction.so,sha256=T9HE_dkC4yKXsyAc_sa7iWTXRDcwGOjZ1MAi1j9-ZCw,211736
|
30
|
+
fxn/lib/linux/x86_64/libFunction.so,sha256=66r5ZzUMlSjIfqfIwbhwCJk1AQF2iBL5OZzeT2ibZDQ,236336
|
31
|
+
fxn/lib/macos/arm64/Function.dylib,sha256=NO5ZzDvMFsDkgYNL8louztyaRxuM9Hl_BosQYFi6rKg,263856
|
32
|
+
fxn/lib/macos/x86_64/Function.dylib,sha256=SO55PHLhhl8sh_Gr3IKgTHPV1-pnhLb30qbqHKF0_1M,255600
|
33
|
+
fxn/lib/windows/arm64/Function.dll,sha256=ol6LyOVtF7tq-hnPLS9RRXAkobYMSC9T_JF1kx3l2IY,411136
|
34
|
+
fxn/lib/windows/x86_64/Function.dll,sha256=P43RXFNAdjTrDEnynGRy8CjCgY1KWzB_1Cz5W6394bg,447488
|
35
35
|
fxn/services/__init__.py,sha256=Bif8IttwJ089mSRsd3MFdob7z2eF-MKigKu4ZQFZBCQ,190
|
36
36
|
fxn/services/prediction.py,sha256=QCop-f7ojkGR7DI5tLJe3FPnr0BvPJ_vWhCk4kg8Fqg,10373
|
37
37
|
fxn/services/predictor.py,sha256=Wl_7YKiD5mTpC5x2Zaq4BpatRjwRUX8Th9GIrwd38MA,791
|
@@ -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.48.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
45
|
+
fxn-0.0.48.dist-info/METADATA,sha256=KNf2y-fS4sLQW0IbwE6r-6NoG3hO6EUOzGMsTxmgquI,16136
|
46
|
+
fxn-0.0.48.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
|
47
|
+
fxn-0.0.48.dist-info/entry_points.txt,sha256=O_AwD5dYaeB-YT1F9hPAPuDYCkw_W0tdNGYbc5RVR2k,45
|
48
|
+
fxn-0.0.48.dist-info/top_level.txt,sha256=1ULIEGrnMlhId8nYAkjmRn9g3KEFuHKboq193SEKQkA,4
|
49
|
+
fxn-0.0.48.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|