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
- Create a Logits platform API key in your Logits console.
- Export it as
LOGITS_API_KEY. - 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/:
sl_basic.py: configuration-driven supervised learning starter.sl_loop.py: minimal supervised learning loop close to the raw API.rl_basic.py: configuration-driven reinforcement learning starter.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:
renderersconverts tokens from/to structured chat message objectshyperparam_utilshelps calculate hyperparameters suitable for LoRAscheckpoint_utilshelps save, resume, and inspect checkpoints
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
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 logits_cookbook-0.1.0.tar.gz.
File metadata
- Download URL: logits_cookbook-0.1.0.tar.gz
- Upload date:
- Size: 858.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9fda68889e5189d6a369ddde17d76ead54317b71d13a62de7bd95051a7fe543
|
|
| MD5 |
4b125f88fa339b9bb511e49f908179ed
|
|
| BLAKE2b-256 |
3ec5ff62765154e2c2cfceeaf15c65d1ec9562d0a5fd138e6794d6d584488ad2
|
Provenance
The following attestation bundles were made for logits_cookbook-0.1.0.tar.gz:
Publisher:
publish.yml on GradientHQ/logits-cookbook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logits_cookbook-0.1.0.tar.gz -
Subject digest:
b9fda68889e5189d6a369ddde17d76ead54317b71d13a62de7bd95051a7fe543 - Sigstore transparency entry: 1627188979
- Sigstore integration time:
-
Permalink:
GradientHQ/logits-cookbook@2bf6705febf95a945b891b33b54669d23a8b61b2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GradientHQ
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2bf6705febf95a945b891b33b54669d23a8b61b2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file logits_cookbook-0.1.0-py3-none-any.whl.
File metadata
- Download URL: logits_cookbook-0.1.0-py3-none-any.whl
- Upload date:
- Size: 507.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13fff9d8d431a697660e85f04eea3a5bd3d9d3f14d552cf95d13d52c743fce8e
|
|
| MD5 |
5fd5fed0f410d04f924bbd758588cbe4
|
|
| BLAKE2b-256 |
6b060b5d3cf30313a930ff43402122298e8c2ffa0c4240bcdb791c49b9b2c337
|
Provenance
The following attestation bundles were made for logits_cookbook-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on GradientHQ/logits-cookbook
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logits_cookbook-0.1.0-py3-none-any.whl -
Subject digest:
13fff9d8d431a697660e85f04eea3a5bd3d9d3f14d552cf95d13d52c743fce8e - Sigstore transparency entry: 1627189046
- Sigstore integration time:
-
Permalink:
GradientHQ/logits-cookbook@2bf6705febf95a945b891b33b54669d23a8b61b2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/GradientHQ
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2bf6705febf95a945b891b33b54669d23a8b61b2 -
Trigger Event:
workflow_dispatch
-
Statement type: