A Python SDK for interacting with the Lumino Labs API
Project description
Lumino SDK for Python
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
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.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 os
import asyncio
from lumino.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.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.sdk import LuminoSDK
async def main():
async with LuminoSDK(os.environ.get("LUMINO_API_KEY")) as client:
files = await client.dataset.list_datasets()
job = await sdk.fine_tuning.create_fine_tuning_job(FineTuningJobCreate(
base_model_name="llm_llama3_1_8b",
dataset_name=files[0].name,
name=add_suffix("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.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
Built Distribution
File details
Details for the file lumino-0.10.0.tar.gz
.
File metadata
- Download URL: lumino-0.10.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9eb84023a7635f2f5b8b91f0950b6edbcfd99b0cc400383460f18bdb793a2df5 |
|
MD5 | 942c79883eccbc06afdc2317a064af77 |
|
BLAKE2b-256 | 6e5ee326f9b04c0beac423e602de1d6332d4675a83934c05596e9cbfd0214b10 |
File details
Details for the file lumino-0.10.0-py3-none-any.whl
.
File metadata
- Download URL: lumino-0.10.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1cd4c9a9e77cfe6b4f8b95eb5cdb4a4838f5ed93c3b7f377b7f981b58d79a67 |
|
MD5 | 08cedbe8a19488deb437814fc3a561bb |
|
BLAKE2b-256 | ca2ae10265e76c9ec38a1da27f3701569a94792bb604c27e47ceb394c474f5c2 |