Skip to main content

Unified model resource management for Lumen ML services

Project description

Lumen Resources

Lightweight tooling for shipping Lumen ML services. This package centralizes how models are described, validated, downloaded, and cached so every service (CLIP, face, etc.) follows the same playbook—whether weights live on Hugging Face, ModelScope, or a private registry.

Why use it?

  • Single source of truth – YAML configs describing deployments, devices, runtimes, and model aliases.
  • Schema-backed validation – JSON Schema plus Pydantic to catch errors before runtime.
  • Cross-platform downloads – Intelligent routing between Hugging Face and ModelScope with caching/resume support.
  • CLI + Python API – Automate in CI or embed in service bootstraps.
  • Result schemas – Typed response validators (EmbeddingV1, FaceV1, LabelsV1) for downstream services.

Installation

# project install
pip install "lumen-resources @ git+https://github.com/EdwinZhanCN/Lumen.git@main#subdirectory=lumen-resources"

# dev install
git clone https://github.com/EdwinZhanCN/Lumen.git
cd Lumen/lumen-resources
pip install -e ".[dev,config]"

Optional extras depending on your targets:

pip install huggingface_hub
pip install modelscope
pip install torch torchvision
pip install onnxruntime

Usage

CLI

# download everything defined in config.yaml
lumen-resources download config.yaml

# strict config validation
lumen-resources validate config.yaml

# validate a model_info.json
lumen-resources validate-model-info path/to/model_info.json

# inspect cache contents (defaults to ~/.lumen/)
lumen-resources list ~/.lumen/

Python API

from lumen_resources import (
    load_and_validate_config,
    Downloader,
    load_and_validate_model_info,
    EmbeddingV1,
)

config = load_and_validate_config("config.yaml")
downloader = Downloader(config, verbose=True)
results = downloader.download_all(force=False)

model_info = load_and_validate_model_info("model_info.json")

Configuration essentials

metadata:
  region: "other"      # "cn" and "other" currently both resolve to ModelScope; "other" is reserved for future Hugging Face routing
  cache_dir: "~/.lumen/models"

deployment:
  mode: "single"       # or "hub"
  service: "clip"

services:
  clip:
    enabled: true
    package: "lumen_clip"
    backend_settings:
      device: "cuda"
      batch_size: 16
      onnx_providers: ["CUDAExecutionProvider", "CPUExecutionProvider"]
    models:
      default:
        model: "ViT-B-32"
        runtime: "torch"
      fp16:
        model: "ViT-B-32"
        runtime: "onnx"
  • metadata.region controls region-aware download policy. cn uses ModelScope, and other currently also falls back to ModelScope until Hugging Face artifacts are uploaded.
  • backend_settings lets you declare execution providers, batch sizes, devices, etc.
  • Each entry in models becomes a cache namespace (clip/default, clip/fp16, …).

Reference

  • Source: src/lumen_resources/
    • lumen_config.py – Typed config models
    • downloader.py – Platform abstraction + caching
    • cli.py – Command entrypoint
    • result_schemas/ – Response validators
  • Docs: https://doc.lumilio.org
  • Issues & support: open a ticket in the main Lumen monorepo.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lumen_resources-0.4.8.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

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

lumen_resources-0.4.8-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file lumen_resources-0.4.8.tar.gz.

File metadata

  • Download URL: lumen_resources-0.4.8.tar.gz
  • Upload date:
  • Size: 30.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for lumen_resources-0.4.8.tar.gz
Algorithm Hash digest
SHA256 ba19b048e578431f5e2fefa70208dd2c7e2326f09b4a3088966455d0420b9926
MD5 70565385e4b932a64e859b3ef38dd136
BLAKE2b-256 50fdd0e6a34bb2f5afd9047010728504f8750afc0e9252b8d14bb1ffadf585d1

See more details on using hashes here.

File details

Details for the file lumen_resources-0.4.8-py3-none-any.whl.

File metadata

File hashes

Hashes for lumen_resources-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 e3cccb3d4226940ccb6e81266ab86cda2f7a446cced6da797e3584fc841344e3
MD5 b32fb27bf4d0ce244f6858b3d80835f2
BLAKE2b-256 792d373c67986aba6a663bc483f3e83a6fd0126590ee7afa2505878b2593f9c7

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