Author, build & deploy Python models for the Motion inference platform
Project description
motion-cli (Python)
Build and deploy Docker images for models on the Motion inference platform.
pip install -e /path/to/cli-py # gives the `motion` command
export MOTION_API_KEY=motion_live_<your_key>
Quick start
A model is a folder with motion.yml + predict.py:
# predict.py
from motion import BasePredictor, Input, Path
class MyPredictor(BasePredictor):
def setup(self):
self.model = load_model(...)
def predict(self, video: Path = Input(description="Input clip")) -> Path:
out = "/tmp/out.mp4"
self.model.run(video, out)
return Path(out)
# motion.yml
name: lingbot-map
predict: predict.py:MyPredictor
description: Streaming 3D reconstruction
# Where the model appears in GET /api/v1/motion/models
category: reconstruction # required for catalog listing
inference_model: lingbot-map # optional; defaults to `name`
input_type: video # video | image | text
output_type: mp4
# Used by `motion deploy` to measure CPU/RAM via docker stats
sample: demo_files/input.mp4
build:
gpu: true
cuda: "11.8"
python_version: "3.11"
system_packages: [ffmpeg]
python_packages: ["torch>=2.4.0"]
# Optional — overrides auto-profiling
compute:
cpu: 4
memory_mib: 16384
gpu: true
weights:
- path: weights/model.pt
url: https://example.com/model.pt
dest: weights/model.pt
Commands
motion build
Uploads local weights to S3 (via MOTION_API_KEY, no AWS creds on your machine),
generates .motion/Dockerfile, and builds motion-<name>:latest.
motion build . # build image
motion build . --dry-run # print Dockerfile only
motion build . --tag myimg:dev # custom tag
Requires: MOTION_API_KEY when weights: has local files to upload.
Large weights (≥64 MiB) use multipart S3 upload automatically.
motion deploy
Profiles the local image, pushes to ECR, and registers the model in the platform.
motion deploy .
motion deploy . --no-profile # skip docker stats measurement
motion deploy . --sample tests/clip.mp4 # override profiling input
motion deploy . --profile-timeout 300 # longer profiling window
Flow:
- Parse
motion.yml(includingcategory,sample,compute) - Profile — run the container locally, poll
docker stats, derivecpu_vcpus+memory_mib- Skipped if
compute:is set in motion.yml (compute_source=declared) - Skipped with
--no-profile - Skipped if no sample file is found
- Skipped if
- Push image to ECR (backend issues a short-lived docker login token)
- Register —
POST /api/v1/motion/models/registerwith:model_code=<namespace>/<name>(e.g.saurav/lingbot-map)category_code,inference_model_slug, compute profile, predict params
Requires: MOTION_API_KEY, local image from motion build.
Category codes: list with GET /api/v1/motion/models — e.g. reconstruction, hand-tracking, mesh, 3d-object.
After deploy, submit jobs with:
POST /api/v1/motion/submit model_name=<namespace>/<name>
Environment
| Variable | Purpose |
|---|---|
MOTION_API_KEY |
Auth for build (weight upload) and deploy (ECR + register) |
MOTION_API_URL |
Backend base URL (default: Motion App Runner prod) |
Image contract
Every built image exposes: GET /health, GET /schema, POST /predict.
Weights declared in motion.yml are fetched from S3 at container startup — not baked into the image.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file motion_intelligence-0.2.0.tar.gz.
File metadata
- Download URL: motion_intelligence-0.2.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f266844cca6a8fb478146169607bc7a81673553290695a1674c72431ba95f60
|
|
| MD5 |
9b2bc252af1a1d43b580f87752c084c8
|
|
| BLAKE2b-256 |
de89dd4b0b24c3769b87ea8651e7a903ca4661d5ed0f318d376d3296931483e1
|
File details
Details for the file motion_intelligence-0.2.0-py3-none-any.whl.
File metadata
- Download URL: motion_intelligence-0.2.0-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0edda6166d19e90293132f0cbba13e596ab49b645ff7aadf92ca239a3385056c
|
|
| MD5 |
bc84918fcbf803a54ecc04a5b9ab38e4
|
|
| BLAKE2b-256 |
33368ac639f0794297d1287f74a28dcc3b482904a5f808921920736ab35de01d
|