Skip to main content

A Python SDK for interacting with the Lumino Labs API

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Lumino SDK for Python

Static Badge X (formerly Twitter) Follow

The Lumino SDK for Python provides a convenient way to interact with the Lumino API for managing large language model (LLM) fine-tuning processes and related resources.

Features

  • User management
  • API key management
  • Dataset operations
  • Fine-tuning job management
  • Model information retrieval
  • Usage tracking

Installation

You can install the Lumino SDK using pip:

pip install lumino-api-sdk-python

Setting up API Key

Generate an API key by visiting the Lumino Dashboard at this settings page.

Setting environment variable

export LUMINO_API_KEY=xxxxx

Usage – Python Client

User Management

import os
import asyncio
from lumino.api_sdk.sdk import LuminoSDK


async def main():
    async with LuminoSDK(os.environ.get("LUMINO_API_KEY")) as client:
        user = await client.user.get_current_user()
        print(user)


asyncio.run(main())

Datasets

The files API is used for fine-tuning and allows developers to upload data to fine-tune on. It also has several methods to list all files, retrive files, and delete files. Please refer to our fine-tuning docs here.

import asyncio
import os

from lumino.api_sdk.sdk import LuminoSDK


async def main():
    async with LuminoSDK(os.environ.get("LUMINO_API_KEY")) as client:
        files = await client.dataset.list_datasets()
        await client.dataset.upload_dataset("somefile.jsonl")
        await client.dataset.get_dataset("somefile.jsonl")
        await client.dataset.delete("somefile.jsonl")

        print(files)


asyncio.run(main())

Models

This lists all the models that Lumino supports.

import os
import asyncio
from lumino.api_sdk.sdk import LuminoSDK


async def main():
    async with LuminoSDK(os.environ.get("LUMINO_API_KEY")) as client:
        models = await client.model.list_base_models()
        print(models)


asyncio.run(main())

Fine-tunes

The finetune API is used for fine-tuning and allows developers to create finetuning jobs. It also has several methods to list all jobs, retrive statuses and get checkpoints. Please refer to our fine-tuning docs here.

import os
import asyncio
from lumino.api_sdk.sdk import LuminoSDK
from lumino.api_sdk.models import FineTuningJobCreate, FineTuningJobParameters


async def main():
    async with LuminoSDK(os.environ.get("LUMINO_API_KEY")) as client:
        files = await client.dataset.list_datasets()
        job = await client.fine_tuning.create_fine_tuning_job(FineTuningJobCreate(
            base_model_name="llm_llama3_1_8b",
            dataset_name=files[0].name,
            name="test-fine-tuning-job",
            parameters=FineTuningJobParameters(
                batch_size=2,
                shuffle=True,
                num_epochs=1,
                use_lora=True,
                use_qlora=False
            )
        ))

        print(job)

        jobs = await client.fine_tuning.list_fine_tuning_jobs()
        print(jobs)

        job_details = await client.fine_tuning.get_fine_tuning_job(job.name)
        print(job_details)


asyncio.run(main())

Usage Tracking

import os
import asyncio
from lumino.api_sdk.sdk import LuminoSDK
from datetime import timedelta, date


async def main():
    async with LuminoSDK(os.environ.get("LUMINO_API_KEY")) as client:
        end_date = date.today()
        start_date = end_date - timedelta(days=30)
        total_cost = await client.usage.get_total_cost(start_date, end_date)
        print(total_cost)

        usage_records = await client.usage.list_usage_records(start_date, end_date)
        print(usage_records)


asyncio.run(main())

Support

If you encounter any problems or have any questions, please open an issue on the GitHub repository.

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

lumino_api_sdk_python-0.11.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

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

lumino_api_sdk_python-0.11.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file lumino_api_sdk_python-0.11.0.tar.gz.

File metadata

  • Download URL: lumino_api_sdk_python-0.11.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for lumino_api_sdk_python-0.11.0.tar.gz
Algorithm Hash digest
SHA256 47ae5ac4f840128afda8138d0af157bf546b360a0b92e9bf9f966aab43bd354f
MD5 fef8ab8cc902050c62f6b551a847d8ba
BLAKE2b-256 6f82afce5d0d3ec86536463f6310632d1aa26a9003c1695cd5c2e3964c7da410

See more details on using hashes here.

File details

Details for the file lumino_api_sdk_python-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lumino_api_sdk_python-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2019ba2ae1feddda4ebfd95dc3e12f4f819f9be352ae0cbaa2226606bda0edab
MD5 5d9ac874b572028b5d1ea8a62ef93cfc
BLAKE2b-256 cf433acad2c860d331cb4d0538616b04b8361eec1037a5da0e4d26020d2ee31a

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