offlinedemo 0.1.0__tar.gz
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.
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: offlinedemo
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Easy demonstration of models by offlineisbetter.
|
|
5
|
+
Author: offlineisbetter
|
|
6
|
+
Author-email: offlineisbetter <dev@offlineisbetter.com>
|
|
7
|
+
Requires-Python: >=3.13
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# _offlineisbetter_
|
|
11
|
+
|
|
12
|
+
Inference for _offlineisbetter_ models.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "offlinedemo"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Easy demonstration of models by offlineisbetter."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.13"
|
|
7
|
+
dependencies = []
|
|
8
|
+
|
|
9
|
+
[[project.authors]]
|
|
10
|
+
name = "offlineisbetter"
|
|
11
|
+
email = "dev@offlineisbetter.com"
|
|
12
|
+
|
|
13
|
+
[project.scripts]
|
|
14
|
+
offlinedemo = "offlinedemo:main"
|
|
15
|
+
|
|
16
|
+
[build-system]
|
|
17
|
+
requires = ["uv_build>=0.12.19,<0.13.0"]
|
|
18
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "offlinedemo"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Easy demonstration of models by offlineisbetter."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "offlineisbetter", email = "dev@offlineisbetter.com" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.13"
|
|
10
|
+
dependencies = []
|
|
11
|
+
|
|
12
|
+
[project.scripts]
|
|
13
|
+
offlinedemo = "offlinedemo:main"
|
|
14
|
+
|
|
15
|
+
[build-system]
|
|
16
|
+
requires = ["uv_build>=0.12.19,<0.13.0"]
|
|
17
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# offlineisbetter
|
|
2
|
+
# Copyright (c) 2026- offlineisbetter
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
import sys
|
|
6
|
+
import time
|
|
7
|
+
|
|
8
|
+
from transformers import AutoTokenizer
|
|
9
|
+
import onnxruntime as ort
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
# Get checkpoint name
|
|
13
|
+
if len(sys.argv) < 2:
|
|
14
|
+
print("offlinedemo [checkpoint]")
|
|
15
|
+
return
|
|
16
|
+
checkpoint = Path(sys.argv[1])
|
|
17
|
+
|
|
18
|
+
# Load checkpoint
|
|
19
|
+
session = ort.InferenceSession(
|
|
20
|
+
checkpoint / "model.onnx",
|
|
21
|
+
providers=["CPUExecutionProvider"],
|
|
22
|
+
)
|
|
23
|
+
print("Model loaded!")
|
|
24
|
+
print()
|
|
25
|
+
|
|
26
|
+
# Load tokenizer
|
|
27
|
+
tokenizer = AutoTokenizer.from_pretrained(
|
|
28
|
+
checkpoint,
|
|
29
|
+
local_files_only = True,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# Ask user for input
|
|
33
|
+
user_input = input("offlineisbetter >> ")
|
|
34
|
+
|
|
35
|
+
# Tokenize and run inference
|
|
36
|
+
start = time.perf_counter()
|
|
37
|
+
tokens = tokenizer(user_input)
|
|
38
|
+
result = session.run(None, tokens)[0]
|
|
39
|
+
duration = time.perf_counter() - start
|
|
40
|
+
|
|
41
|
+
# Report to user
|
|
42
|
+
print(f"LOGITS: {result}")
|
|
43
|
+
print(f"LATENCY: {duration*1000:.3f} ms")
|