Skip to main content

ML Inference 🥶

Project description

🏖️ Nbox

master code is working, pypi nbox is breaking.

A library that makes using a host of models provided by the opensource community a lot more easier.

The entire purpose of this package is to make using models 🥶.

pip install nbox

Current LoC

SLOC	Directory	SLOC-by-Language (Sorted)
996     top_dir         python=996
88      framework       python=88

Totals grouped by language (dominant language first):
python:        1084 (100.00%)

🔥 Usage

import nbox

# As all these models come from the popular frameworks you use such as 
# torchvision, efficient_pytorch or hf.transformers
model = nbox.load("torchvision/mobilenetv2", pretrained = True)

# nbox makes inference the priority so you can use it
# pass it a list for batch inference 
out_single = model('cat.jpg')
out = model([Image.open('cat.jpg'), np.array(Image.open('cat.jpg'))])
tuple(out.shape) == (2, 1000)

# deploy the model to a managed kubernetes cluster on NimbleBox.ai
url_endpoint, nbx_api_key = model.deploy()

# or load a cloud infer model and use seamlessly
model = nbox.load(
  model_key_or_url = url_endpoint,
  nbx_api_key = nbx_api_key,
  category = "image"
)

# Deja-Vu!
out_single = model('cat.jpg')
out = model([Image.open('cat.jpg'), np.array(Image.open('cat.jpg'))])
tuple(out.shape) == (2, 1000)

⚙️ CLI

Just add this to your dockerfile or github actions.

NBX_AUTH=1 python -m nbox deploy --model_path=my/model.onnx --deployment_type="nbox"

# or for more details

python -m nbox --help

✏️ Things for Repo

  • Using poetry for proper package management as @cshubhamrao says.
    • Add new packages with poetry add <name>. Do not add torch, tensorflow and others, useless burden to manage those.
    • When pushing to pypi just do poetry build && poetry publish this manages all the things around
  • Install pytest and then run pytest tests/ -v.
  • Using black for formatting, VSCode to the moon.
  • To make the docs:
    # from current folder
    sphinx-apidoc -o docs/source/ ./nbox/ -M -e
    cd docs && make html
    cd ../build/html && python3 -m http.server 80
    

🧩 License

The code in thist repo is licensed as BSD 3-Clause. 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.8.8a1.tar.gz (106.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nbox-0.8.8a1-py3-none-any.whl (108.9 kB view details)

Uploaded Python 3

File details

Details for the file nbox-0.8.8a1.tar.gz.

File metadata

  • Download URL: nbox-0.8.8a1.tar.gz
  • Upload date:
  • Size: 106.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.10 Darwin/21.1.0

File hashes

Hashes for nbox-0.8.8a1.tar.gz
Algorithm Hash digest
SHA256 15d096aa266ed33465c9b4d7927a0af2603ee8a481ef27038ba3a0ea1e24d22c
MD5 3a70b65e3d077ced8f074392c38abc44
BLAKE2b-256 f1d6f729317163e860064a256197c2e8a7944826d8451d1baae4bb4ed5b72ea7

See more details on using hashes here.

File details

Details for the file nbox-0.8.8a1-py3-none-any.whl.

File metadata

  • Download URL: nbox-0.8.8a1-py3-none-any.whl
  • Upload date:
  • Size: 108.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.10 Darwin/21.1.0

File hashes

Hashes for nbox-0.8.8a1-py3-none-any.whl
Algorithm Hash digest
SHA256 01c7000d63b82bab655e56b56e44ce77236f05c7aececa26803352aa068f7c8b
MD5 1e81168454cab7122a9bc0ece73813cb
BLAKE2b-256 6fdd7d6a0b107aed7ad8bc52564e2166d608b748f62b666382aee38367db3079

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page