Skip to main content

Post-training algorithms and recipes for the Logits platform, built on the Logits SDK

Project description

Logits Cookbook

logits_cookbook is a recipe library for training and evaluation on the Logits platform. It is built on the logits SDK and provides higher-level recipes, renderers, evaluation helpers, and end-to-end examples for Logits users.

Installation

  1. Create a Logits platform API key in your Logits console.
  2. Export it as LOGITS_API_KEY.
  3. Install the SDK and cookbook in a virtual environment.
pip install logits-sdk logits-cookbook

For local development on the cookbook itself:

pip install -e .

Backend Model

The cookbook builds on the same training, sampling, and checkpoint primitives exposed through logits. A minimal low-level flow looks like:

import logits

service_client = logits.ServiceClient()
training_client = service_client.create_lora_training_client(
  base_model="meta-llama/Llama-3.2-1B", rank=32,
)
training_client.forward_backward(...)
training_client.optim_step(...)
training_client.save_state(...)
training_client.load_state(...)

sampling_client = training_client.save_weights_and_get_sampling_client(name="my_model")
sampling_client.sample(...)

See logits_cookbook/recipes/sl_loop.py and logits_cookbook/recipes/rl_loop.py for minimal examples.

To download the weights of any model:

rest_client = service_client.create_rest_client()
future = rest_client.get_checkpoint_archive_url_from_tinker_path(sampling_client.model_path)
with open(f"model-checkpoint.tar.gz", "wb") as f:
    f.write(future.result())

Logits Cookbook

Besides these primitives, we also offer Logits Cookbook (a.k.a. this repo), a library of abstractions and starter scripts for customizing training environments.

The current primary getting-started path is the four starter scripts in logits_cookbook/recipes/:

  1. sl_basic.py: configuration-driven supervised learning starter.
  2. sl_loop.py: minimal supervised learning loop close to the raw API.
  3. rl_basic.py: configuration-driven reinforcement learning starter.
  4. rl_loop.py: minimal reinforcement learning loop close to the raw API.

The repository still contains additional recipe directories for more advanced or experimental workflows, but they are not part of the primary entry path above.

Documentation

The docs/ directory contains the Logits Cookbook documentation for install, training, checkpointing, and evaluation workflows.

Note: The documentation files use MDX format (Markdown with JSX), which includes some syntax that isn't standard Markdown. You may see things like import statements, <Callout> components, or curly-brace expressions. These are artifacts of our documentation framework - the actual content should still be readable as Markdown.

If you find errors or want to improve the documentation, edit files in docs/ directly.

Import our utilities

Logits Cookbook includes several utilities:

Additional utilities, including evaluation integrations, remain available in the repository but are outside the current primary getting-started path.

Development Setup

uv sync --extra dev
pre-commit install

This installs dev dependencies and registers pre-commit hooks that run ruff formatting and linting on every commit. CI enforces these checks on all pull requests.

Contributing

This project is built in the spirit of open science and collaborative development. We believe that the best tools emerge through community involvement and shared learning.

We welcome PR contributions.

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

logits_cookbook-0.1.1.tar.gz (858.6 kB view details)

Uploaded Source

Built Distribution

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

logits_cookbook-0.1.1-py3-none-any.whl (507.0 kB view details)

Uploaded Python 3

File details

Details for the file logits_cookbook-0.1.1.tar.gz.

File metadata

  • Download URL: logits_cookbook-0.1.1.tar.gz
  • Upload date:
  • Size: 858.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for logits_cookbook-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1657d9659e7befa83daae8e3c82b61acd902a265b79359614330db82bd48cb3f
MD5 baa84b75b7536e897fc70688e18c6e81
BLAKE2b-256 d0653cee120fe4240bb4eb782d969ae3ae3ea71df4f61f86f410c7bcf186a742

See more details on using hashes here.

Provenance

The following attestation bundles were made for logits_cookbook-0.1.1.tar.gz:

Publisher: publish.yml on GradientHQ/logits-cookbook

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logits_cookbook-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: logits_cookbook-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 507.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for logits_cookbook-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5feef75e4ab6f2df96f907f1158f7ce166edae0f6a117609346c9b35c368a82a
MD5 1765a70e271a9dec31c0eb297f82163b
BLAKE2b-256 c5385d55d719ac467dfd94139d250c28ac88556fe21bef4e6c12b225f8dd150e

See more details on using hashes here.

Provenance

The following attestation bundles were made for logits_cookbook-0.1.1-py3-none-any.whl:

Publisher: publish.yml on GradientHQ/logits-cookbook

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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