syvain-training-utils
Internal Syvain helpers for small, explicit ML training runs. No secret sauce here, just shared runtime, device-diagnostic, and checkpoint patterns.
Install
uv add syvain-training-utils
Runtime setup
from syvain_training_utils import (
generate_run_id,
require_torch_compile_toolchain,
select_device,
)
run_id = generate_run_id()
device = select_device()
require_torch_compile_toolchain()
Device smoke test
import json
from syvain_training_utils import run_device_smoke_test
report = run_device_smoke_test(require_cuda=True)
print(json.dumps({"smoke": report}, indent=2, sort_keys=True))
Checkpoint a training run
from syvain_training_utils import (
StorageConfig,
TrainingLoopState,
load_training_checkpoint_if_available,
save_model_checkpoint,
)
storage_config = StorageConfig(
bucket="my-training-bucket",
s3_base_url="https://t3.storage.dev",
region="auto",
access_key_id="...",
secret_access_key="...",
)
checkpoint_base_path = "models/my-model"
loop_state = TrainingLoopState(
global_step=global_step,
curriculum_stage=curriculum_stage,
curriculum_step=curriculum_step,
)
save_model_checkpoint(
storage_config=storage_config,
base_path=checkpoint_base_path,
experiment_slug=experiment_slug,
run_id=run_id,
model=model,
optimizer=optimizer,
scheduler=scheduler,
loop_state=loop_state,
checkpoint_label=f"step-{global_step:012d}",
)
resume = load_training_checkpoint_if_available(
storage_config=storage_config,
base_path=checkpoint_base_path,
model=model,
optimizer=optimizer,
scheduler=scheduler,
device=device,
)
The library owns the object-store clients. Every transient retry opens a fresh client, and expired Tigris multipart sessions restart the complete upload at the same checkpoint key. Checkpoint bodies are written through a temporary local file, uploaded with an adaptive multipart size, and downloaded with resumable range reads. Ensure the machine has temporary disk capacity for one checkpoint.
The manifest remains a pointer to the current checkpoint key within the configured bucket and also records its byte size, ETag, and SHA-256 digest. The manifest is published only after the checkpoint upload succeeds. Loading verifies the complete digest before deserializing the model, optimizer, optional scheduler, and PyTorch RNG state.
The storage transport uses a 10-second connect timeout, a 60-second read-inactivity timeout, and a 10-minute overall request timeout. A bounded 15-minute outer no-progress retry window owns recovery and client replacement.
Release files for syvain-training-utils 0.0.205
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| syvain_training_utils-0.0.205.tar.gz | 10.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| syvain_training_utils-0.0.205-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.3 kB
Release files / syvain_training_utils-0.0.205.tar.gz
| Download URL | syvain_training_utils-0.0.205.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f20d3462d418c601088e9735480ee13c538a23de134c2445c7becef6c35f41c
|
|
BLAKE2b-256 checksum How to use checksums |
b4cf84cebccc8c5cf0290f1fe8a1a7b0a34fafa21e525c3deff9e30cea1e2e15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / syvain_training_utils-0.0.205-py3-none-any.whl
| Download URL | syvain_training_utils-0.0.205-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64756d5fcc3dabaccf22728d76b2239f0059851eb359deec99069e30b743f02b
|
|
BLAKE2b-256 checksum How to use checksums |
ffaf7b7ae6ae4ec8dfeca144110c0fb40a18e129d0c26d4d41f51c861f7bbd17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|