ML Inference 🥶
Project description
🏖️ Nbox
nbox
is NimbleBox.ai's official SDK.
The entire purpose of this package is to make using ML 🥶.
pip install nbox
🔥 Usage
nbox
provides first class support API for all NimbleBox.ai infrastructure (NBX-Build, Jobs, Deploy) and services (NBX-Workspaces) components. Write jobs using nbox.Operators
:
from nbox import Operator
from nbox.nbxlib.ops import Magic
# define a class object
weekly_trainer: Operator = Magic()
# call your operators
weekly_trainer(
pass_values = "directly",
)
# confident? deploy it to your cloud
weekly_trainer.deploy(
job_id_or_name = "magic_jobs",
schedule = Schedule(4, 30, ['fri']) # schedule like humans
)
Deploy your machine learning or statistical models:
from nbox import Model
from transformers import AutoModelForSequenceClassification, AutoTokenizer
# define your pre and post processing functions
def pre(x: Dict):
return AutoTokenizer(**x)
# load your classifier with functions
model = AutoModelForSequenceClassification.from_pretrained("distill-bert")
classifier = Model(model, pre = pre)
# call your model
classifier(f"Is this a good picture?")
# get full control on exporting it
spec = classifier.torch_to_onnx(
TorchToOnnx(...)
)
# confident? deploy it your cloud
url, key = classifier.deploy(
spec, deployment_id_or_name = "classification"
)
# use it anywhere
pred = requests.post(
url,
json = {
"text": f"Is this a good picture?"
},
header = {"Authorization": f"Bearer {key}"}
).json()
🧩 License
The code in thist repo is licensed as Apache License 2.0. Please check for individual repositories for licenses.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nbox-0.9.14rc19.tar.gz
(112.5 kB
view hashes)
Built Distribution
nbox-0.9.14rc19-py3-none-any.whl
(123.0 kB
view hashes)
Close
Hashes for nbox-0.9.14rc19-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ac1ec7cd9d2fb1f526321efbe9cb9d7daf9016a892035027b9bcae59aecd14b |
|
MD5 | eb797fa0a348d30e8bf137a0d7ddfba8 |
|
BLAKE2b-256 | d254602d7bbf962cbe950188bc61a9344abf5b311e370e2903427e8012f93bd6 |