Deployment
Client
What This Demonstrates
- Minimal
@remotefunction with no dependencies - Using
benchmark_datasetwith a single sample input - Calling a remote function in a loop
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
A minimal deployment that squares a number on a remote GPU.
# deploy.py
from vastai import Deployment
from vastai.data.query import gpu_name, RTX_4090, RTX_5090
app = Deployment(name="square")
@app.remote(benchmark_dataset=[{"x": 2}])
async def square(x):
return x * x
app.configure_autoscaling(min_load=1000)
image = app.image("vastai/base-image:@vastai-automatic-tag", 16)
image.require(gpu_name.in_([RTX_4090, RTX_5090]))
app.ensure_ready()
# client.py
import asyncio
from deploy import app, square
async def main():
for x in range(1, 10):
result = await square(x)
print(f"square({x}) = {result}")
if __name__ == "__main__":
asyncio.run(main())
@remote function with no dependenciesbenchmark_dataset with a single sample input