Skip to main content

Warning: OnPod is currently in development and is not yet usable. Please check back later for updates.

OnPod: Seamless Local and Remote AI/ML Development

OnPod is an innovative Python library that simplifies AI and machine learning development by seamlessly integrating local and remote code execution. It optimizes resource usage, reduces costs, and provides a local-like development experience while supporting a variety of popular AI/ML libraries.

What It Is

OnPod is designed specifically for RunPod, a platform offering some of the lowest-cost GPU cloud computing options. The goal of this library is to let you write code as if it's running locally, but without paying for idle GPU time. Costs are incurred only during actual script execution.

What It Is Not

OnPod is not optimized for high-throughput, multi-user scenarios at this stage. If you need support for concurrent user requests, consider other solutions like VLLM or Text Generation Inference.

Key Features

  1. Versatile Library Support:

    • Compatible with PyTorch, TensorFlow, Keras, and Hugging Face Transformers.
    • Extensible to support additional AI/ML libraries in the future.
  2. Transparent API:

    • OnPod mimics the interfaces of supported libraries, allowing seamless integration with existing workflows.
  3. Intelligent Resource Management:

    • Automatically initializes with CPU-based instances for efficiency.
    • Dynamically allocates GPU resources when models require accelerated devices.
  4. Automatic Task Distribution:

    • CPU-bound tasks (e.g., data preprocessing, tokenization) are performed locally.
    • GPU-intensive operations are offloaded to serverless RunPod instances, reducing costs.
  5. On-Demand Resource Allocation:

    • Users are charged only for actual GPU time, ensuring cost efficiency.
  6. Seamless Development Experience:

    • Write and test code locally while effortlessly leveraging the power of cloud-based GPUs.

How It Works

OnPod provides proxy modules for supported AI/ML libraries that intercept operations and manage their execution:

  • Library Proxies: Redirects operations to remote instances, handling data transfer and execution for libraries like PyTorch, TensorFlow, Keras, and Transformers.
  • Automatic Import Handling: Dynamically imports remote modules when needed.
  • Workload Distribution: Executes CPU tasks locally while offloading GPU workloads to serverless instances, ensuring efficient resource use and cost savings.

This allows developers to write standard AI/ML code using their preferred libraries while benefiting from cloud-based computation without manual configuration.

Benefits

  • Cost Optimization: Pay only for the GPU resources you actually use, with CPU tasks running locally and GPU tasks on scale-to-zero instances.
  • Resource Efficiency: Leverage GPU power without needing local high-performance hardware.
  • Flexible Development: Develop and test AI/ML models locally with no changes to your workflow, regardless of the library.
  • Scalability: Easily scale computations to more powerful cloud resources as needed.
  • Library Agnostic: Switch between different AI/ML libraries without altering your development flow.

OnPod bridges the gap between local development and cloud-based high-performance computing, making AI/ML development more accessible, cost-effective, and flexible.

TODO: Library Support Status

  • PyTorch: In progress
  • TensorFlow: Planned
  • Keras: Planned
  • vLLM: Planned

Example Usage: Hugging Face Transformers with Meta Llama 3.1-8B

from onpod import transformers, torch

model_id = "meta-llama/Meta-Llama-3.1-8B"

pipeline = transformers.pipeline(
    "text-generation", model=model_id, model_kwargs={"torch_dtype": torch.bfloat16}, device_map="auto"
)

pipeline("Hey, how are you doing today?")

This example performs tokenization on the local machine, generation on a serverless endpoint, and then decodes the tokens back on the local machine.

Example: VLLM

from onpod import vllm, torch

llm = vllm.LLM(model="meta-llama/Meta-Llama-3.1-8B", dtype=torch.bfloat16)

prompt = "Explain the concept of quantum computing in simple terms."

outputs = llm.generate([prompt], max_tokens=150)

print(outputs[0].outputs[0].text)

Drawbacks

There is a significant startup time on the first invocation as the endpoint is deployed and the model is downloaded (if necessary). Subsequent calls are faster, as the endpoint is already deployed and the model is cached. In the future, a VSCode extension will be developed to pre-deploy endpoints and cache models for faster startup.

Metadata

Release files for onpod 0.0.31

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for onpod 0.0.31
File Size Uploaded Provenance
onpod-0.0.31.tar.gz 8.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for onpod 0.0.31
File Interpreter ABI Platform
onpod-0.0.31-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / onpod-0.0.31.tar.gz

Download URL onpod-0.0.31.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
382091255e00c5bc4f322ff89a3388439e153a510135e3ea45d07d99e6d282a1
BLAKE2b-256 checksum
How to use checksums
76d80dd81893a4fca40ad286fde784949d12c890896886ab248148ae0645682b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.5 Darwin/23.2.0

Release files / onpod-0.0.31-py3-none-any.whl

Download URL onpod-0.0.31-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be1432a081234de8571ecdcaf02d59b845fc842190a0015082b7438d92cf39ac
BLAKE2b-256 checksum
How to use checksums
2689b294cf9f2dd97a5005a3fddcf85d4e01db97f82877cc9bab6b761ac393a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.5 Darwin/23.2.0

Security for onpod 0.0.31

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page